common-lib

1.0.1 • Public • Published

CommonLib

A collection of most commonly used functions in modern webapps

Installation

npm install --save common-lib

Usage

var CommonLib = require('common-lib');
CommonLib.functionName();

List of currently available functions

For getting the index of an element from an array.

getElementIndex(element, array);

For converting file size to human readable format.

humanFileSize(bytes,decimals);

For converting one digit to two.

makeTwoDigit(number);

For converting an associative array to index array.

convertToIndexArray(hash_array);

For getting value of a url params.

getURLParameter(param_name);

For getting the first letter of a string.

getFirstLetter(str);

For converting the bitrate to a readble format

formatebitrate(bits);

Contribution.

  • Fork the repo.
  • Add your functions to the index.js file.
  • Create a pull request with a proper note about the function.

Package Sidebar

Install

npm i common-lib

Weekly Downloads

79

Version

1.0.1

License

MIT

Last publish

Collaborators

  • varunraj22