@kernel-js/support

Build Status Coverage Status

Util functions and classes

  • Expose some Lodash functions

  • Exports additional helpers

Install

npm install @kernel-js/support

Lodash

  • camelCase

  • capitalize

  • find

  • floor

  • get

  • has

  • hasIn

  • head

  • keysIn

  • last

  • set

  • snakeCase

  • startCase

  • map

  • mapValues

  • omitBy

  • unset

Helpers

  • env

  • isArray

  • isObject

  • isEmpty

  • isNotEmpty

  • toBoolean

  • removeEmpty

  • mapEmptyToNull

env

Gets the value of an environment variable.

Arguments

  • key - the path to the property you want. You can use dot notation on nested objects

  • defaultValue - the optional default value when the key was not found

isArray

Return a boolean if the informed value is of Array type.

Arguments

  • value - any value

isObject

Return a boolean if the informed value is of Object type.

Arguments

  • value - any value

isEmpty

Check if the informed value is empty. This is a little different of lodash behaviour, booleans are not considered empty and ' ' for example is considered empty.

Arguments

  • value - any value

isNotEmpty

Just the oposite of isEmpty.

Arguments

  • value - any value

toBoolean

Converts a give string or number into boolean or return null when cannot convert it.

Arguments

  • value - any value

removeEmpty

Removes any empty property from object using isEmpty helper.

Arguments

  • value - any object

mapEmptyToNull

Converts any empty property of object to null using isEmpty helper.

Arguments

  • value - any object

Last updated

Was this helpful?