UNPKG

@bitty/insist

Version:

Insistently runs a callback and only resolves the promise when its result is truthy.

63 lines 2.5 kB
{ "name": "@bitty/insist", "version": "1.1.0", "description": "Insistently runs a callback and only resolves the promise when its result is truthy.", "cdn": "./dist/insist.umd.min.js", "main": "./dist/insist.js", "unpkg": "./dist/insist.umd.min.js", "types": "./types/insist.d.ts", "module": "./dist/insist.esm.js", "jsdelivr": "./dist/insist.umd.min.js", "umd:main": "./dist/insist.umd.js", "exports": { ".": [ { "import": "./dist/insist.mjs", "require": "./dist/insist.js", "default": "./dist/insist.js" }, "./dist/insist.js" ] }, "files": [ "dist", "types" ], "repository": { "type": "git", "url": "git+https://github.com/VitorLuizC/insist.git" }, "keywords": [ "insist", "retry", "try-again", "async" ], "author": { "url": "https://vitorluizc.github.io/", "name": "Vitor Luiz Cavalcanti", "email": "vitorluizc@outlook.com" }, "license": "MIT", "bugs": { "url": "https://github.com/VitorLuizC/insist/issues" }, "homepage": "https://github.com/VitorLuizC/insist#readme", "devDependencies": { "ava": "^4.0.1", "prettier": "^2.5.1", "rollup": "^2.63.0", "rollup-plugin-terser": "^7.0.2", "typescript": "^4.5.4" }, "scripts": { "lint": "prettier --check \"./src/**/*.ts\"", "lint:fix": "prettier --write \"./src/**/*.ts\"", "test": "pnpm run lint && pnpm run test:transpile && ava", "test:transpile": "tsc -P ./tsconfig.test.json", "build:transpile": "tsc -P ./tsconfig.build.json", "build:bili": "rollup --config ./rollup.config.js", "build": "pnpm run build:transpile && pnpm run build:bili" }, "readme": "# `@bitty/insist`\n\nInsistently runs a callback and only resolves the promise when its result is truthy.\n\n![][image]\n\n## Install\n\nInstall using NPM or Yarn.\n\n```sh\n# Using NPM\nnpm install @bitty/insist --save\n\n# Using Yarn\nyarn add @bitty/insist\n```\n\nThere's also an UMD version on unpkg.\n\n```html\n<script src=\"https://unpkg.com/@bitty/insist\"></script>\n```\n\n## Usage\n\n```js\nimport insist from '@bitty/insist'\n\ninsist(() => window.readyState === 'complete')\n .then(() => {\n // It's only resolved when window.readyState is 'complete'.\n })\n```\n\n## License\n\nReleased under MIT license. You can see it [here][license].\n\n<!-- Links -->\n\n[license]: ./LICENSE\n[image]: https://i.pinimg.com/originals/fb/91/44/fb9144fc1389ba226b99ef2d96838f1c.gif\n" }