string

Methods

(static) concat(object, path, …strings) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by former string concatenated with strings.
⚠ Due to name conflicts, this function is named stringConcat when imported from top level (import { stringConcat } from 'immutadot').
Example
concat({ nested: { a: 'Hello' } }, 'nested.a', ' world', ' !') // => { nested: { a: 'Hello world !' } }
Parameters:
Name Type Attributes Description
object Object The object to modify.
path Array | string The path of the property to set.
strings string
repeatable
Strings to concatenate.
Returns:
Returns the updated object.
Type
Object

(static) padEnd(object, path, targetLength, [padString]) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by former string padded at the end with padString to the given length.
Examples
padEnd({ nested: { a: 'Hellow' } }, 10) // => { nested: { a: 'Hellow    ' } }
padEnd({ nested: { a: 'Hellow' } }, 10, '?!') // => { nested: { a: 'Hellow?!?!' } }
Parameters:
Name Type Attributes Default Description
object Object The object to modify.
path Array | string The path of the property to set.
targetLength number The length to pad to.
padString string
optional
' ' String to add.
Returns:
Returns the updated object.
Type
Object

(static) padStart(object, path, targetLength, [padString]) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by former string padded at the start with padString to the given length.
Examples
padStart({ nested: { a: 'Hellow' } }, 10) // => { nested: { a: '    Hellow' } }
padStart({ nested: { a: 'Hellow' } }, 10, '?!') // => { nested: { a: '?!?!Hellow' } }
Parameters:
Name Type Attributes Default Description
object Object The object to modify.
path Array | string The path of the property to set.
targetLength number The length to pad to.
padString string
optional
' ' String to add.
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) slice(object, path, beginIndex, endIndexnullable) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by a slice of former string starting at beginIndex and ending at endIndex or end of the string.
⚠ Due to name conflicts, this function is named stringSlice when imported from top level (import { stringSlice } from 'immutadot').
Examples
slice({ nested: { a: 'Hello World !' } }, 6) // => { nested: { a: 'World !' } }
slice({ nested: { a: 'Hello World !' } }, 6, 11) // => { nested: { a: 'World' } }
Parameters:
Name Type Attributes Description
object Object The object to modify.
path Array | string The path of the property to set.
beginIndex number Beginning index of slice.
endIndex number
nullable
Ending index of slice.
Returns:
Returns the updated object.
Type
Object

(static) substr(object, path, beginIndex, lengthnullable) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by a slice of former string starting at beginIndex.
Examples
substr({ nested: { a: 'Hello World !' } }, 6) // => { nested: { a: 'World !' } }
substr({ nested: { a: 'Hello World !' } }, 6, 5) // => { nested: { a: 'World' } }
Parameters:
Name Type Attributes Description
object Object The object to modify.
path Array | string The path of the property to set.
beginIndex number Beginning index of slice.
length number
nullable
Length of slice.
Returns:
Returns the updated object.
Type
Object

(static) substring(object, path, beginIndex, endIndexnullable) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by a slice of former string starting at beginIndex and ending at endIndex or end of the string.
Examples
substring({ nested: { a: 'Hello World !' } }, 6) // => { nested: { a: 'World !' } }
substring({ nested: { a: 'Hello World !' } }, 6, 11) // => { nested: { a: 'World' } }
Parameters:
Name Type Attributes Description
object Object The object to modify.
path Array | string The path of the property to set.
beginIndex number Beginning index of slice.
endIndex number
nullable
Ending index of slice.
Returns:
Returns the updated object.
Type
Object

(static) toLocaleLowerCase(object, path, localenullable) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by former string in lower case.
Example
toLocaleLowerCase({ nested: { a: 'ÇA vA Bien ?' } }, 'fr_fr') // => { nested: { a: 'ça va bien ?' } }
Parameters:
Name Type Attributes Description
object Object The object to modify.
path Array | string The path of the property to set.
locale string
nullable
Locale.
Returns:
Returns the updated object.
Type
Object

(static) toLocaleUpperCase(object, path, localenullable) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by former string in upper case.
Example
toLocaleUpperCase({ nested: { a: 'çA vA Bien ?' } }, 'fr_fr') // => { nested: { a: 'ÇA VA BIEN ?' } }
Parameters:
Name Type Attributes Description
object Object The object to modify.
path Array | string The path of the property to set.
locale string
nullable
Locale.
Returns:
Returns the updated object.
Type
Object

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

Source:
Since:
  • 1.0.0
See:
Replaces by former string in lower case.
Example
toLowerCase({ nested: { a: 'Hello WORLD !' } }, 'fr_fr') // => { nested: { a: 'hello world !' } }
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) toUpperCase(object, path) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by former string in upper case.
Example
toUpperCase({ nested: { a: 'Hello world !' } }, 'fr_fr') // => { nested: { a: 'HELLO WORLD !' } }
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) trim(object, path) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by former string stripped of whitespaces at start and end.
Example
trim({ nested: { a: '   Hello world !   ' } }) // => { nested: { a: 'Hello world !' } }
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) trimLeft(object, path) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by former string stripped of whitespaces at start.
Example
trimLeft({ nested: { a: '   Hello world !   ' } }) // => { nested: { a: 'Hello world !   ' } }
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) trimRight(object, path) → {Object}

Source:
Since:
  • 1.0.0
See:
Replaces by former string stripped of whitespaces at end.
Example
trimRight({ nested: { a: '   Hello world !   ' } }) // => { nested: { a: '   Hello world !' } }
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