squid-utils
TypeScript icon, indicating that this package has built-in type declarations

3.1.1 • Public • Published

squid-utils

Utility functions:

  • BaseError - error object to hold error code and message.
  • nonNull(object, errorObjectSupplier?)
    Throws NullObjectError if null or undefined. Optionally custom 'errorObjectSupplier' can be passed to be thrown.
  • toNumOrStr(object)
    Given any object, return number if it is, otherwise return toString() value.
  • keys(mapOrObject)
    Given map or an object return keys in an array.
  • values(mapOrObject)
    Given map or an object return values in an array.
  • includesI(collection, searchString)
    Search the string in the collection ignoring case.
  • getOrSetDefault(map, key, defaultValue)
    Get value of key in the map. If not pathExists, then set the default value in the map for the key and then return the default value.
  • getOrCall(map, key, callbackFn)
    Get map value for the key. If not pathExists then call the function. and return its value if any.

Readme

Keywords

Package Sidebar

Install

npm i squid-utils

Weekly Downloads

2

Version

3.1.1

License

MIT

Unpacked Size

49.3 kB

Total Files

29

Last publish

Collaborators

  • rajeevn