npm install preact-util --save
It's easy. Import and use the utilities.
import util from 'preact-util';
const apiServer = props.apiServer || `${window.location.protocol}//${window.location.host}`;
util.setApiServer(apiServer);
- isNumber
- checkNested
- setNestedValue
- asNumber
- asString
- asObject
- asBoolean
- cleanObject
- padDate
- parseInputDate
- isoDate
- getApiServer
- setApiServer
- getImageServer
- setImageServer
- getJwtToken
- setJwtToken
- removeJwtToken
- setUserEmail
- getUserEmail
- removeUserEmail
- setObject
- unsetObj
- getObject
- set
- unset
- get
- fetchApi
- format
- formatCompact
- formatBytes
- getDomain
- getImageHostname
- getImageSrc
- isCapsLock
- validateEmail
- ucfirst
- randomPassword
- toggleDarkModeClasses
I promise to add some more documentation, or if you want to help, please follow the instructions below.
Jest A browser JavaScript testing toolkit. Jest is used by Facebook to test all JavaScript code including React applications. One of Jest's philosophies is to provide an integrated "zero-configuration" experience.
ESLint ESLint is a code style linter for programmatically enforcing your style guide.
Travis Travis CI is a hosted continuous integration service. It is integrated with GitHub and offers first class support for many languages.
Coveralls.io Coveralls is a web service to help you track your code coverage over time, and ensure that all your new code is fully covered.
Retire Scanner detecting the use of JavaScript libraries with known vulnerabilities.
$ git clone git@github.com:5orenso/preact-util.git
$ cd preact-util/
$ npm install
Start developing. Remember to start watching your files:
$ npm run test:watch
$ eslint --fix lib/utilities.js
$ git clone git@github.com:5orenso/preact-util.git
Do your magic and create a pull request.
Use the Issue tracker
$ bash ./changelog.sh
- Bump version inside
package.json
- Push all changes to Github.
- Push all changes to npmjs.com:
$ bash ./npm-release.sh
.
# Install Node Security Platform CLI
$ npm install nsp --global
# From inside your project directory
$ nsp check
$ sudo npm install -g npm-check-updates
$ ncu -u -a
$ npm install --no-optional
For transparency and insight into the release cycle, releases will be numbered with the follow format:
<major>.<minor>.<patch>
And constructed with the following guidelines:
- Breaking backwards compatibility bumps the major
- New additions without breaking backwards compatibility bumps the minor
- Bug fixes and misc changes bump the patch
For more information on semantic versioning, please visit http://semver.org/.
We ❤️ contributions and feedback.
If you want to contribute, please check out the CONTRIBUTING.md file.
If you have any question or suggestion create an issue.
Bug reports should always be done with a new issue.