@pagedip/util-find-files
Advanced tools
Comparing version 1.0.0 to 1.0.1-rc.0
146
index.js
@@ -10,148 +10,6 @@ 'use strict'; | ||
var asyncGenerator = function () { | ||
function AwaitValue(value) { | ||
this.value = value; | ||
} | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function (resolve, reject) { | ||
var request = { | ||
key: key, | ||
arg: arg, | ||
resolve: resolve, | ||
reject: reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
if (value instanceof AwaitValue) { | ||
Promise.resolve(value.value).then(function (arg) { | ||
resume("next", arg); | ||
}, function (arg) { | ||
resume("throw", arg); | ||
}); | ||
} else { | ||
settle(result.done ? "return" : "normal", result.value); | ||
} | ||
} catch (err) { | ||
settle("throw", err); | ||
} | ||
} | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
break; | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
default: | ||
front.resolve({ | ||
value: value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
front = front.next; | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
this._invoke = send; | ||
if (typeof gen.return !== "function") { | ||
this.return = undefined; | ||
} | ||
} | ||
if (typeof Symbol === "function" && Symbol.asyncIterator) { | ||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () { | ||
return this; | ||
}; | ||
} | ||
AsyncGenerator.prototype.next = function (arg) { | ||
return this._invoke("next", arg); | ||
}; | ||
AsyncGenerator.prototype.throw = function (arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
AsyncGenerator.prototype.return = function (arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
return { | ||
wrap: function (fn) { | ||
return function () { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
}, | ||
await: function (value) { | ||
return new AwaitValue(value); | ||
} | ||
}; | ||
}(); | ||
var asyncToGenerator = function (fn) { | ||
return function () { | ||
var gen = fn.apply(this, arguments); | ||
return new Promise(function (resolve, reject) { | ||
function step(key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
return Promise.resolve(value).then(function (value) { | ||
step("next", value); | ||
}, function (err) { | ||
step("throw", err); | ||
}); | ||
} | ||
} | ||
return step("next"); | ||
}); | ||
}; | ||
}; | ||
var index = (function () { | ||
var _ref = asyncToGenerator(function* (root, fn, base) { | ||
var _ref = _asyncToGenerator(function* (root, fn, base) { | ||
fn = fn || function () { | ||
@@ -158,0 +16,0 @@ return true; |
{ | ||
"name": "@pagedip/util-find-files", | ||
"version": "1.0.0", | ||
"version": "1.0.1-rc.0", | ||
"author": "Tyler Johnson <tyler@beneaththeink.com>", | ||
@@ -22,4 +22,4 @@ "repository": { | ||
"devDependencies": { | ||
"npm-run-all": "^4.1.1", | ||
"rollup": "^0.50.0", | ||
"npm-run-all": "^4.1.2", | ||
"rollup": "^0.53.3", | ||
"shx": "^0.2.2" | ||
@@ -30,3 +30,3 @@ }, | ||
], | ||
"gitHead": "8aae2d936f98f6f3b228a7c1a97f36ef409ea957" | ||
"gitHead": "67860f9c5f27665fa10de204a4ea7623ec5d32bd" | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3121
71
2