nodejs-util-lib

0.1.11 • Public • Published

NodeJS Utility Library

Node.js Package CodeQL Test

Available Utility Types:

  • String Utilities
  • Timer Utilities

Usage Example:

const { 
  StringUtils, 
  TimerUtils
} = require('nodejs-util-lib');

String Utility Functions:

contains(value, match, caseSensitive=false) - Checks if a string contains another string.

isEmpty(value, ignoreWhiteSpace=false) - Checks if a value is undefined, null or empty.

prettyPrintJSON(object, spacing=2) - Returns an object as a nice string formatted JSON string.

replaceAll(value, valueToReplace, replaceWith) - Replaces all matched values of a string.

splitAndTrimString(value, delimiter=',') - Splits a string delimited list of strings into an array.

Timer Utility Functions:

formatTime(milliseconds) - Converts a time in milliseconds to a nice formatted string.

getTimeDifferenceString(start, end=Date.now()) - Used to nicely print the time difference between 2 times(milliseconds).

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.11
    0
    • latest

Version History

Package Sidebar

Install

npm i nodejs-util-lib

Weekly Downloads

0

Version

0.1.11

License

ISC

Unpacked Size

7.89 kB

Total Files

7

Last publish

Collaborators

  • uranakam