StackedMemory class
Stack implements of MemoryInterface. Memory variables have a hierarchical relationship.
- Extends
-
Array<MemoryInterface>
Properties
Array |
Inherited Properties
length | Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. |
Methods
get |
Gets the value from a given path. |
set |
Sets value to a given path. |
version() | Gets the version of the current StackedMemory. |
wrap(Memory |
Wraps an object that implements MemoryInterface into a StackedMemory object. |
Inherited Methods
concat(Concat |
Combines two or more arrays. |
concat(T | Concat |
Combines two or more arrays. |
every((value: Memory |
Determines whether all the members of an array satisfy the specified test. |
filter((value: Memory |
Returns the elements of an array that meet the condition specified in a callback function. |
filter<S>((value: Memory |
Returns the elements of an array that meet the condition specified in a callback function. |
for |
Performs the specified action for each element in an array. |
index |
Returns the index of the first occurrence of a value in an array. |
join(string) | Adds all the elements of an array separated by the specified separator string. |
last |
Returns the index of the last occurrence of a specified value in an array. |
map<U>((value: Memory |
Calls a defined callback function on each element of an array, and returns an array that contains the results. |
pop() | Removes the last element from an array and returns it. |
push(Memory |
Appends new elements to an array, and returns the new length of the array. |
reduce((previous |
Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
reduce((previous |
|
reduce<U>((previous |
Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
reduce |
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
reduce |
|
reduce |
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
reverse() | Reverses the elements in an Array. |
shift() | Removes the first element from an array and returns it. |
slice(number, number) | Returns a section of an array. |
some((value: Memory |
Determines whether the specified callback function returns true for any element of an array. |
sort((a: Memory |
Sorts an array. |
splice(number, number) | Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. |
splice(number, number, Memory |
Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. |
to |
Returns a string representation of an array. The elements are converted to string using their toLocalString methods. |
to |
Returns a string representation of an array. |
unshift(Memory |
Inserts new elements at the start of an array. |
Property Details
Array
static Array: ArrayConstructor
Property Value
ArrayConstructor
Inherited Property Details
length
Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.
length: number
Property Value
number
Inherited From Array.length
Method Details
getValue(string)
Gets the value from a given path.
function getValue(path: string): any
Parameters
- path
-
string
Given path.
Returns
any
The value from the given path if found, otherwise, undefined.
setValue(string, any)
Sets value to a given path.
function setValue(_path: string, _value: any)
Parameters
- _path
-
string
Memory path.
- _value
-
any
Value to set.
version()
Gets the version of the current StackedMemory.
function version(): string
Returns
string
A string value representing the version.
wrap(MemoryInterface)
Wraps an object that implements MemoryInterface into a StackedMemory object.
static function wrap(memory: MemoryInterface): StackedMemory
Parameters
- memory
- MemoryInterface
An object that implements MemoryInterface.
Returns
A StackedMemory object.
Inherited Method Details
concat(ConcatArray<MemoryInterface>[])
Combines two or more arrays.
function concat(items: ConcatArray<MemoryInterface>[]): MemoryInterface[]
Parameters
- items
-
ConcatArray<MemoryInterface>[]
Additional items to add to the end of array1.
Returns
Inherited From Array.concat
concat(T | ConcatArray<T>[])
Combines two or more arrays.
function concat(items: T | ConcatArray<T>[]): MemoryInterface[]
Parameters
- items
-
T | ConcatArray<T>[]
Additional items to add to the end of array1.
Returns
Inherited From Array.concat
every((value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, any)
Determines whether all the members of an array satisfy the specified test.
function every(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, thisArg?: any): boolean
Parameters
- callbackfn
-
(value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown
A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
- thisArg
-
any
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Returns
boolean
Inherited From Array.every
filter((value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, any)
Returns the elements of an array that meet the condition specified in a callback function.
function filter(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, thisArg?: any): MemoryInterface[]
Parameters
- callbackfn
-
(value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown
A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
- thisArg
-
any
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Returns
Inherited From Array.filter
filter<S>((value: MemoryInterface, index: number, array: MemoryInterface[]) => boolean, any)
Returns the elements of an array that meet the condition specified in a callback function.
function filter<S>(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => boolean, thisArg?: any): S[]
Parameters
- callbackfn
-
(value: MemoryInterface, index: number, array: MemoryInterface[]) => boolean
A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
- thisArg
-
any
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Returns
S[]
Inherited From Array.filter
forEach((value: MemoryInterface, index: number, array: MemoryInterface[]) => void, any)
Performs the specified action for each element in an array.
function forEach(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => void, thisArg?: any)
Parameters
- callbackfn
-
(value: MemoryInterface, index: number, array: MemoryInterface[]) => void
A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
- thisArg
-
any
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Inherited From Array.forEach
indexOf(MemoryInterface, number)
Returns the index of the first occurrence of a value in an array.
function indexOf(searchElement: MemoryInterface, fromIndex?: number): number
Parameters
- searchElement
- MemoryInterface
The value to locate in the array.
- fromIndex
-
number
The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
Returns
number
Inherited From Array.indexOf
join(string)
Adds all the elements of an array separated by the specified separator string.
function join(separator?: string): string
Parameters
- separator
-
string
A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
Returns
string
Inherited From Array.join
lastIndexOf(MemoryInterface, number)
Returns the index of the last occurrence of a specified value in an array.
function lastIndexOf(searchElement: MemoryInterface, fromIndex?: number): number
Parameters
- searchElement
- MemoryInterface
The value to locate in the array.
- fromIndex
-
number
The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
Returns
number
Inherited From Array.lastIndexOf
map<U>((value: MemoryInterface, index: number, array: MemoryInterface[]) => U, any)
Calls a defined callback function on each element of an array, and returns an array that contains the results.
function map<U>(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => U, thisArg?: any): U[]
Parameters
- callbackfn
-
(value: MemoryInterface, index: number, array: MemoryInterface[]) => U
A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
- thisArg
-
any
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Returns
U[]
Inherited From Array.map
pop()
Removes the last element from an array and returns it.
function pop(): MemoryInterface | undefined
Returns
MemoryInterface | undefined
Inherited From Array.pop
push(MemoryInterface[])
Appends new elements to an array, and returns the new length of the array.
function push(items: MemoryInterface[]): number
Parameters
- items
New elements of the Array.
Returns
number
Inherited From Array.push
reduce((previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface)
Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
function reduce(callbackfn: (previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface): MemoryInterface
Parameters
- callbackfn
-
(previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface
A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
Returns
Inherited From Array.reduce
reduce((previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface, MemoryInterface)
function reduce(callbackfn: (previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface, initialValue: MemoryInterface): MemoryInterface
Parameters
- callbackfn
-
(previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface
- initialValue
- MemoryInterface
Returns
Inherited From Array.reduce
reduce<U>((previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U, U)
Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
function reduce<U>(callbackfn: (previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U, initialValue: U): U
Parameters
- callbackfn
-
(previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U
A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
- initialValue
-
U
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
Returns
U
Inherited From Array.reduce
reduceRight((previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface)
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
function reduceRight(callbackfn: (previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface): MemoryInterface
Parameters
- callbackfn
-
(previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface
A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
Returns
Inherited From Array.reduceRight
reduceRight((previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface, MemoryInterface)
function reduceRight(callbackfn: (previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface, initialValue: MemoryInterface): MemoryInterface
Parameters
- callbackfn
-
(previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface
- initialValue
- MemoryInterface
Returns
Inherited From Array.reduceRight
reduceRight<U>((previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U, U)
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
function reduceRight<U>(callbackfn: (previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U, initialValue: U): U
Parameters
- callbackfn
-
(previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U
A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
- initialValue
-
U
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
Returns
U
Inherited From Array.reduceRight
reverse()
Reverses the elements in an Array.
function reverse(): MemoryInterface[]
Returns
Inherited From Array.reverse
shift()
Removes the first element from an array and returns it.
function shift(): MemoryInterface | undefined
Returns
MemoryInterface | undefined
Inherited From Array.shift
slice(number, number)
Returns a section of an array.
function slice(start?: number, end?: number): MemoryInterface[]
Parameters
- start
-
number
The beginning of the specified portion of the array.
- end
-
number
The end of the specified portion of the array.
Returns
Inherited From Array.slice
some((value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, any)
Determines whether the specified callback function returns true for any element of an array.
function some(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, thisArg?: any): boolean
Parameters
- callbackfn
-
(value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown
A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
- thisArg
-
any
An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Returns
boolean
Inherited From Array.some
sort((a: MemoryInterface, b: MemoryInterface) => number)
Sorts an array.
function sort(compareFn?: (a: MemoryInterface, b: MemoryInterface) => number): this
Parameters
- compareFn
-
(a: MemoryInterface, b: MemoryInterface) => number
The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
Returns
this
Inherited From Array.sort
splice(number, number)
Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
function splice(start: number, deleteCount?: number): MemoryInterface[]
Parameters
- start
-
number
The zero-based location in the array from which to start removing elements.
- deleteCount
-
number
The number of elements to remove.
Returns
Inherited From Array.splice
splice(number, number, MemoryInterface[])
Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
function splice(start: number, deleteCount: number, items: MemoryInterface[]): MemoryInterface[]
Parameters
- start
-
number
The zero-based location in the array from which to start removing elements.
- deleteCount
-
number
The number of elements to remove.
- items
Elements to insert into the array in place of the deleted elements.
Returns
Inherited From Array.splice
toLocaleString()
Returns a string representation of an array. The elements are converted to string using their toLocalString methods.
function toLocaleString(): string
Returns
string
Inherited From Array.toLocaleString
toString()
Returns a string representation of an array.
function toString(): string
Returns
string
Inherited From Array.toString
unshift(MemoryInterface[])
Inserts new elements at the start of an array.
function unshift(items: MemoryInterface[]): number
Parameters
- items
Elements to insert at the start of the Array.
Returns
number
Inherited From Array.unshift