A Pen by Ken Howard on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shoppingList = { | |
items: {}, | |
addItem: function (item:string, qty:number) { | |
if (typeof item === 'string' && typeof qty === 'number') { | |
item = item.trim(); // clean this up a bit | |
qty = item[item] ? item[item] + qty : qty; // calc qty | |
this.items[item] = qty; | |
console.log(`Added ${this.items[this.items.length - 1]}`); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shoppingList = { | |
items: {}, | |
addItem: function (item, qty) { | |
item = item.trim(); // clean this up a bit | |
qty = item[item] ? item[item] + qty : qty; // calc qty | |
this.items[item] = qty; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shoppingList = { | |
items: [], | |
addItem: function (item, qty) { | |
if (typeof item === 'string' && typeof qty === 'number') { | |
this.items.push(`${qty} ${item}`); | |
console.log(`Added ${this.items[this.items.length - 1]}`); | |
} else { | |
// throw exception | |
console.error('Invalid parameters'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Use IntelliSense to learn about possible Node.js debug attributes. | |
// Hover to view descriptions of existing attributes! | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Program", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { InMemoryDbService } from 'angular-in-memory-web-api'; | |
declare var file: any; | |
export class InMemoryEntryService implements InMemoryDbService { | |
createDb() { | |
let entries = [ | |
{ | |
id: 1, | |
title: 'Burning Sundown Behind Trees', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clear the console on each refresh | |
console.log('\033c'); | |
function addToCart(product, price, { quantity = 1, currency = 'USD' }) { | |
console.log(product, price, quantity, currency); | |
} | |
let Bicycle = { | |
product: 'Bicycle', | |
price: 99.99 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app="app"> | |
<head> | |
<meta http-equiv="cache-control" content="no-cache" /> | |
<meta name="robots" content="noindex, nofollow" /> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width" /> | |
<title ng-bind="APP_NAME">Loading...</title> | |
<link rel="icon" href="data:;base64,=" /> | |
<link rel="stylesheet" href="css/lib.css" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
src/**/*.js | |
src/**/*.js.map | |
typings/**/*.d.ts | |
!typings/tsd.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import * as fs from 'fs'; | |
import * as Linter from 'tslint'; | |
let configuration = require('./tslint.json'); | |
let options = { | |
formatter: 'prose', | |
configuration: configuration, | |
rulesDirectory: '', | |
formattersDirectory: '' |