StackedMemory class

Stack 實作 MemoryInterface。 記憶體變數具有階層式關聯性。

Extends

屬性

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()

反轉Array中的專案。

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,則會使用 undefined 作為此值。

傳回

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,則會使用 undefined 作為此值。

傳回

繼承自 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,則會使用 undefined 作為此值。

傳回

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,則會使用 undefined 作為此值。

繼承自 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,則會使用 undefined 作為此值。

傳回

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 方法會針對數位中的每個元素呼叫 callbackfn 函式一次。

傳回

繼承自 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 方法會針對數位中的每個元素呼叫 callbackfn 函式一次。

initialValue

U

如果指定 initialValue,則會用來做為開始累積的初始值。 第一次呼叫 callbackfn 函式會提供此值做為自變數,而不是數位值。

傳回

U

繼承自 Array.reduceRight

reverse()

反轉Array中的專案。

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,則會使用 undefined 作為此值。

傳回

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