add
This commit is contained in:
parent
83faa86333
commit
5864481781
|
@ -1,4 +1,4 @@
|
|||
import { Platform } from 'react-native';
|
||||
import {Platform} from 'react-native';
|
||||
|
||||
// todo cleanup unused utilities from legacy code
|
||||
/**
|
||||
|
@ -17,11 +17,9 @@ const DEFAULT_CHUNK_SIZE = 50;
|
|||
* @param joiner
|
||||
* @returns {*}
|
||||
*/
|
||||
export function deepGet(
|
||||
object: Object,
|
||||
path: string,
|
||||
joiner?: string = '/'
|
||||
): any {
|
||||
export function deepGet(object: Object,
|
||||
path: string,
|
||||
joiner?: string = '/'): any {
|
||||
const keys = path.split(joiner);
|
||||
|
||||
let i = 0;
|
||||
|
@ -45,11 +43,9 @@ export function deepGet(
|
|||
* @param joiner
|
||||
* @returns {*}
|
||||
*/
|
||||
export function deepExists(
|
||||
object: Object,
|
||||
path: string,
|
||||
joiner?: string = '/'
|
||||
): boolean {
|
||||
export function deepExists(object: Object,
|
||||
path: string,
|
||||
joiner?: string = '/'): boolean {
|
||||
const keys = path.split(joiner);
|
||||
|
||||
let i = 0;
|
||||
|
@ -92,6 +88,15 @@ export function isString(value): Boolean {
|
|||
return typeof value === 'string';
|
||||
}
|
||||
|
||||
export function isIOS() {
|
||||
return Platform.OS === 'ios';
|
||||
}
|
||||
|
||||
export function isAndroid() {
|
||||
return Platform.OS === 'android';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string
|
||||
|
@ -137,12 +142,10 @@ export function noop(): void {
|
|||
* @param callback
|
||||
* @private
|
||||
*/
|
||||
function _delayChunk(
|
||||
collection: Array<*>,
|
||||
chunkSize: number,
|
||||
operation: Function,
|
||||
callback: Function
|
||||
): void {
|
||||
function _delayChunk(collection: Array<*>,
|
||||
chunkSize: number,
|
||||
operation: Function,
|
||||
callback: Function): void {
|
||||
const length = collection.length;
|
||||
const iterations = Math.ceil(length / chunkSize);
|
||||
|
||||
|
@ -170,12 +173,10 @@ function _delayChunk(
|
|||
* @param iterator
|
||||
* @param cb
|
||||
*/
|
||||
export function each(
|
||||
array: Array<*>,
|
||||
chunkSize: number | Function,
|
||||
iterator: Function,
|
||||
cb?: Function
|
||||
): void {
|
||||
export function each(array: Array<*>,
|
||||
chunkSize: number | Function,
|
||||
iterator: Function,
|
||||
cb?: Function): void {
|
||||
if (typeof chunkSize === 'function') {
|
||||
cb = iterator;
|
||||
iterator = chunkSize;
|
||||
|
@ -210,12 +211,10 @@ export function typeOf(value: any): string {
|
|||
* @param cb
|
||||
* @returns {*}
|
||||
*/
|
||||
export function map(
|
||||
array: Array<*>,
|
||||
chunkSize: number | Function,
|
||||
iterator: Function,
|
||||
cb?: Function
|
||||
): void {
|
||||
export function map(array: Array<*>,
|
||||
chunkSize: number | Function,
|
||||
iterator: Function,
|
||||
cb?: Function): void {
|
||||
if (typeof chunkSize === 'function') {
|
||||
cb = iterator;
|
||||
iterator = chunkSize;
|
||||
|
|
Loading…
Reference in New Issue