waitasecond
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -1,1 +0,3 @@ | ||
export declare function forValueDefined<T>(getValue: () => T | undefined, waiter?: () => Promise<void>, limit?: number): Promise<T>; | ||
declare type IAwaitable<T> = T | Promise<T>; | ||
export declare function forValueDefined<T>(getValue: () => IAwaitable<T | undefined | null>, waiter?: () => Promise<void>, limit?: number): Promise<T>; | ||
export {}; |
@@ -60,15 +60,17 @@ "use strict"; | ||
case 1: | ||
if (!(i < limit)) return [3 /*break*/, 4]; | ||
value = getValue(); | ||
if (typeof value !== 'undefined') { | ||
if (!(i < limit)) return [3 /*break*/, 5]; | ||
return [4 /*yield*/, getValue()]; | ||
case 2: | ||
value = _a.sent(); | ||
if (value !== undefined && value !== null) { | ||
return [2 /*return*/, value]; | ||
} | ||
return [4 /*yield*/, waiter()]; | ||
case 2: | ||
case 3: | ||
_a.sent(); | ||
_a.label = 3; | ||
case 3: | ||
_a.label = 4; | ||
case 4: | ||
i++; | ||
return [3 /*break*/, 1]; | ||
case 4: throw new Error("Limit " + limit + " overflowed in waitForDefined."); | ||
case 5: throw new Error("Limit " + limit + " overflowed in waitForDefined."); | ||
} | ||
@@ -75,0 +77,0 @@ }); |
104
package.json
{ | ||
"name": "waitasecond", | ||
"version": "1.5.0", | ||
"description": "Simple tool library for the waiting using Promises.", | ||
"main": "dist/main.js", | ||
"typings": "dist/main.d.ts", | ||
"sideEffects": false, | ||
"files": [ | ||
"dist/**" | ||
], | ||
"directions": { | ||
"functions": "dist/functions" | ||
}, | ||
"scripts": { | ||
"start": "npm run build-watch", | ||
"build": "tsc", | ||
"build-watch": "tsc --watch", | ||
"prettier": "prettier --config .prettierrc --write \"{src,test,.vscode}/**/*.{ts,json}\"", | ||
"pretty-imports": "npx organize-imports-cli tsconfig.json", | ||
"prettier-watch": "onchange \"{src,test,.vscode}/**/*.{ts,json}\" -- prettier --config .prettierrc --write {{changed}}", | ||
"prettier-commit": "git diff --exit-code && npm run pretty-imports && npm run prettier && git add src && git commit --allow-empty -m \"Prettier\"", | ||
"documentation": "typedoc --excludePrivate --hideGenerator --mode file --theme minimal --out docs --name \"Wait second\" ./src", | ||
"documentation-commit": "git diff --exit-code && npm run documentation && git add docs && git commit --allow-empty -m \"Documentation\"", | ||
"test": "jest --config jestconfig.json", | ||
"test-watch": "jest --config jestconfig.json --watchAll", | ||
"lint": "tslint -p tsconfig.json", | ||
"generate-main-exports": "ts-node ./scripts/generate-main-exports/generate-main-exports.ts", | ||
"generate-main-exports-commit": "git diff --exit-code && npm run generate-main-exports && npm run prettier && git add src && git commit --allow-empty -m \"Updating exports\"", | ||
"preversion": "npm test && npm run lint && npm run generate-main-exports-commit && npm run build && npm run prettier-commit && npm run documentation-commit", | ||
"postversion": "git push && git push --tags && npm publish" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://git@github.com:hejny/waitasecond.git" | ||
}, | ||
"author": "Pavol Hejný", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@types/jest": "^24.0.13", | ||
"codecov": "^3.5.0", | ||
"glob-promise": "^3.4.0", | ||
"jest": "^24.8.0", | ||
"onchange": "^3.3.0", | ||
"organize-imports-cli": "^0.8.0", | ||
"prettier": "github:prettier/prettier", | ||
"ts-jest": "^24.0.2", | ||
"ts-node": "^9.0.0", | ||
"tslint": "^5.17.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.5.1" | ||
} | ||
"name": "waitasecond", | ||
"version": "1.6.0", | ||
"description": "Simple tool library for the waiting using Promises.", | ||
"main": "dist/main.js", | ||
"typings": "dist/main.d.ts", | ||
"sideEffects": false, | ||
"files": [ | ||
"dist/**" | ||
], | ||
"directions": { | ||
"functions": "dist/functions" | ||
}, | ||
"scripts": { | ||
"start": "npm run build-watch", | ||
"build": "tsc", | ||
"build-watch": "tsc --watch", | ||
"prettier": "prettier --config .prettierrc --write \"{src,test,.vscode}/**/*.{ts,json}\"", | ||
"pretty-imports": "npx organize-imports-cli tsconfig.json", | ||
"prettier-watch": "onchange \"{src,test,.vscode}/**/*.{ts,json}\" -- prettier --config .prettierrc --write {{changed}}", | ||
"prettier-commit": "git diff --exit-code && npm run pretty-imports && npm run prettier && git add src && git commit --allow-empty -m \"Prettier\"", | ||
"documentation": "typedoc --excludePrivate --hideGenerator --mode file --theme minimal --out docs --name \"Waitasecond\" ./src", | ||
"documentation-commit": "git diff --exit-code && npm run documentation && git add docs && git commit --allow-empty -m \"Documentation\"", | ||
"test": "jest --config jestconfig.json", | ||
"test-watch": "jest --config jestconfig.json --watchAll", | ||
"lint": "tslint -p tsconfig.json", | ||
"generate-main-exports": "ts-node ./scripts/generate-main-exports/generate-main-exports.ts", | ||
"generate-main-exports-commit": "git diff --exit-code && npm run generate-main-exports && npm run prettier && git add src && git commit --allow-empty -m \"Updating exports\"", | ||
"preversion": "npm test && npm run lint && npm run generate-main-exports-commit && npm run build && npm run prettier-commit && npm run documentation-commit", | ||
"postversion": "git push && git push --tags && npm publish" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://git@github.com:hejny/waitasecond.git" | ||
}, | ||
"author": "Pavol Hejný", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@types/jest": "^24.0.13", | ||
"codecov": "^3.5.0", | ||
"glob-promise": "^3.4.0", | ||
"jest": "^24.8.0", | ||
"onchange": "^3.3.0", | ||
"organize-imports-cli": "^0.8.0", | ||
"prettier": "github:prettier/prettier", | ||
"ts-jest": "^24.0.2", | ||
"ts-node": "^9.0.0", | ||
"tslint": "^5.17.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.5.1" | ||
} | ||
} |
@@ -15,6 +15,4 @@ # Wait a second library | ||
```typescript | ||
import { } from 'waitasecond'; | ||
import {} from 'waitasecond'; | ||
@@ -24,3 +22,2 @@ // TODO: | ||
# Contributing | ||
@@ -30,2 +27,8 @@ | ||
Please install theese plugins: | ||
- [Terminals Manager](https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-terminals) | ||
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) | ||
- [ESlint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) | ||
## Publishing a new version | ||
@@ -38,2 +41,3 @@ | ||
``` | ||
on *minor* or *major*. Scripts defined in package.json will test, lint, build, create documentation and push the whole project for you. | ||
on _minor_ or _major_. Scripts defined in package.json will test, lint, build, create documentation and push the whole project for you. |
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
27777
440
40