extra-generator
Advanced tools
Comparing version 0.2.12 to 0.2.13
@@ -5,2 +5,9 @@ # Changelog | ||
### [0.2.13](https://github.com/BlackGlory/extra-generator/compare/v0.2.12...v0.2.13) (2021-11-17) | ||
### Features | ||
* add timestampBasedId ([b5bc49a](https://github.com/BlackGlory/extra-generator/commit/b5bc49a4969c6009128f9fa3469aeaa5c410f3f0)) | ||
### [0.2.12](https://github.com/BlackGlory/extra-generator/compare/v0.2.11...v0.2.12) (2021-10-14) | ||
@@ -7,0 +14,0 @@ |
@@ -686,2 +686,21 @@ (function (global, factory) { | ||
function* timestampBasedId() { | ||
const num = 0; | ||
const timestamp = Date.now(); | ||
yield [timestamp, num]; | ||
let lastTimestamp = timestamp; | ||
let lastNum = num; | ||
while (true) { | ||
const timestamp = Date.now(); | ||
if (timestamp === lastTimestamp) { | ||
yield [lastTimestamp, ++lastNum]; | ||
} | ||
else { | ||
lastNum = 0; | ||
lastTimestamp = timestamp; | ||
yield [lastTimestamp, lastNum]; | ||
} | ||
} | ||
} | ||
exports.ReusableAsyncIterable = ReusableAsyncIterable; | ||
@@ -699,2 +718,3 @@ exports.ReusableIterable = ReusableIterable; | ||
exports.stringifyNDJSONStreamAsync = stringifyNDJSONStreamAsync; | ||
exports.timestampBasedId = timestampBasedId; | ||
@@ -701,0 +721,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ExtraGenerator={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r={CustomError:void 0};class o extends Error{get name(){return this.constructor.name}}r.CustomError=o;var i={ExpectedError:void 0};const a=r;class l extends a.CustomError{}i.ExpectedError=l;var u={AssertionError:void 0};const f=r;class s extends f.CustomError{}u.AssertionError=s;var c={};c.normalize=void 0,c.normalize=function(e){var t;return{name:e.name,message:e.message,stack:null!==(t=e.stack)&&void 0!==t?t:null}};var d={refute:void 0};const y=i;d.refute=function(e,t){if(e)throw new y.ExpectedError(t)};var v={assert:void 0};const h=u; | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ExtraGenerator={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r={CustomError:void 0};class o extends Error{get name(){return this.constructor.name}}r.CustomError=o;var i={ExpectedError:void 0};const a=r;class l extends a.CustomError{}i.ExpectedError=l;var u={AssertionError:void 0};const f=r;class s extends f.CustomError{}u.AssertionError=s;var c={};c.normalize=void 0,c.normalize=function(e){var t;return{name:e.name,message:e.message,stack:null!==(t=e.stack)&&void 0!==t?t:null}};var d={refute:void 0};const y=i;d.refute=function(e,t){if(e)throw new y.ExpectedError(t)};var v={assert:void 0};const p=u; | ||
/*! ***************************************************************************** | ||
@@ -16,3 +16,3 @@ Copyright (c) Microsoft Corporation. | ||
***************************************************************************** */ | ||
function p(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||l(e,t)}))})}function l(e,t){try{(n=o[e](t)).value instanceof m?Promise.resolve(n.value.v).then(u,f):s(i[0][2],n)}catch(e){s(i[0][3],e)}var n}function u(e){l("next",e)}function f(e){l("throw",e)}function s(e,t){e(t),i.shift(),i.length&&l(i[0][0],i[0][1])}}function g(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function w(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}v.assert=function(e,t){if(!e)throw new h.AssertionError(t)},function(e){var n=t&&t.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};o(r,e),o(i,e),o(u,e),o(c,e),o(d,e),o(v,e)}(n);var S={},x={},O=1/0,E=17976931348623157e292,I=NaN,N="[object Symbol]",j=/^\s+|\s+$/g,_=/^[-+]0x[0-9a-f]+$/i,J=/^0b[01]+$/i,T=/^0o[0-7]+$/i,P=parseInt,z=Object.prototype.toString;function $(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=function(e){var t=function(e){if(!e)return 0===e?e:0;if((e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&z.call(e)==N}(e))return I;if(A(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=A(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(j,"");var n=J.test(e);return n||T.test(e)?P(e.slice(2),n?2:8):_.test(e)?I:+e}(e))===O||e===-1/0){return(e<0?-1:1)*E}return e==e?e:0}(e),n=t%1;return t==t?n?t-n:t:0}(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}function A(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var C=function(e){return $(2,e)},k=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};x.lazy=void 0;const M=k(C);x.lazy=function(e){return(0,M.default)(e)};var D={lazyFunction:void 0};const B=x;var F,R;D.lazyFunction=function(e){const t=(0,B.lazy)(e);return(...e)=>t()(...e)},function(e){var n=t&&t.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};r(x,e),r(D,e)}(S);class W{constructor(e){F.set(this,void 0),this.getIterator=S.lazy((()=>e[Symbol.iterator]()))}get done(){return g(this,F,"f")}close(){var e,t;this.done||(w(this,F,!0,"f"),null===(t=(e=this.getIterator()).return)||void 0===t||t.call(e))}[(F=new WeakMap,Symbol.iterator)](){return{next:()=>{if(g(this,F,"f"))return{done:!0,value:void 0};const{value:e,done:t}=this.getIterator().next();return t&&w(this,F,!0,"f"),{value:e,done:t}}}}}class G{constructor(e){R.set(this,void 0),this.getIterator=S.lazy((()=>e[Symbol.asyncIterator]()))}get done(){return g(this,R,"f")}close(){var e,t;return p(this,void 0,void 0,(function*(){this.done||(w(this,R,!0,"f"),yield null===(t=(e=this.getIterator()).return)||void 0===t?void 0:t.call(e))}))}[(R=new WeakMap,Symbol.asyncIterator)](){return{next:()=>p(this,void 0,void 0,(function*(){if(g(this,R,"f"))return{done:!0,value:void 0};const{value:e,done:t}=yield this.getIterator().next();return t&&w(this,R,!0,"f"),{value:e,done:t}}))}}}e.ReusableAsyncIterable=G,e.ReusableIterable=W,e.countdown=function*(e,t){if(!(e<t))for(let n=e;n>=t;n--)yield n},e.countup=function*(e,t){if(!(e>t))for(let n=e;n<=t;n++)yield n},e.of=function*(e){yield e},e.range=function(e,t,r=1){return n.assert(r>0,"step parameter must be greater than 0"),function*(e,t,n){if(e<t)for(let r=e;r<t;r+=n)yield r;else for(let r=e;r>t;r-=n)yield r}(e,t,r)},e.repeat=function(e,t=1/0){return n.assert(t===1/0||Number.isInteger(t),"The parameter times must be an integer"),function*(){for(;t-- >0;)yield e}()},e.sse=function*(e){e.event&&(yield`event: ${e.event}\n`);for(const t of e.data.split("\n"))yield`data: ${t}\n`;e.id&&(yield`id: ${e.id}\n`),e.retry&&(yield`retry: ${e.retry}\n`),yield"\n"},e.stringifyJSONStream=function*(e){var t;const n=e[Symbol.iterator]();let r;try{let e;for(({value:e,done:r}=n.next()),yield"[",r||(yield JSON.stringify(e));({value:e,done:r}=n.next()),!r;)yield","+JSON.stringify(e);yield"]"}finally{r||null===(t=n.return)||void 0===t||t.call(n)}},e.stringifyJSONStreamAsync=function(e){var t;return b(this,arguments,(function*(){const n=e[Symbol.asyncIterator]();let r;try{let e;for(({value:e,done:r}=yield m(n.next())),yield yield m("["),r||(yield yield m(JSON.stringify(e)));({value:e,done:r}=yield m(n.next())),!r;)yield yield m(","+JSON.stringify(e));yield yield m("]")}finally{r||(yield m(null===(t=n.return)||void 0===t?void 0:t.call(n)))}}))},e.stringifyNDJSONStream=function*(e){var t;const n=e[Symbol.iterator]();let r;try{let e;for(({value:e,done:r}=n.next()),r||(yield JSON.stringify(e));({value:e,done:r}=n.next()),!r;)yield"\n"+JSON.stringify(e)}finally{r||null===(t=n.return)||void 0===t||t.call(n)}},e.stringifyNDJSONStreamAsync=function(e){var t;return b(this,arguments,(function*(){const n=e[Symbol.asyncIterator]();let r;try{let e;for(({value:e,done:r}=yield m(n.next())),r||(yield yield m(JSON.stringify(e)));({value:e,done:r}=yield m(n.next())),!r;)yield yield m("\n"+JSON.stringify(e))}finally{r||(yield m(null===(t=n.return)||void 0===t?void 0:t.call(n)))}}))},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
function h(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||l(e,t)}))})}function l(e,t){try{(n=o[e](t)).value instanceof m?Promise.resolve(n.value.v).then(u,f):s(i[0][2],n)}catch(e){s(i[0][3],e)}var n}function u(e){l("next",e)}function f(e){l("throw",e)}function s(e,t){e(t),i.shift(),i.length&&l(i[0][0],i[0][1])}}function w(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function g(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}v.assert=function(e,t){if(!e)throw new p.AssertionError(t)},function(e){var n=t&&t.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};o(r,e),o(i,e),o(u,e),o(c,e),o(d,e),o(v,e)}(n);var S={},x={},O=1/0,E=17976931348623157e292,I=NaN,N="[object Symbol]",j=/^\s+|\s+$/g,_=/^[-+]0x[0-9a-f]+$/i,J=/^0b[01]+$/i,T=/^0o[0-7]+$/i,P=parseInt,z=Object.prototype.toString;function $(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=function(e){var t=function(e){if(!e)return 0===e?e:0;if((e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&z.call(e)==N}(e))return I;if(A(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=A(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(j,"");var n=J.test(e);return n||T.test(e)?P(e.slice(2),n?2:8):_.test(e)?I:+e}(e))===O||e===-1/0){return(e<0?-1:1)*E}return e==e?e:0}(e),n=t%1;return t==t?n?t-n:t:0}(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}function A(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var C=function(e){return $(2,e)},D=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};x.lazy=void 0;const k=D(C);x.lazy=function(e){return(0,k.default)(e)};var M={lazyFunction:void 0};const B=x;var F,R;M.lazyFunction=function(e){const t=(0,B.lazy)(e);return(...e)=>t()(...e)},function(e){var n=t&&t.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};r(x,e),r(M,e)}(S);class W{constructor(e){F.set(this,void 0),this.getIterator=S.lazy((()=>e[Symbol.iterator]()))}get done(){return w(this,F,"f")}close(){var e,t;this.done||(g(this,F,!0,"f"),null===(t=(e=this.getIterator()).return)||void 0===t||t.call(e))}[(F=new WeakMap,Symbol.iterator)](){return{next:()=>{if(w(this,F,"f"))return{done:!0,value:void 0};const{value:e,done:t}=this.getIterator().next();return t&&g(this,F,!0,"f"),{value:e,done:t}}}}}class G{constructor(e){R.set(this,void 0),this.getIterator=S.lazy((()=>e[Symbol.asyncIterator]()))}get done(){return w(this,R,"f")}close(){var e,t;return h(this,void 0,void 0,(function*(){this.done||(g(this,R,!0,"f"),yield null===(t=(e=this.getIterator()).return)||void 0===t?void 0:t.call(e))}))}[(R=new WeakMap,Symbol.asyncIterator)](){return{next:()=>h(this,void 0,void 0,(function*(){if(w(this,R,"f"))return{done:!0,value:void 0};const{value:e,done:t}=yield this.getIterator().next();return t&&g(this,R,!0,"f"),{value:e,done:t}}))}}}e.ReusableAsyncIterable=G,e.ReusableIterable=W,e.countdown=function*(e,t){if(!(e<t))for(let n=e;n>=t;n--)yield n},e.countup=function*(e,t){if(!(e>t))for(let n=e;n<=t;n++)yield n},e.of=function*(e){yield e},e.range=function(e,t,r=1){return n.assert(r>0,"step parameter must be greater than 0"),function*(e,t,n){if(e<t)for(let r=e;r<t;r+=n)yield r;else for(let r=e;r>t;r-=n)yield r}(e,t,r)},e.repeat=function(e,t=1/0){return n.assert(t===1/0||Number.isInteger(t),"The parameter times must be an integer"),function*(){for(;t-- >0;)yield e}()},e.sse=function*(e){e.event&&(yield`event: ${e.event}\n`);for(const t of e.data.split("\n"))yield`data: ${t}\n`;e.id&&(yield`id: ${e.id}\n`),e.retry&&(yield`retry: ${e.retry}\n`),yield"\n"},e.stringifyJSONStream=function*(e){var t;const n=e[Symbol.iterator]();let r;try{let e;for(({value:e,done:r}=n.next()),yield"[",r||(yield JSON.stringify(e));({value:e,done:r}=n.next()),!r;)yield","+JSON.stringify(e);yield"]"}finally{r||null===(t=n.return)||void 0===t||t.call(n)}},e.stringifyJSONStreamAsync=function(e){var t;return b(this,arguments,(function*(){const n=e[Symbol.asyncIterator]();let r;try{let e;for(({value:e,done:r}=yield m(n.next())),yield yield m("["),r||(yield yield m(JSON.stringify(e)));({value:e,done:r}=yield m(n.next())),!r;)yield yield m(","+JSON.stringify(e));yield yield m("]")}finally{r||(yield m(null===(t=n.return)||void 0===t?void 0:t.call(n)))}}))},e.stringifyNDJSONStream=function*(e){var t;const n=e[Symbol.iterator]();let r;try{let e;for(({value:e,done:r}=n.next()),r||(yield JSON.stringify(e));({value:e,done:r}=n.next()),!r;)yield"\n"+JSON.stringify(e)}finally{r||null===(t=n.return)||void 0===t||t.call(n)}},e.stringifyNDJSONStreamAsync=function(e){var t;return b(this,arguments,(function*(){const n=e[Symbol.asyncIterator]();let r;try{let e;for(({value:e,done:r}=yield m(n.next())),r||(yield yield m(JSON.stringify(e)));({value:e,done:r}=yield m(n.next())),!r;)yield yield m("\n"+JSON.stringify(e))}finally{r||(yield m(null===(t=n.return)||void 0===t?void 0:t.call(n)))}}))},e.timestampBasedId=function*(){const e=Date.now();yield[e,0];let t=e,n=0;for(;;){const e=Date.now();e===t?yield[t,++n]:(n=0,t=e,yield[t,n])}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.umd.min.js.map |
@@ -654,2 +654,21 @@ (function (global, factory) { | ||
function* timestampBasedId() { | ||
const num = 0; | ||
const timestamp = Date.now(); | ||
yield [timestamp, num]; | ||
let lastTimestamp = timestamp; | ||
let lastNum = num; | ||
while (true) { | ||
const timestamp = Date.now(); | ||
if (timestamp === lastTimestamp) { | ||
yield [lastTimestamp, ++lastNum]; | ||
} | ||
else { | ||
lastNum = 0; | ||
lastTimestamp = timestamp; | ||
yield [lastTimestamp, lastNum]; | ||
} | ||
} | ||
} | ||
exports.ReusableAsyncIterable = ReusableAsyncIterable; | ||
@@ -667,2 +686,3 @@ exports.ReusableIterable = ReusableIterable; | ||
exports.stringifyNDJSONStreamAsync = stringifyNDJSONStreamAsync; | ||
exports.timestampBasedId = timestampBasedId; | ||
@@ -669,0 +689,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ExtraGenerator={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={},n={CustomError:void 0};class o extends Error{get name(){return this.constructor.name}}n.CustomError=o;var i={ExpectedError:void 0};const a=n;class l extends a.CustomError{}i.ExpectedError=l;var s={AssertionError:void 0};const u=n;class f extends u.CustomError{}s.AssertionError=f;var c={};c.normalize=void 0,c.normalize=function(e){var t;return{name:e.name,message:e.message,stack:null!==(t=e.stack)&&void 0!==t?t:null}};var d={refute:void 0};const y=i;d.refute=function(e,t){if(e)throw new y.ExpectedError(t)};var v={assert:void 0};const p=s; | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ExtraGenerator={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r={CustomError:void 0};class o extends Error{get name(){return this.constructor.name}}r.CustomError=o;var i={ExpectedError:void 0};const a=r;class l extends a.CustomError{}i.ExpectedError=l;var s={AssertionError:void 0};const u=r;class f extends u.CustomError{}s.AssertionError=f;var c={};c.normalize=void 0,c.normalize=function(e){var t;return{name:e.name,message:e.message,stack:null!==(t=e.stack)&&void 0!==t?t:null}};var d={refute:void 0};const y=i;d.refute=function(e,t){if(e)throw new y.ExpectedError(t)};var v={assert:void 0};const p=s; | ||
/*! ***************************************************************************** | ||
@@ -16,3 +16,3 @@ Copyright (c) Microsoft Corporation. | ||
***************************************************************************** */ | ||
function m(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function b(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}v.assert=function(e,t){if(!e)throw new p.AssertionError(t)},function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=t&&t.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};o(n,e),o(i,e),o(s,e),o(c,e),o(d,e),o(v,e)}(r);var h={},g={},w=1/0,S=17976931348623157e292,x=NaN,O="[object Symbol]",E=/^\s+|\s+$/g,N=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,I=/^0o[0-7]+$/i,_=parseInt,J=Object.prototype.toString;function T(e,t){var r;if("function"!=typeof t)throw new TypeError("Expected a function");return e=function(e){var t=function(e){if(!e)return 0===e?e:0;if((e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&J.call(e)==O}(e))return x;if(z(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=z(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(E,"");var r=j.test(e);return r||I.test(e)?_(e.slice(2),r?2:8):N.test(e)?x:+e}(e))===w||e===-1/0){return(e<0?-1:1)*S}return e==e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}}function z(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var P=function(e){return T(2,e)},$=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};g.lazy=void 0;const A=$(P);g.lazy=function(e){return(0,A.default)(e)};var C={lazyFunction:void 0};const k=g;var M,D;C.lazyFunction=function(e){const t=(0,k.lazy)(e);return(...e)=>t()(...e)},function(e){var r=t&&t.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=t&&t.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};n(g,e),n(C,e)}(h);class B{constructor(e){M.set(this,void 0),this.getIterator=h.lazy((()=>e[Symbol.iterator]()))}get done(){return m(this,M,"f")}close(){var e,t;this.done||(b(this,M,!0,"f"),null===(t=(e=this.getIterator()).return)||void 0===t||t.call(e))}[(M=new WeakMap,Symbol.iterator)](){return{next:()=>{if(m(this,M,"f"))return{done:!0,value:void 0};const{value:e,done:t}=this.getIterator().next();return t&&b(this,M,!0,"f"),{value:e,done:t}}}}}class F{constructor(e){D.set(this,void 0),this.getIterator=h.lazy((()=>e[Symbol.asyncIterator]()))}get done(){return m(this,D,"f")}async close(){var e,t;this.done||(b(this,D,!0,"f"),await(null===(t=(e=this.getIterator()).return)||void 0===t?void 0:t.call(e)))}[(D=new WeakMap,Symbol.asyncIterator)](){return{next:async()=>{if(m(this,D,"f"))return{done:!0,value:void 0};const{value:e,done:t}=await this.getIterator().next();return t&&b(this,D,!0,"f"),{value:e,done:t}}}}}e.ReusableAsyncIterable=F,e.ReusableIterable=B,e.countdown=function*(e,t){if(!(e<t))for(let r=e;r>=t;r--)yield r},e.countup=function*(e,t){if(!(e>t))for(let r=e;r<=t;r++)yield r},e.of=function*(e){yield e},e.range=function(e,t,n=1){return r.assert(n>0,"step parameter must be greater than 0"),function*(e,t,r){if(e<t)for(let n=e;n<t;n+=r)yield n;else for(let n=e;n>t;n-=r)yield n}(e,t,n)},e.repeat=function(e,t=1/0){return r.assert(t===1/0||Number.isInteger(t),"The parameter times must be an integer"),function*(){for(;t-- >0;)yield e}()},e.sse=function*(e){e.event&&(yield`event: ${e.event}\n`);for(const t of e.data.split("\n"))yield`data: ${t}\n`;e.id&&(yield`id: ${e.id}\n`),e.retry&&(yield`retry: ${e.retry}\n`),yield"\n"},e.stringifyJSONStream=function*(e){var t;const r=e[Symbol.iterator]();let n;try{let e;for(({value:e,done:n}=r.next()),yield"[",n||(yield JSON.stringify(e));({value:e,done:n}=r.next()),!n;)yield","+JSON.stringify(e);yield"]"}finally{n||null===(t=r.return)||void 0===t||t.call(r)}},e.stringifyJSONStreamAsync=async function*(e){var t;const r=e[Symbol.asyncIterator]();let n;try{let e;for(({value:e,done:n}=await r.next()),yield"[",n||(yield JSON.stringify(e));({value:e,done:n}=await r.next()),!n;)yield","+JSON.stringify(e);yield"]"}finally{n||await(null===(t=r.return)||void 0===t?void 0:t.call(r))}},e.stringifyNDJSONStream=function*(e){var t;const r=e[Symbol.iterator]();let n;try{let e;for(({value:e,done:n}=r.next()),n||(yield JSON.stringify(e));({value:e,done:n}=r.next()),!n;)yield"\n"+JSON.stringify(e)}finally{n||null===(t=r.return)||void 0===t||t.call(r)}},e.stringifyNDJSONStreamAsync=async function*(e){var t;const r=e[Symbol.asyncIterator]();let n;try{let e;for(({value:e,done:n}=await r.next()),n||(yield JSON.stringify(e));({value:e,done:n}=await r.next()),!n;)yield"\n"+JSON.stringify(e)}finally{n||await(null===(t=r.return)||void 0===t?void 0:t.call(r))}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
function m(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function b(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}v.assert=function(e,t){if(!e)throw new p.AssertionError(t)},function(e){var n=t&&t.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};o(r,e),o(i,e),o(s,e),o(c,e),o(d,e),o(v,e)}(n);var h={},w={},g=1/0,S=17976931348623157e292,x=NaN,O="[object Symbol]",E=/^\s+|\s+$/g,N=/^[-+]0x[0-9a-f]+$/i,I=/^0b[01]+$/i,j=/^0o[0-7]+$/i,_=parseInt,J=Object.prototype.toString;function T(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=function(e){var t=function(e){if(!e)return 0===e?e:0;if((e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&J.call(e)==O}(e))return x;if(z(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=z(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(E,"");var n=I.test(e);return n||j.test(e)?_(e.slice(2),n?2:8):N.test(e)?x:+e}(e))===g||e===-1/0){return(e<0?-1:1)*S}return e==e?e:0}(e),n=t%1;return t==t?n?t-n:t:0}(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}function z(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var P=function(e){return T(2,e)},$=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};w.lazy=void 0;const A=$(P);w.lazy=function(e){return(0,A.default)(e)};var C={lazyFunction:void 0};const D=w;var k,M;C.lazyFunction=function(e){const t=(0,D.lazy)(e);return(...e)=>t()(...e)},function(e){var n=t&&t.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};r(w,e),r(C,e)}(h);class B{constructor(e){k.set(this,void 0),this.getIterator=h.lazy((()=>e[Symbol.iterator]()))}get done(){return m(this,k,"f")}close(){var e,t;this.done||(b(this,k,!0,"f"),null===(t=(e=this.getIterator()).return)||void 0===t||t.call(e))}[(k=new WeakMap,Symbol.iterator)](){return{next:()=>{if(m(this,k,"f"))return{done:!0,value:void 0};const{value:e,done:t}=this.getIterator().next();return t&&b(this,k,!0,"f"),{value:e,done:t}}}}}class F{constructor(e){M.set(this,void 0),this.getIterator=h.lazy((()=>e[Symbol.asyncIterator]()))}get done(){return m(this,M,"f")}async close(){var e,t;this.done||(b(this,M,!0,"f"),await(null===(t=(e=this.getIterator()).return)||void 0===t?void 0:t.call(e)))}[(M=new WeakMap,Symbol.asyncIterator)](){return{next:async()=>{if(m(this,M,"f"))return{done:!0,value:void 0};const{value:e,done:t}=await this.getIterator().next();return t&&b(this,M,!0,"f"),{value:e,done:t}}}}}e.ReusableAsyncIterable=F,e.ReusableIterable=B,e.countdown=function*(e,t){if(!(e<t))for(let n=e;n>=t;n--)yield n},e.countup=function*(e,t){if(!(e>t))for(let n=e;n<=t;n++)yield n},e.of=function*(e){yield e},e.range=function(e,t,r=1){return n.assert(r>0,"step parameter must be greater than 0"),function*(e,t,n){if(e<t)for(let r=e;r<t;r+=n)yield r;else for(let r=e;r>t;r-=n)yield r}(e,t,r)},e.repeat=function(e,t=1/0){return n.assert(t===1/0||Number.isInteger(t),"The parameter times must be an integer"),function*(){for(;t-- >0;)yield e}()},e.sse=function*(e){e.event&&(yield`event: ${e.event}\n`);for(const t of e.data.split("\n"))yield`data: ${t}\n`;e.id&&(yield`id: ${e.id}\n`),e.retry&&(yield`retry: ${e.retry}\n`),yield"\n"},e.stringifyJSONStream=function*(e){var t;const n=e[Symbol.iterator]();let r;try{let e;for(({value:e,done:r}=n.next()),yield"[",r||(yield JSON.stringify(e));({value:e,done:r}=n.next()),!r;)yield","+JSON.stringify(e);yield"]"}finally{r||null===(t=n.return)||void 0===t||t.call(n)}},e.stringifyJSONStreamAsync=async function*(e){var t;const n=e[Symbol.asyncIterator]();let r;try{let e;for(({value:e,done:r}=await n.next()),yield"[",r||(yield JSON.stringify(e));({value:e,done:r}=await n.next()),!r;)yield","+JSON.stringify(e);yield"]"}finally{r||await(null===(t=n.return)||void 0===t?void 0:t.call(n))}},e.stringifyNDJSONStream=function*(e){var t;const n=e[Symbol.iterator]();let r;try{let e;for(({value:e,done:r}=n.next()),r||(yield JSON.stringify(e));({value:e,done:r}=n.next()),!r;)yield"\n"+JSON.stringify(e)}finally{r||null===(t=n.return)||void 0===t||t.call(n)}},e.stringifyNDJSONStreamAsync=async function*(e){var t;const n=e[Symbol.asyncIterator]();let r;try{let e;for(({value:e,done:r}=await n.next()),r||(yield JSON.stringify(e));({value:e,done:r}=await n.next()),!r;)yield"\n"+JSON.stringify(e)}finally{r||await(null===(t=n.return)||void 0===t?void 0:t.call(n))}},e.timestampBasedId=function*(){const e=Date.now();yield[e,0];let t=e,n=0;for(;;){const e=Date.now();e===t?yield[t,++n]:(n=0,t=e,yield[t,n])}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.umd.min.js.map |
@@ -13,1 +13,2 @@ export * from './of'; | ||
export * from './reusable-async-iterable'; | ||
export * from './timestamp-based-id'; |
@@ -25,2 +25,3 @@ "use strict"; | ||
__exportStar(require("./reusable-async-iterable"), exports); | ||
__exportStar(require("./timestamp-based-id"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -13,1 +13,2 @@ export * from './of'; | ||
export * from './reusable-async-iterable'; | ||
export * from './timestamp-based-id'; |
@@ -25,2 +25,3 @@ "use strict"; | ||
__exportStar(require("./reusable-async-iterable"), exports); | ||
__exportStar(require("./timestamp-based-id"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "extra-generator", | ||
"version": "0.2.12", | ||
"version": "0.2.13", | ||
"description": "", | ||
@@ -50,25 +50,25 @@ "keywords": [ | ||
"@blackglory/wait-for": "^0.3.4", | ||
"@commitlint/cli": "^13.2.1", | ||
"@commitlint/config-conventional": "^13.2.0", | ||
"@rollup/plugin-commonjs": "^21.0.0", | ||
"@commitlint/cli": "^15.0.0", | ||
"@commitlint/config-conventional": "^15.0.0", | ||
"@rollup/plugin-commonjs": "^21.0.1", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^13.0.5", | ||
"@rollup/plugin-node-resolve": "^13.0.6", | ||
"@rollup/plugin-replace": "^3.0.0", | ||
"@rollup/plugin-typescript": "^8.2.5", | ||
"@rollup/plugin-typescript": "^8.3.0", | ||
"@types/jest": "^27.0.2", | ||
"@types/node": "14", | ||
"@typescript-eslint/eslint-plugin": "^5.0.0", | ||
"@typescript-eslint/parser": "^5.0.0", | ||
"eslint": "^8.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.4.0", | ||
"@typescript-eslint/parser": "^5.4.0", | ||
"eslint": "^8.2.0", | ||
"husky": "^4.3.8", | ||
"iterable-operator": "^0.14.4", | ||
"jest": "^27.2.5", | ||
"jest": "^27.3.1", | ||
"npm-run-all": "^4.1.5", | ||
"return-style": "^0.12.4", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.58.0", | ||
"rollup": "^2.60.0", | ||
"rollup-plugin-analyzer": "^4.0.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"standard-version": "^9.3.1", | ||
"ts-jest": "^27.0.5", | ||
"standard-version": "^9.3.2", | ||
"ts-jest": "^27.0.7", | ||
"tscpaths": "^0.0.9", | ||
@@ -75,0 +75,0 @@ "tslib": "^2.3.1", |
@@ -135,1 +135,7 @@ # extra-generator | ||
``` | ||
### timestampBasedId | ||
```ts | ||
function timestampBasedId(): Iterator<[timestamp: number, num: number]> | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
525825
104
3469
141