4.1.1 • Published 2 years ago

common-utils-pkg v4.1.1

Weekly downloads
6
License
ISC
Repository
github
Last release
2 years ago

Common Utilities Package

A package of commonly used JavaScript utilities.

Site | Docs

Package Details

npm version node version build coverage downloads

Repo Details

open issues open prs code size contributors

: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

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
  }
)
4.0.8-alpha

2 years ago

4.1.0

2 years ago

4.1.1

2 years ago

4.0.0-alpha

2 years ago

4.0.1-alpha

2 years ago

4.0.7

2 years ago

3.1.1

4 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.1.0

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.9.0

5 years ago

1.8.0

6 years ago

1.7.4

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago