UNPKG

@bitty/maybe

Version:
73 lines 3.06 kB
{ "name": "@bitty/maybe", "version": "0.2.0", "description": "Maybe ", "cdn": "./dist/Maybe.umd.min.js", "main": "./dist/Maybe.js", "types": "./types/main.d.ts", "unpkg": "./dist/Maybe.umd.min.js", "module": "./dist/Maybe.esm.js", "jsdelivr": "./dist/Maybe.umd.min.js", "umd:main": "./dist/Maybe.umd.js", "exports": { ".": [ { "import": "./dist/Maybe.mjs", "require": "./dist/Maybe.js", "default": "./dist/Maybe.js" }, "./dist/Maybe.js" ] }, "files": [ "dist/", "types/" ], "repository": { "type": "git", "url": "git+https://github.com/VitorLuizC/maybe.git" }, "keywords": [ "maybe", "maybe-type", "maybe-monad", "optional", "optional-type", "optional-typing", "functional-programming", "functional", "fp", "type-safety", "type-safe", "typescript", "bili", "ava" ], "author": { "url": "https://vitorluizc.github.io/", "name": "Vitor Luiz Cavalcanti", "email": "vitorluizc@outlook.com" }, "license": "MIT", "bugs": { "url": "https://github.com/VitorLuizC/maybe/issues" }, "homepage": "https://github.com/VitorLuizC/maybe#readme", "devDependencies": { "@rollup/plugin-node-resolve": "^13.1.3", "rollup": "^2.63.0", "rollup-plugin-terser": "^7.0.2", "typescript": "^4.5.4" }, "dependencies": { "@bitty/falsy": "0.2.0", "@bitty/nullish": "0.2.0", "@bitty/predicate": "0.2.0" }, "scripts": { "build": "pnpm run build:transpile && pnpm run build:bundle", "build:transpile": "tsc --project ./tsconfig.build.json", "build:bundle": "rollup --config rollup.config.js" }, "readme": "# `@bitty/maybe`\n\n[![Library minified size](https://badgen.net/bundlephobia/min/@bitty/maybe)](https://bundlephobia.com/result?p=@bitty/maybe)\n[![Library minified + gzipped size](https://badgen.net/bundlephobia/minzip/@bitty/maybe)](https://bundlephobia.com/result?p=@bitty/maybe)\n\n## Installation\n\nThis library is published in the NPM registry and can be installed using any compatible package manager.\n\n```sh\nnpm install @bitty/maybe --save\n\n# For Yarn, use the command below.\nyarn add @bitty/maybe\n```\n\n### Installation from CDN\n\nThis module has a UMD bundle available through JSDelivr and Unpkg CDNs.\n\n```html\n<!-- For UNPKG use the code below. -->\n<script src=\"https://unpkg.com/@bitty/maybe\"></script>\n\n<!-- For JSDelivr use the code below. -->\n<script src=\"https://cdn.jsdelivr.net/npm/@bitty/maybe\"></script>\n\n<script>\n // UMD module is exposed through the \"Maybe\" global object.\n Maybe.fromFalsy(document.querySelector('input#id'))\n .chain((el) => Maybe.fromFalsy(el.value?.trim()))\n .map(console.log);\n</script>\n```\n\n## Examples\n\n- [`getLanguage`](./examples/getLanguage/getLanguage.ts) is a function that resolves language in application. Its a pretty common case and it was implemented in the way I think we should use `Maybe`.\n\n## License\n\nReleased under [MIT License](./LICENSE).\n" }