common-utils-pkg v4.1.5
Common Utilities Package
A package of commonly used JavaScript utilities.
Package Details
Repo Details
:tada: v4
is here
v4 is just migrating the code base to TypeScript. Kindly refer to the changelog for more info.
v3
is here
Version 3 introduces a code-breaking change. Each method is exported independently instead of having them under a "category utility". Read more on how to use it here.
Installation
NPM
npm i --save common-utils-pkg
Yarn
yarn add common-utils-pkg
Usage
ES6
// Specific methods
import { randomPastelColor } from 'common-utils-pkg';
randomPastelColor();
// All methods
import * as UTILS from 'common-utils-pkg';
UTILS.randomPastelColor();
Browser
<script src="https://unpkg.com/common-utils-pkg"></script>
<script>
// Specific methods
const randomPastelColor = window['common-utils-pkg].randomPastelColor;
randomPastelColor();
</script>
<script>
// All methods
const UTILS = window['common-utils-pkg'];
UTILS.randomPastelColor();
</script>
Read more about the usage here
Available Methods
Read more about the methods available here
Features
- Transpile ES6 to ES5 using Babel
- Coverage using Istanbul with nyc and report by Codecov
- Create the bundle using webpack
- Run tests using Mocha and chai
- Lint stuff using ESLint
- Build status by Travis
- Precommit using lint-staged and husky
- Provides TypeScript type definitions
Contributing
1.Create a folder under src/
and name the folder with the same name as the method.
2.Create methodName.js
and methodName.spec.js
The full directory should look like this:
src/
methodName/
- methodName.js
- methodName.spec.js
3.If the method you are authoring has expected parameters then import expects
import expects from '../expects/expects';
Wrap your exported function with expects
export default expects(
methodName,
'methodName',
{ // required parameters
0: 'string', // 1st parameter is required and is a string
1: 'number', // 2nd parameter is required and is a number
},
{ // optional parameters
2: 'number' // 3rd parameter is optional but is a number
}
)
Publishing
Publish to NPM
To publish version, just create a relase tag and a github workflow will automatically handle the publishing to npm.
Publish doc updates
Doc updates should be automatically be deployed once merged to main by github action.
11 months ago
11 months ago
1 year ago
1 year ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago