Home Reference Source Repository

Variable

Static Public Summary
public

Finds the index of an element in an array by comparing defined identifying property.

public

Gets an element in an array by comparing defined identifying property.

public

Gets the next available identifier for pushing a keyed element into the array.

Static Public

public findBy: number: Function source

import {findBy} from 'test-rest/src/utils/data.js'

Finds the index of an element in an array by comparing defined identifying property.

Return:

number

The targeted element index.

Example:

let resultIndex = findBy('id', 1)(elements);

public getBy: Object: Function source

import {getBy} from 'test-rest/src/utils/data.js'

Gets an element in an array by comparing defined identifying property.

Return:

Object

The targeted element.

Example:

let result = getBy('id', 1)(elements);

public getId(items: Array): number: Function source

import {getId} from 'test-rest/src/utils/data.js'

Gets the next available identifier for pushing a keyed element into the array.

Return:

number

The next free identifier.

Example:

let nextId = getId(elements);