@theopenweb/js-functions
v2.0.1
Published
Set of general/common utility functions that can be used in JavaScript. Uses es6 exports.
Downloads
5
Maintainers
Readme
JS Functions
Introduction
- Set of general functions that can be used in JavaScript(browser).
- Code uses ESM.
- This library SHOULD NOT include any dependencies OTHER THAN devDependencies.
- Code is made to be efficiently tree-shaken.
Installation
npm install @theopenweb/js-functions
Usage
// Example of import and execution.
import { capitalize } from '@theopenweb/js-functions/src/utilities.js'
console.log(capitalize('smith'))
// For the full API, check "Documentation".
Documentation
- Documentation
- Generated documentation is accessible from: /api_docs/modules.md
- To run all documentation scripts, execute:
npm run docs
.
Testing
Some important functions are being tested.
More tests may be added over time.
Tests can be performed in the "tests" folder with npm run test
after npm install
. Tests may include auto-reporting.
Tests may be incomplete. Please run to check the status.
- Test treeshaking:
npm run test-treeshaking
.- Can test treeshaking code is working before build via:
npx http-server ./
and going to http://localhost:8080/test/tests/tree-shaking. - Can specify typeof treeshaking test with:
npm run test-treeshaking [TYPE]
, where [TYPE] is any from here.
- Can test treeshaking code is working before build via:
- Playground:
npx http-server ./
and go to http://localhost:8080/playground
Coverage
npm run test
will automatically show coverage of tests.
An HTML coverage report will be generated in the "coverage" directory.
Linting
npm run eslint
will generate linting reports.
Contributors
- Damien Golding