failing
tests fail, passing
tests pass.
AngularJS HttpPromise
methods (.success
and .error
) break the promise chain.
It is advisable to stick with classic Promise methods: .then
and .catch
.
failing
tests fail, passing
tests pass.
AngularJS HttpPromise
methods (.success
and .error
) break the promise chain.
It is advisable to stick with classic Promise methods: .then
and .catch
.
require("babel/polyfill"); | |
async () => { | |
let value = await ( | |
() => new Promise(resolve => setTimeout( | |
() => resolve("value"), 2000 | |
)) | |
)(); | |
console.log(value); |
var data = [ | |
[ | |
{field: 123, sum: 100}, | |
{field: 345, sum: 98} | |
],[ | |
{field: 123, sum: 12}, | |
{field: 345, sum: 20} | |
] | |
]; |
[0, 1, "", " ", -1, false, true, undefined, [], null, {}, NaN, function () {}] | |
.filter(Boolean) | |
.map(val => console.log(val)); |
function runner(cb) { | |
if (Math.round(Math.random())) { | |
return void cb("error"); | |
} | |
return void cb(); | |
} | |
function callback(err) { | |
if (err) { | |
console.error(err); |
var assert = require("assert"); | |
var value = runner(callback); | |
assert.equal(value, "correct value"); | |
function runner(cb) { | |
if (true /* or some imaginary condition */) { | |
return cb("wrong value"); | |
} | |
return cb(null, "correct value"); |
require("babel/polyfill"); | |
var assert = require("assert"); | |
async () => { | |
let start = new Date; | |
let [valuea, valueb] = await* [ | |
(() => new Promise(resolve => setTimeout( | |
() => resolve("value a"), 2000 | |
)))(), | |
(() => new Promise(resolve => setTimeout( |
let {...a} = {a: 1}; |
function x({lines = 1000, cords = "foo", ...opt}) { | |
console.log(lines, cords, opt); | |
} | |
x({ | |
lines: 2000, | |
thing: "bling", | |
}); |
"dependencies": { | |
"del": "^1.1.1", | |
"gulp": "^3.5.6", | |
"gulp-concat": "^2.5.2", | |
"gulp-minify-css": "^0.3.0", | |
"gulp-rename": "^1.2.0", | |
"gulp-sass": "^1.3.3", | |
"gulp-sourcemaps": "^1.5.2", | |
"gulp-uglify": "^1.2.0", | |
"gulp-ng-annotate": "^0.5.3" |