@ayonli/jsext
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -32,5 +32,5 @@ 'use strict'; | ||
async function until(test) { | ||
do { | ||
while ((await test()) === false) { | ||
await new Promise(resolve => setTimeout(resolve)); | ||
} while ((await test()) == false); | ||
} | ||
} | ||
@@ -37,0 +37,0 @@ |
@@ -20,2 +20,3 @@ 'use strict'; | ||
if (index.isAsyncGenerator(returns)) { | ||
// @ts-ignore | ||
return (async function* () { | ||
@@ -22,0 +23,0 @@ let input; |
@@ -30,5 +30,5 @@ /** Try to resolve a promise with a timeout limit. */ | ||
async function until(test) { | ||
do { | ||
while ((await test()) === false) { | ||
await new Promise(resolve => setTimeout(resolve)); | ||
} while ((await test()) == false); | ||
} | ||
} | ||
@@ -35,0 +35,0 @@ |
@@ -16,2 +16,3 @@ import { isAsyncGenerator, isGenerator } from './external/check-iterable/index.js'; | ||
if (isAsyncGenerator(returns)) { | ||
// @ts-ignore | ||
return (async function* () { | ||
@@ -18,0 +19,0 @@ let input; |
{ | ||
"name": "@ayonli/jsext", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "Additional functions for JavaScript programming in practice.", | ||
"exports": { | ||
".": { | ||
"types": "./types/index.d.ts", | ||
"bun": "./index.ts", | ||
@@ -13,2 +14,3 @@ "require": "./cjs/index.js", | ||
"./augment": { | ||
"types": "./types/augment.d.ts", | ||
"bun": "./augment.ts", | ||
@@ -20,2 +22,3 @@ "require": "./cjs/augment.js", | ||
"./array": { | ||
"types": "./types/array/index.d.ts", | ||
"bun": "./array/index.ts", | ||
@@ -27,2 +30,3 @@ "require": "./cjs/array/index.js", | ||
"./array/augment": { | ||
"types": "./types/array/augment.d.ts", | ||
"bun": "./array/augment.ts", | ||
@@ -34,2 +38,3 @@ "require": "./cjs/array/augment.js", | ||
"./collections": { | ||
"types": "./types/collections/index.d.ts", | ||
"bun": "./collections/index.ts", | ||
@@ -41,2 +46,3 @@ "require": "./cjs/collections/index.js", | ||
"./collections/augment": { | ||
"types": "./types/collections/augment.d.ts", | ||
"bun": "./collections/augment.ts", | ||
@@ -48,2 +54,3 @@ "require": "./cjs/collections/augment.js", | ||
"./collections/BiMap": { | ||
"types": "./types/collections/BiMap.d.ts", | ||
"bun": "./collections/BiMap.ts", | ||
@@ -55,2 +62,3 @@ "require": "./cjs/collections/BiMap.js", | ||
"./collections/CiMap": { | ||
"types": "./types/collections/CiMap.d.ts", | ||
"bun": "./collections/CiMap.ts", | ||
@@ -62,2 +70,3 @@ "require": "./cjs/collections/CiMap.js", | ||
"./error": { | ||
"types": "./types/error/index.d.ts", | ||
"bun": "./error/index.ts", | ||
@@ -69,2 +78,3 @@ "require": "./cjs/error/index.js", | ||
"./error/augment": { | ||
"types": "./types/error/augment.d.ts", | ||
"bun": "./error/augment.ts", | ||
@@ -76,2 +86,3 @@ "require": "./cjs/error/augment.js", | ||
"./error/Exception": { | ||
"types": "./types/error/Exception.d.ts", | ||
"bun": "./error/Exception.ts", | ||
@@ -83,2 +94,3 @@ "require": "./cjs/error/Exception.js", | ||
"./math": { | ||
"types": "./types/math/index.d.ts", | ||
"bun": "./math/index.ts", | ||
@@ -90,2 +102,3 @@ "require": "./cjs/math/index.js", | ||
"./math/augment": { | ||
"types": "./types/math/augment.d.ts", | ||
"bun": "./math/augment.ts", | ||
@@ -97,2 +110,3 @@ "require": "./cjs/math/augment.js", | ||
"./number": { | ||
"types": "./types/number/index.d.ts", | ||
"bun": "./number/index.ts", | ||
@@ -104,2 +118,3 @@ "require": "./cjs/number/index.js", | ||
"./number/augment": { | ||
"types": "./types/number/augment.d.ts", | ||
"bun": "./number/augment.ts", | ||
@@ -111,2 +126,3 @@ "require": "./cjs/number/augment.js", | ||
"./object": { | ||
"types": "./types/object/index.ts", | ||
"bun": "./object/index.ts", | ||
@@ -118,2 +134,3 @@ "require": "./cjs/object/index.js", | ||
"./object/augment": { | ||
"types": "./types/object/augment.d.ts", | ||
"bun": "./object/augment.ts", | ||
@@ -125,2 +142,3 @@ "require": "./cjs/object/augment.js", | ||
"./promise": { | ||
"types": "./types/promise/index.d.ts", | ||
"bun": "./promise/index.ts", | ||
@@ -132,2 +150,3 @@ "require": "./cjs/promise/index.js", | ||
"./promise/augment": { | ||
"types": "./types/promise/augment.d.ts", | ||
"bun": "./promise/augment.ts", | ||
@@ -139,2 +158,3 @@ "require": "./cjs/promise/augment.js", | ||
"./string": { | ||
"types": "./types/string/index.d.ts", | ||
"bun": "./string/index.ts", | ||
@@ -146,2 +166,3 @@ "require": "./cjs/string/index.js", | ||
"./string/augment": { | ||
"types": "./types/string/augment.d.ts", | ||
"bun": "./string/augment.ts", | ||
@@ -153,2 +174,3 @@ "require": "./cjs/string/augment.js", | ||
"./uint8array": { | ||
"types": "./types/uint8array/index.d.ts", | ||
"bun": "./uint8array/index.ts", | ||
@@ -160,2 +182,3 @@ "require": "./cjs/uint8array/index.js", | ||
"./uint8array/augment": { | ||
"types": "./types/uint8array/augment.d.ts", | ||
"bun": "./uint8array/augment.ts", | ||
@@ -177,3 +200,4 @@ "require": "./cjs/uint8array/augment.js", | ||
"build": "npm run build:esm && npm run build:cjs && npm run build:bundle", | ||
"prepublishOnly": "npm run build" | ||
"prepublishOnly": "npm run build && tsc -p types.tsconfig.json", | ||
"postpublish": "rm -rf types" | ||
}, | ||
@@ -180,0 +204,0 @@ "repository": { |
@@ -33,5 +33,5 @@ /** Try to resolve a promise with a timeout limit. */ | ||
export async function until(test: () => boolean | Promise<boolean>): Promise<void> { | ||
do { | ||
while ((await test()) === false) { | ||
await new Promise<void>(resolve => setTimeout(resolve)); | ||
} while ((await test()) == false); | ||
} | ||
} |
@@ -19,2 +19,7 @@ # JsExt | ||
**NOTE** | ||
Configure `tsconfig.json` to set `compilerOptions.module` as `NodeNext` or `ESNext` | ||
instead of `CommonJS`. | ||
## Functions | ||
@@ -21,0 +26,0 @@ |
@@ -150,2 +150,3 @@ // @ts-ignore | ||
if (isAsyncGenerator(returns)) { | ||
// @ts-ignore | ||
return (async function* () { | ||
@@ -152,0 +153,0 @@ let input: unknown; |
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
655091
214
9058
995