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