Methods
-
get()
-
Never allow
getin a setter -
get(path, unsafe) → {function}
-
Safely get a value from a path (as an array or a dot-delimited string).
Parameters:
Name Type Description pathstring | Array Array or dot-delimited string describing a path to follow in an object
unsafeboolean If true, fails if element at path doesn't exist
Returns:
- Type
- function
-
get(i, j) → {function}
-
Get the slice of an array from
itoj.Parameters:
Name Type Description iint The start of the slice
jint The end of the slice
Returns:
- Type
- function
-
get(index, unsafe) → {function}
-
Get the element at a specific index of an array
Parameters:
Name Type Description indexint The index to get
unsafeboolean If true, throw an error if index is invalid
Returns:
The get function required to construct a Lens
- Type
- function
-
IdLens()
-
The simplest possible
Lens: operates on a single object;getreturns the object andmapapplies a function to it and returns the result. -
map()
-
Never allow
mapin a getter -
map(i, j) → {function}
-
Map a function over a slice of an array and return the modified array.
Parameters:
Name Type Description iint The start of the slice (may be negative)
jint The end of the slice (may be negative)
Returns:
- Type
- function
-
map(path, unsafe) → {function}
-
Map a function over a value gotten from some path in the object and return a new object.
Parameters:
Name Type Description pathstring | Array Array or dot-delimited string describing a path to follow in an object
unsafeboolean If true, fails if element at path doesn't exist
Returns:
- Type
- function
-
map(index, unsafe) → {function}
-
Map a function over the value at some index in an array. Index must be in the interval
[0, array.length](inclusive); i.e. you may only modify existing elements or add an element to the end.Parameters:
Name Type Description indexint The index to map over
unsafeboolean If true, throw an error if index isn't valid.
Returns:
The map function required to construct a Lens
- Type
- function