StackedMemory class

Stack 实现 MemoryInterface。 内存变量具有分层关系。

扩展

属性

Array

继承属性

length

获取或设置数组的长度。 这是比数组中定义的最高元素更高的数字。

方法

getValue(string)

从给定路径获取值。

setValue(string, any)

将值设置为给定路径。

version()

获取当前 StackedMemory的版本。

wrap(MemoryInterface)

将实现 MemoryInterface 的对象包装到 StackedMemory 对象中。

继承的方法

concat(ConcatArray<MemoryInterface>[])

合并两个或多个数组。

concat(T | ConcatArray<T>[])

合并两个或多个数组。

every((value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, any)

确定数组的所有成员是否满足指定的测试。

filter((value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, any)

返回满足回调函数中指定的条件的数组的元素。

filter<S>((value: MemoryInterface, index: number, array: MemoryInterface[]) => boolean, any)

返回满足回调函数中指定的条件的数组的元素。

forEach((value: MemoryInterface, index: number, array: MemoryInterface[]) => void, any)

对数组中的每个元素执行指定的操作。

indexOf(MemoryInterface, number)

返回数组中值的第一个匹配项的索引。

join(string)

添加由指定分隔符字符串分隔的数组的所有元素。

lastIndexOf(MemoryInterface, number)

返回数组中指定值的最后一个匹配项的索引。

map<U>((value: MemoryInterface, index: number, array: MemoryInterface[]) => U, any)

对数组的每个元素调用定义的回调函数,并返回一个包含结果的数组。

pop()

从数组中删除最后一个元素并返回它。

push(MemoryInterface[])

将新元素追加到数组,并返回数组的新长度。

reduce((previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface)

为数组中的所有元素调用指定的回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

reduce((previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface, MemoryInterface)
reduce<U>((previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U, U)

为数组中的所有元素调用指定的回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

reduceRight((previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface)

按降序调用数组中所有元素的指定回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

reduceRight((previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface, MemoryInterface)
reduceRight<U>((previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U, U)

按降序调用数组中所有元素的指定回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

reverse()

反转数组中的元素。

shift()

从数组中删除第一个元素并返回它。

slice(number, number)

返回数组的一部分。

some((value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, any)

确定指定的回调函数是否为数组的任何元素返回 true。

sort((a: MemoryInterface, b: MemoryInterface) => number)

对数组进行排序。

splice(number, number)

从数组中删除元素,并在必要时在其位置插入新元素,并返回已删除的元素。

splice(number, number, MemoryInterface[])

从数组中删除元素,并在必要时在其位置插入新元素,并返回已删除的元素。

toLocaleString()

返回数组的字符串表示形式。 元素使用其 toLocalString 方法转换为字符串。

toString()

返回数组的字符串表示形式。

unshift(MemoryInterface[])

在数组的开头插入新元素。

属性详细信息

Array

static Array: ArrayConstructor

属性值

ArrayConstructor

继承属性详细信息

length

获取或设置数组的长度。 这是比数组中定义的最高元素更高的数字。

length: number

属性值

number

继承自 Array.length

方法详细信息

getValue(string)

从给定路径获取值。

function getValue(path: string): any

参数

path

string

给定路径。

返回

any

如果找到给定路径中的值,则为未定义。

setValue(string, any)

将值设置为给定路径。

function setValue(_path: string, _value: any)

参数

_path

string

内存路径。

_value

any

要设置的值。

version()

获取当前 StackedMemory的版本。

function version(): string

返回

string

一个表示版本的字符串值。

wrap(MemoryInterface)

将实现 MemoryInterface 的对象包装到 StackedMemory 对象中。

static function wrap(memory: MemoryInterface): StackedMemory

参数

memory
MemoryInterface

实现 memoryInterface的对象。

返回

StackedMemory 对象。

继承的方法详细信息

concat(ConcatArray<MemoryInterface>[])

合并两个或多个数组。

function concat(items: ConcatArray<MemoryInterface>[]): MemoryInterface[]

参数

items

ConcatArray<MemoryInterface>[]

要添加到 array1 末尾的其他项。

返回

继承自 Array.concat 的

concat(T | ConcatArray<T>[])

合并两个或多个数组。

function concat(items: T | ConcatArray<T>[]): MemoryInterface[]

参数

items

T | ConcatArray<T>[]

要添加到 array1 末尾的其他项。

返回

继承自 Array.concat 的

every((value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, any)

确定数组的所有成员是否满足指定的测试。

function every(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, thisArg?: any): boolean

参数

callbackfn

(value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown

最多接受三个参数的函数。 每个方法都会调用 array1 中每个元素的 callbackfn 函数,直到 callbackfn 返回 false,或直到数组的末尾。

thisArg

any

此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。

返回

boolean

继承自 Array.every

filter((value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, any)

返回满足回调函数中指定的条件的数组的元素。

function filter(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, thisArg?: any): MemoryInterface[]

参数

callbackfn

(value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown

最多接受三个参数的函数。 筛选器方法为数组中的每个元素一次调用 callbackfn 函数。

thisArg

any

此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。

返回

继承自 Array.filter

filter<S>((value: MemoryInterface, index: number, array: MemoryInterface[]) => boolean, any)

返回满足回调函数中指定的条件的数组的元素。

function filter<S>(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => boolean, thisArg?: any): S[]

参数

callbackfn

(value: MemoryInterface, index: number, array: MemoryInterface[]) => boolean

最多接受三个参数的函数。 筛选器方法为数组中的每个元素一次调用 callbackfn 函数。

thisArg

any

此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。

返回

S[]

继承自 Array.filter

forEach((value: MemoryInterface, index: number, array: MemoryInterface[]) => void, any)

对数组中的每个元素执行指定的操作。

function forEach(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => void, thisArg?: any)

参数

callbackfn

(value: MemoryInterface, index: number, array: MemoryInterface[]) => void

最多接受三个参数的函数。 forEach 为数组中的每个元素调用一次 callbackfn 函数。

thisArg

any

此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。

继承自 Array.forEach

indexOf(MemoryInterface, number)

返回数组中值的第一个匹配项的索引。

function indexOf(searchElement: MemoryInterface, fromIndex?: number): number

参数

searchElement
MemoryInterface

要在数组中查找的值。

fromIndex

number

开始搜索的数组索引。 如果省略 fromIndex,则搜索从索引 0 开始。

返回

number

继承自 Array.indexOf

join(string)

添加由指定分隔符字符串分隔的数组的所有元素。

function join(separator?: string): string

参数

separator

string

一个字符串,用于将数组的一个元素与生成的 String 中的下一个元素分开。 如果省略,则用逗号分隔数组元素。

返回

string

继承自 Array.join

lastIndexOf(MemoryInterface, number)

返回数组中指定值的最后一个匹配项的索引。

function lastIndexOf(searchElement: MemoryInterface, fromIndex?: number): number

参数

searchElement
MemoryInterface

要在数组中查找的值。

fromIndex

number

开始搜索的数组索引。 如果省略 fromIndex,则搜索从数组中的最后一个索引开始。

返回

number

继承自 Array.lastIndexOf

map<U>((value: MemoryInterface, index: number, array: MemoryInterface[]) => U, any)

对数组的每个元素调用定义的回调函数,并返回一个包含结果的数组。

function map<U>(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => U, thisArg?: any): U[]

参数

callbackfn

(value: MemoryInterface, index: number, array: MemoryInterface[]) => U

最多接受三个参数的函数。 map 方法为数组中的每个元素调用一次 callbackfn 函数。

thisArg

any

此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。

返回

U[]

继承自 Array.map

pop()

从数组中删除最后一个元素并返回它。

function pop(): MemoryInterface | undefined

返回

MemoryInterface | undefined

继承自 Array.pop

push(MemoryInterface[])

将新元素追加到数组,并返回数组的新长度。

function push(items: MemoryInterface[]): number

参数

items

MemoryInterface[]

数组的新元素。

返回

number

继承自 Array.push

reduce((previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface)

为数组中的所有元素调用指定的回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

function reduce(callbackfn: (previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface): MemoryInterface

参数

callbackfn

(previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface

最多接受四个参数的函数。 reduce 方法每次调用数组中每个元素的 callbackfn 函数。

返回

继承自 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

参数

callbackfn

(previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface

initialValue
MemoryInterface

返回

继承自 Array.reduce

reduce<U>((previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U, U)

为数组中的所有元素调用指定的回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

function reduce<U>(callbackfn: (previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U, initialValue: U): U

参数

callbackfn

(previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U

最多接受四个参数的函数。 reduce 方法每次调用数组中每个元素的 callbackfn 函数。

initialValue

U

如果指定 initialValue,则将其用作启动累积的初始值。 对 callbackfn 函数的第一次调用将此值作为参数而不是数组值提供。

返回

U

继承自 Array.reduce

reduceRight((previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface)

按降序调用数组中所有元素的指定回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

function reduceRight(callbackfn: (previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface): MemoryInterface

参数

callbackfn

(previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface

最多接受四个参数的函数。 reduceRight 方法为数组中的每个元素调用回调fn 函数一次。

返回

继承自 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

参数

callbackfn

(previousValue: MemoryInterface, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => MemoryInterface

initialValue
MemoryInterface

返回

继承自 Array.reduceRight

reduceRight<U>((previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U, U)

按降序调用数组中所有元素的指定回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。

function reduceRight<U>(callbackfn: (previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U, initialValue: U): U

参数

callbackfn

(previousValue: U, currentValue: MemoryInterface, currentIndex: number, array: MemoryInterface[]) => U

最多接受四个参数的函数。 reduceRight 方法为数组中的每个元素调用回调fn 函数一次。

initialValue

U

如果指定 initialValue,则将其用作启动累积的初始值。 对 callbackfn 函数的第一次调用将此值作为参数而不是数组值提供。

返回

U

继承自 Array.reduceRight

reverse()

反转数组中的元素。

function reverse(): MemoryInterface[]

返回

继承自 Array.reverse

shift()

从数组中删除第一个元素并返回它。

function shift(): MemoryInterface | undefined

返回

MemoryInterface | undefined

继承自 Array.shift

slice(number, number)

返回数组的一部分。

function slice(start?: number, end?: number): MemoryInterface[]

参数

start

number

数组的指定部分的开头。

end

number

数组指定部分的末尾。

返回

继承自 Array.slice

some((value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, any)

确定指定的回调函数是否为数组的任何元素返回 true。

function some(callbackfn: (value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown, thisArg?: any): boolean

参数

callbackfn

(value: MemoryInterface, index: number, array: MemoryInterface[]) => unknown

最多接受三个参数的函数。 某些方法调用 array1 中每个元素的 callbackfn 函数,直到 callbackfn 返回 true,或直到数组的末尾。

thisArg

any

此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。

返回

boolean

继承自 Array.some

sort((a: MemoryInterface, b: MemoryInterface) => number)

对数组进行排序。

function sort(compareFn?: (a: MemoryInterface, b: MemoryInterface) => number): this

参数

compareFn

(a: MemoryInterface, b: MemoryInterface) => number

用于确定元素顺序的函数的名称。 如果省略,则按升序 ASCII 字符顺序对元素进行排序。

返回

this

继承自 Array.sort

splice(number, number)

从数组中删除元素,并在必要时在其位置插入新元素,并返回已删除的元素。

function splice(start: number, deleteCount?: number): MemoryInterface[]

参数

start

number

数组中从零开始删除元素的位置。

deleteCount

number

要移除的元素数。

返回

继承自 Array.splice

splice(number, number, MemoryInterface[])

从数组中删除元素,并在必要时在其位置插入新元素,并返回已删除的元素。

function splice(start: number, deleteCount: number, items: MemoryInterface[]): MemoryInterface[]

参数

start

number

数组中从零开始删除元素的位置。

deleteCount

number

要移除的元素数。

items

MemoryInterface[]

要插入数组中的元素代替已删除的元素。

返回

继承自 Array.splice

toLocaleString()

返回数组的字符串表示形式。 元素使用其 toLocalString 方法转换为字符串。

function toLocaleString(): string

返回

string

继承自 Array.toLocaleString

toString()

返回数组的字符串表示形式。

function toString(): string

返回

string

继承自 Array.toString

unshift(MemoryInterface[])

在数组的开头插入新元素。

function unshift(items: MemoryInterface[]): number

参数

items

MemoryInterface[]

要插入到数组开头的元素。

返回

number

继承自 Array.unshift