Comparing version 5.1.1 to 5.1.2
@@ -151,2 +151,21 @@ 'use strict'; | ||
} | ||
function each(list, handler, scope) { | ||
if (isNull(list) || isNull(handler)) | ||
return; | ||
if (isArray(list)) { | ||
var listLength = list.length; | ||
for (var i = 0; i < listLength; i++) { | ||
var rs = handler.call(scope || list[i], i, list[i]); | ||
if (!isNull(rs)) | ||
return rs; | ||
} | ||
} | ||
else { | ||
for (var key in list) { | ||
var rs = handler.call(scope || list[key], key, list[key]); | ||
if (!isNull(rs)) | ||
return rs; | ||
} | ||
} | ||
} | ||
function copy(src, dst, igonres) { | ||
@@ -437,2 +456,3 @@ dst = dst || (isArray(src) ? [] : {}); | ||
exports.deepEqual = deepEqual; | ||
exports.each = each; | ||
exports.escapeRegExp = escapeRegExp; | ||
@@ -439,0 +459,0 @@ exports.final = final; |
@@ -147,2 +147,21 @@ var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
} | ||
export function each(list, handler, scope) { | ||
if (isNull(list) || isNull(handler)) | ||
return; | ||
if (isArray(list)) { | ||
var listLength = list.length; | ||
for (var i = 0; i < listLength; i++) { | ||
var rs = handler.call(scope || list[i], i, list[i]); | ||
if (!isNull(rs)) | ||
return rs; | ||
} | ||
} | ||
else { | ||
for (var key in list) { | ||
var rs = handler.call(scope || list[key], key, list[key]); | ||
if (!isNull(rs)) | ||
return rs; | ||
} | ||
} | ||
} | ||
export function copy(src, dst, igonres) { | ||
@@ -149,0 +168,0 @@ dst = dst || (isArray(src) ? [] : {}); |
@@ -150,2 +150,21 @@ var ntils = (function (exports) { | ||
} | ||
function each(list, handler, scope) { | ||
if (isNull(list) || isNull(handler)) | ||
return; | ||
if (isArray(list)) { | ||
var listLength = list.length; | ||
for (var i = 0; i < listLength; i++) { | ||
var rs = handler.call(scope || list[i], i, list[i]); | ||
if (!isNull(rs)) | ||
return rs; | ||
} | ||
} | ||
else { | ||
for (var key in list) { | ||
var rs = handler.call(scope || list[key], key, list[key]); | ||
if (!isNull(rs)) | ||
return rs; | ||
} | ||
} | ||
} | ||
function copy(src, dst, igonres) { | ||
@@ -436,2 +455,3 @@ dst = dst || (isArray(src) ? [] : {}); | ||
exports.deepEqual = deepEqual; | ||
exports.each = each; | ||
exports.escapeRegExp = escapeRegExp; | ||
@@ -438,0 +458,0 @@ exports.final = final; |
@@ -153,2 +153,21 @@ (function (global, factory) { | ||
} | ||
function each(list, handler, scope) { | ||
if (isNull(list) || isNull(handler)) | ||
return; | ||
if (isArray(list)) { | ||
var listLength = list.length; | ||
for (var i = 0; i < listLength; i++) { | ||
var rs = handler.call(scope || list[i], i, list[i]); | ||
if (!isNull(rs)) | ||
return rs; | ||
} | ||
} | ||
else { | ||
for (var key in list) { | ||
var rs = handler.call(scope || list[key], key, list[key]); | ||
if (!isNull(rs)) | ||
return rs; | ||
} | ||
} | ||
} | ||
function copy(src, dst, igonres) { | ||
@@ -439,2 +458,3 @@ dst = dst || (isArray(src) ? [] : {}); | ||
exports.deepEqual = deepEqual; | ||
exports.each = each; | ||
exports.escapeRegExp = escapeRegExp; | ||
@@ -441,0 +461,0 @@ exports.final = final; |
{ | ||
"name": "ntils", | ||
"version": "5.1.1", | ||
"version": "5.1.2", | ||
"description": "一个 Node & Browser 工具函数集", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs.js", |
@@ -22,2 +22,3 @@ export declare function noop(): void; | ||
export declare function formatDate(value: Date | number | string, format: string, dict?: any): string; | ||
export declare function each(list: any, handler: (key: string | number, value: any) => any, scope: any): any; | ||
export declare function copy(src: any, dst?: any, igonres?: string[]): any; | ||
@@ -24,0 +25,0 @@ export declare function clone(src: any, igonres?: string[]): any; |
61595
1962