string

Methods

(static) capitalize(object, path) → {Object}

Source:
Since:
  • 0.3.0
See:
Converts the first character of string to upper case and the remaining to lower case.
Example
capitalize({ nested: { a: "a string" } }, 'nested.a') // => { nested: { a: "A string" } }
Parameters:
Name Type Description
object Object The object to modify.
path Array | string The path of the property to set.
Returns:
Returns the updated object.
Type
Object

(static) replace(object, path, pattern, replacement) → {Object}

Source:
Since:
  • 0.3.0
See:
Replaces matches for pattern in string with replacement.
Example
replace({ nested: { a: "Hi Nico" } }, 'nested.a', 'Nico', 'Yvo') // => { nested: { a: "Hi Yvo" } }
Parameters:
Name Type Description
object Object The object to modify.
path Array | string The path of the property to set.
pattern RegExp | string The pattern to replace.
replacement function | string The match replacement.
Returns:
Returns the updated object.
Type
Object

(static) toLower(object, path) → {Object}

Source:
Since:
  • 0.3.0
See:
Converts string, as a whole, to lower case just like String#toLowerCase.
Example
toLower({ nested: { a: "A STRING" } }, 'nested.a') // => { nested: { a: "a string" } }
Parameters:
Name Type Description
object Object The object to modify.
path Array | string The path of the property to set.
Returns:
Returns the updated object.
Type
Object

(static) toUpper(object, path) → {Object}

Source:
Since:
  • 0.3.0
See:
Converts string, as a whole, to upper case just like String#toUpperCase.
Example
toUpper({ nested: { a: "a string" } }, 'nested.a') // => { nested: { a: "A STRING" } }
Parameters:
Name Type Description
object Object The object to modify.
path Array | string The path of the property to set.
Returns:
Returns the updated object.
Type
Object