@eturino/ts-parse-boolean
TypeDoc generated docs in here
Github repo here
Converts to a boolean. Returns false if the value is falsy. If it is truthy it checks it by converting to a string, trimming, upcasing, and checking if the value is not FALSE
or NO
or 0
.
If we pass a value that is not a boolean
, string
, number
, null
or undefined
, it will return false
.
Installation
yarn add @eturino/ts-parse-boolean
or npm install @eturino/ts-parse-boolean
.
Usage
import parseBoolean from "@eturino/ts-parse-boolean";
parseBoolean(true);
parseBoolean(false);
parseBoolean(1);
parseBoolean(0);
parseBoolean(-8);
parseBoolean(" 0 ");
parseBoolean(" tRue ");
parseBoolean(" No ");
parseBoolean(" faLse ");
parseBoolean(" Whatever ");
parseBoolean(["a"]);
parseBoolean({ a: 1 });
Development, Commits, versioning and publishing
See documentation for development
See The Typescript-Starter docs.
Commits and CHANGELOG
For commits, you should use commitizen
yarn global add commitizen
git cz
As typescript-starter docs state:
This project is tooled for conventional changelog to make managing releases easier. See the standard-version documentation for more information on the workflow, or CHANGELOG.md
for an example.
yarn run version
You may find a tool like wip
helpful for managing work in progress before you're ready to create a meaningful commit.
Creating the first version
Once you are ready to create the first version, run the following (note that reset
is destructive and will remove all files not in the git repo from the directory).
yarn run reset && yarn run test && yarn run doc:html
yarn run version -- --first-release
And after that, remember to publish the docs.
And finally push the new tags to github and publish the package to npm.
git push --follow-tags origin master
yarn publish --access public
Publish the Docs
yarn run doc:html && yarn run doc:publish
This will generate the docs and publish them in github pages.
Generate a version
There is a single yarn command for preparing a new release. See One-step publish preparation script in TypeScript-Starter
yarn prepare-release
git push --follow-tags origin master
yarn publish --access public