Comparing version
/** | ||
* xe-utils.js v1.5.27 | ||
* xe-utils.js v1.5.28 | ||
* (c) 2017-2018 Xu Liangzhan | ||
@@ -16,3 +16,3 @@ * ISC License. | ||
XEUtils.version = '1.5.27' | ||
XEUtils.version = '1.5.28' | ||
@@ -262,3 +262,3 @@ /** | ||
/** | ||
* 接收一个函数作为累加器(accumulator),数组中的每个值(从左到右)开始合并,最终为一个值。 | ||
* 接收一个函数作为累加器,数组中的每个值(从左到右)开始合并,最终为一个值。 | ||
* | ||
@@ -284,2 +284,34 @@ * @param {Array} array 数组 | ||
/** | ||
* 浅复制数组的一部分到同一数组中的另一个位置,数组大小不变 | ||
* | ||
* @param {Array} array 数组 | ||
* @param {Number} target 从该位置开始替换数据 | ||
* @param {Number} start 从该位置开始读取数据,默认为 0 。如果为负值,表示倒数 | ||
* @param {Number} end 到该位置前停止读取数据,默认等于数组长度。如果为负值,表示倒数 | ||
* @return {Array} | ||
*/ | ||
function copyWithin (array, target, start, end) { | ||
var targetIndex = target >> 0 | ||
var startIndex = start >> 0 | ||
var len = array.length | ||
var endIndex = arguments.length > 3 ? end >> 0 : len | ||
if (targetIndex < len) { | ||
targetIndex = targetIndex >= 0 ? targetIndex : len + targetIndex | ||
if (targetIndex >= 0) { | ||
startIndex = startIndex >= 0 ? startIndex : len + startIndex | ||
endIndex = endIndex >= 0 ? endIndex : len + endIndex | ||
if (startIndex < endIndex) { | ||
for (var replaceIndex = 0, replaceArray = array.slice(startIndex, endIndex); targetIndex < len; targetIndex++) { | ||
if (replaceArray.length <= replaceIndex) { | ||
break | ||
} | ||
array[targetIndex] = replaceArray[replaceIndex++] | ||
} | ||
} | ||
} | ||
} | ||
return array | ||
} | ||
var arrayExports = { | ||
@@ -309,3 +341,5 @@ arrayUniq: arrayUniq, | ||
arrayReduce: arrayReduce, | ||
reduce: arrayReduce | ||
reduce: arrayReduce, | ||
arrayCopyWithin: copyWithin, | ||
copyWithin: copyWithin | ||
} | ||
@@ -312,0 +346,0 @@ |
/** | ||
* xe-utils.js v1.5.27 | ||
* xe-utils.js v1.5.28 | ||
* (c) 2017-2018 Xu Liangzhan | ||
@@ -7,2 +7,2 @@ * ISC License. | ||
*/ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.XEUtils=n()}(this,function(){"use strict";function t(){}function n(t){var n=[];return yt.isArray(t)&&yt.arrayEach(t,function(t){n.includes(t)||n.push(t)}),n}function e(){for(var t=[],e=0,r=arguments.length;e<r;e++)t=t.concat(arguments[e]);return n(t)}function r(t,n,e){return yt.isArray(t)?t.sort(n?yt.isFunction(n)?n.bind(e||this):function(t,e){return t[n]>e[n]?1:-1}:function(t,n){return t>n?1:-1}):t}function i(t){for(var n=[],e=yt.objectValues(t),r=e.length-1;r>=0;r--){var i=r>0?Et.getRandom(0,r):0;n.push(e[i]),e.splice(i,1)}return n}function a(t,n){var e=i(t);return 1===arguments.length?e[0]:(n<e.length&&(e.length=n||0),e)}function o(t,n,e){if(t){if(e=e||this,yt.isArray(t))return t.some(n,e);for(var r in t)if(t.hasOwnProperty(r)&&n.call(e,t[r],r,t))return!0}return!1}function u(t,n,e){if(t){if(e=e||this,yt.isArray(t))return t.every(n,e);for(var r in t)if(t.hasOwnProperty(r)&&!n.call(e,t[r],r,t))return!1}return!0}function s(t,n,e){if(t){if(e=e||this,yt.isArray(t))return t.filter(n,e);var r={};return yt.each(t,function(i,a){n.call(e,i,a,t)&&(r[a]=i)}),r}return[]}function c(t,n,e){if(t){if(e=e||this,yt.isArray(t))return t.find(n,e);for(var r in t)if(t.hasOwnProperty(r)&&n.call(e,t[r],r,t))return t[r]}}function f(t,n,e){var r=[];if(t){if(e=e||this,yt.isArray(t))return t.map(n,e);yt.each(t,function(){r.push(n.apply(e,arguments))})}return r}function l(t,n,e){var r=0;return e=e||this,yt.each(t,n?yt.isFunction(n)?function(){r+=n.apply(e,arguments)}:function(t,e){r+=t[n]}:function(t,n){r+=t}),r}function h(t,n,e){var r=e,i=0,a=t.length;for(void 0===e&&(r=t[0],i=1);i<a;i++)r=n.call(global,r,t[i],i,t);return r}function g(t){return"function"==typeof t}function p(t){return"string"==typeof t}function y(t){return"number"==typeof t}function d(t){return"object"==typeof t}function m(t){return!!t&&t.constructor===Object}function v(t){return"[object Date]"===et.call(t)}function b(t){return"undefined"!=typeof Symbol&&Symbol.isSymbol?Symbol.isSymbol(t):"symbol"==typeof t}function S(t){return function(n,e){if(n){if(p(n)||rt(n))return t(n,e);for(var r in n)if(e===n[r])return r}return-1}}function M(t,n){return-1!==ot(t,n)}function x(t,n,e){for(var r,i=1,a=n.length;i<a;i++)r=n[i],F(j(n[i]),function(n){t[n]=e?k(r[n],e):r[n]});return t}function j(t){var n=[];if(t){if(Object.keys)return Object.keys(t);N(t,function(t,e){n.push(e)})}return n}function O(t){if(Object.values)return t?Object.values(t):[];var n=[];return F(j(t),function(e){n.push(t[e])}),n}function D(t){if(Object.entries)return t?Object.entries(t):[];var n=[];return F(j(t),function(e){n.push([e,t[e]])}),n}function E(t){return O(t)[0]}function w(t){var n=O(t);return n[n.length-1]}function N(t,n,e){for(var r in t)t.hasOwnProperty(r)&&n.call(e||this,t[r],r,t)}function F(t,n,e){for(var r=0,i=t.length||0;r<i;r++)n.call(e||this,t[r],r,t)}function T(t,n,e){return t?rt(t)?g(t.forEach)?t.forEach(n,e||this):F(t,n,e||this):N(t,n,e||this):t}function A(n){return m(n)?function(t){var n={};return T(t,function(t,e){n[e]=A(t)}),n}(n):rt(n)?function(n){return t.arrayMap(n,A)}(n):n}function k(t,n){return t?n?A(t):ct(m(t)?{}:[],t):t}function W(t,n){var e=parseFloat(n),r=new Date,i=r.getTime();switch(t){case"y":return jt.getWhatYear(r,e).getTime();case"M":return jt.getWhatMonth(r,e).getTime();case"d":return jt.getWhatDay(r,e).getTime();case"H":return i+60*e*60*1e3;case"m":return i+60*e*1e3;case"s":return i+1e3*e}return i}function I(t){return(yt.isDate(t)?t:new Date(t)).toUTCString()}function R(t,n,e){var r=[],i="undefined"!=typeof document;if(this&&this.$context&&(this.$context=null),yt.isArray(t)?r=t:arguments.length>1?r=[yt.objectAssign({name:t,value:n},e)]:yt.isObject(t)&&(r=[t]),!(r.length>0)){var a={};return i&&document.cookie&&yt.arrayEach(document.cookie.split("; "),function(t){var n=t.indexOf("=");a[mt(t.substring(0,n))]=mt(t.substring(n+1)||"")}),1===arguments.length?a[t]:a}i&&yt.arrayEach(r,function(t){var n=yt.objectAssign({},t),e=[];if(n.name){var r=n.expires;e.push(vt(n.name)+"="+vt(yt.isObject(n.value)?JSON.stringify(n.value):n.value)),r&&(isNaN(r)?n.expires=r.replace(/^([0-9]+)(y|M|d|H|m|s)$/,function(t,n,e){return I(W(e,n))}):/^[0-9]{11,13}$/.test(r)||yt.isDate(r)?n.expires=I(r):n.expires=I(W("d",r))),yt.arrayEach(["expires","path","domain","secure"],function(t){void 0!==n[t]&&e.push(n[t]&&"secure"===t?t:t+"="+n[t])})}document.cookie=e.join("; ")})}function H(t,n){if(t){if(yt.isDate(t))return t;if(/^[0-9]{11,13}$/.test(t))return new Date(t);if(yt.isString(t)){n=n||"yyyy-MM-dd HH:mm:ss.SSS";var e=[];return yt.arrayEach(Mt,function(r){for(var i,a,o=0,u=r.rules,s=u.length;o<s;o++){if(i=u[o],(a=n.indexOf(i[0]))>-1){e.push(parseFloat(t.substring(a,a+i[1])||0)+(r.offset||0));break}o===s-1&&e.push(0)}}),new Date(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}}return"Invalid Date"}function P(t,n,e){var r=H(t),i=n&&!isNaN(n)?n:0,a=r.getHours(),o=r.getMinutes(),u=r.getSeconds(),s=r.getMilliseconds();if("first"===e){var c=r.getFullYear(),f=r.getMonth();return(f+=i)<0?new Date(c-Math.ceil((f=Math.abs(f))/12),12-(f%12||1),1,a,o,u,s):new Date(c+Math.floor(f/12),f%12,1,a,o,u,s)}if("last"===e)return new Date(P(r,i+1,"first").getTime()-864e5);var l=r.getDate(),h=P(r,i,"first"),g=h.getMonth();for(h.setDate(l);g<h.getMonth();)h.setDate(--l);return h}function C(t){var n={},e=t.split("?")[1]||"";return e&&yt.arrayEach(e.split("&"),function(t){var e=t.split("=");n[decodeURIComponent(e[0])]=decodeURIComponent(e[1]||"")}),n}function U(){return Ot?Ot.origin||Ot.protocol+"//"+Ot.host:""}function $(t){var n=""+t;0===n.indexOf("/")&&(n=U()+n);var e=n.replace(/#.*/,"").match(/(\?.*)/),r={href:n,hash:"",host:"",hostname:"",protocol:"",port:"",search:e?e[1]:""};r.path=n.replace(/^([a-z0-9.+-]*:)\/\//,function(t,n){return r.protocol=n,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\//,function(t,n,e){var i=e||"";return r.port=i.replace(":",""),r.hostname=n,r.host=n+i,"/"}).replace(/(#.*)/,function(t,n){return r.hash=n,""});var i=r.hash.match(/#((.*)\?|(.*))/);return r.pathname=r.path.replace(/(\?|#.*).*/,""),r.origin=r.protocol+"//"+r.host,r.hashKey=i?i[2]||"":"",r.hashQuery=C(r.hash),r.searchQuery=C(r.search),r}function L(t,n){return yt.isFunction(n)?nt.arraySort(nt.arrayMap(t,n,this)):nt.arraySort(t,n)}function Y(){return L.apply(this,arguments)[0]}function q(){return L.apply(this,arguments).reverse()[0]}function J(t){if(t){var n=parseFloat(t);return isNaN(n)?0:n}return 0}function z(t){return parseInt(J(t))}function B(t){return t&&t.trim?t.trim():Q(K(t))}function K(t){return t&&t.trimLeft?t.trimLeft():(""+t).replace(/^[\s\uFEFF\xA0]+/g,"")}function Q(t){return t&&t.trimRight?t.trimRight():(""+t).replace(/[\s\uFEFF\xA0]+$/g,"")}function V(t){var n=new RegExp("(?:"+yt.objectKeys(t).join("|")+")","g");return function(e){return(""+e).replace(n,function(n){return t[n]})}}function Z(t,n){var e=""+t;if(t.repeat)return t.repeat(n);var r=isNaN(n)?[]:new Array(parseInt(n));return r.join(e)+(r.length>0?e:"")}function X(t,n,e){var r=""+t;return r.padStart?r.padStart(n,e):n>>0>r.length?(e=String(e||" "),(n-=r.length)>e.length&&(e+=Z(e,n/e.length)),e.slice(0,n)+r):r}function G(t,n,e){var r=""+t;return r.padEnd?r.padEnd(n,e):n>>0>r.length?(e=String(e||" "),(n-=r.length)>e.length&&(e+=Z(e,n/e.length)),r+e.slice(0,n)):r}function _(t,n,e){var r=""+t;return 0===(1===arguments.length?r:r.substring(e)).indexOf(n)}function tt(t,n,e){var r=""+t;return 1===arguments.length?r.indexOf(n)===r.length-1:r.substring(0,e).indexOf(n)===e-1}t.version="1.5.27";var nt={arrayUniq:n,uniq:n,arrayUnion:e,union:e,arraySort:r,sort:r,arrayShuffle:i,shuffle:i,arraySample:a,sample:a,arraySome:o,some:o,arrayEvery:u,every:u,arrayFilter:s,filter:s,arrayFind:c,find:c,arrayMap:f,map:f,arraySum:l,sum:l,arrayReduce:h,reduce:h},et=Object.prototype.toString,rt=Array.isArray||function(t){return"[object Array]"===et.call(t)},it=Number.isInteger,at=0,ot=S(function(t,n){if(t.indexOf)return t.indexOf(n);for(var e=0,r=t.length;e<r;e++)if(n===t[e])return e}),ut=S(function(t,n){if(t.lastIndexOf)return t.lastIndexOf(n);for(var e=t.length-1;e>=0;e--)if(n===t[e])return e;return-1}),st=M,ct=function(t){if(t){var n=arguments;if(!0!==t)return Object.assign?Object.assign.apply(Object,n):x(t,n);if(n.length>1)return t=rt(t[1])?[]:{},x(t,n,!0)}return t},ft=j,lt=O,ht=D,gt=E,pt=w,yt={isNaN:isNaN,isFinite:isFinite,isArray:rt,isFloat:function(t){return null!==t&&!isNaN(t)&&!it(t)},isInteger:it,isFunction:g,isBoolean:function(t){return"boolean"==typeof t},isString:p,isNumber:y,isRegExp:function(t){return"[object RegExp]"===et.call(t)},isObject:d,isPlainObject:m,isDate:v,isError:function(t){return"[object Error]"===et.call(t)},isTypeError:function(t){return!!t&&t.constructor===TypeError},isEmpty:function(t){if(0===t||!y(t)){for(var n in t)return!1;return!0}return!1},isNull:function(t){return null===t},isSymbol:b,isArguments:function(t){return"[object Arguments]"===et.call(t)},isElement:function(t){return t&&p(t.nodeName)&&y(t.nodeType)},isDocument:function(t){return t&&9===t.nodeType&&"undefined"!=typeof document},isWindow:function(t){return t&&t===t.window&&"undefined"!=typeof window},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isMap:function(t){return"undefined"!=typeof Map&&t instanceof Map},isWeakMap:function(t){return"undefined"!=typeof WeakMap&&t instanceof WeakMap},isSet:function(t){return"undefined"!=typeof Set&&t instanceof Set},isWeakSet:function(t){return"undefined"!=typeof WeakSet&&t instanceof WeakSet},isLeapYear:function(n){var e=(n?t.stringToDate(n):new Date).getFullYear();return e%4==0&&(e%100!=0||e%400==0)},getType:function(t){return null===t?""+t:b(t)?"symbol":v(t)?"date":rt(t)?"array":typeof t},uniqueId:function(){return++at},getSize:function(t){var n=0;return p(t)||rt(t)?t.length:(T(t,function(){n++}),n)},lastIndexOf:ut,includes:M,contains:st,objectAssign:ct,assign:ct,extend:ct,stringToJson:function(t){if(d(t))return t;if(p(t))try{return JSON.parse(t)}catch(t){console.error(t)}return{}},jsonToString:function(t){if(d(t))try{return JSON.stringify(t)}catch(t){console.error(t)}return t?""+t:""},objectKeys:j,keys:ft,objectValues:O,values:lt,objectEntries:D,entries:ht,arrayFirst:E,first:gt,arrayLast:w,last:pt,objectEach:N,arrayEach:F,each:T,groupBy:function(t,n,e){var r,i,a={};return t&&(p(n)?(i=n,n=null):n=g(n)?n.bind(e||this):i=null,T(t,function(e,o){r=n?n(e,o,t):i?e[i]:e,a[r]?a[r].push(e):a[r]=[e]})),a},objectMap:function(t,n,e){var r={};return T(t,function(i,a){r[a]=n.call(e||this,i,a,t)}),r},clone:k},dt={browse:function(){var t={isNode:!1,isMobile:!1,isPC:!1};if("undefined"==typeof window&&"undefined"!=typeof process)t.nodeJS=!0;else if(t.isMobile=function(){for(var t=["Android","webOS","iPhone","iPad","iPod","SymbianOS","BlackBerry","Windows Phone"],n=navigator.userAgent,e=0;e<t.length;e++)if(n.indexOf(t[e])>0)return!0;return!1}(),t.isPC=!t.isMobile,"undefined"!=typeof document){var n=document.body||document.documentElement;yt.arrayEach(["webkit","khtml","moz","ms","o"],function(e){t["-"+e]=!!n[e+"MatchesSelector"]})}return t}},mt=decodeURIComponent,vt=encodeURIComponent;yt.objectAssign(R,{setItem:function(t,n,e){R(t,n,e)},getItem:function(t){return R(t)},removeItem:function(t){R(t,null,{expires:-1})},getJSON:function(){return R()}});var bt={cookie:R},St=Date.now||function(){return(new Date).getTime()},Mt=[{rules:[["yyyy",4],["yyy",3],["yy",2]]},{rules:[["MM",2],["M",1]],offset:-1},{rules:[["dd",2],["d",1]]},{rules:[["HH",2],["H",1]]},{rules:[["mm",2],["m",1]]},{rules:[["ss",2],["s",1]]},{rules:[["SSS",3],["SS",2],["S",1]]}],xt=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]],jt={timestamp:St,now:St,stringToDate:H,dateToString:function(t,n){if(t){if(t=H(t),yt.isDate(t)){var e=["日","一","二","三","四","五","六"],r={"q+":Math.floor((t.getMonth()+3)/3),"M+":t.getMonth()+1,"E+":t.getDay(),"d+":t.getDate(),"H+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),S:t.getMilliseconds()},i=String(n||"yyyy-MM-dd HH:mm:ss").replace(/(y+)/,function(n){return(""+t.getFullYear()).substr(4-n.length)});for(var a in r)if(r.hasOwnProperty(a)){var o=""+r[a];i=i.replace(new RegExp("("+a+")"),function(t){return"q+"===a||"E+"===a?e[o]:1===t.length?o:("00"+o).substr(o.length)})}return i}return t}return""},getWhatYear:function(t,n){var e=H(t);if(n){var r=n&&!isNaN(n)?n:0;e.setFullYear(e.getFullYear()+r)}return e},getWhatMonth:P,getWhatWeek:function(t,n,e){var r=H(t),i=Number(/^[0-7]$/.test(e)?e:r.getDay()),a=r.getDay(),o=r.getTime()+864e5*((0===i?7:i)-(0===a?7:a));return n&&!isNaN(n)&&(o+=6048e5*n),new Date(o)},getWhatDay:function(t,n){var e=H(t);return n?new Date(e.getTime()+(n&&!isNaN(n)?864e5*n:0)):e},getDaysOfMonth:function(t,n){return Math.floor((P(t,n,"last").getTime()-P(t,n,"first").getTime())/864e5)+1},getDateDiff:function(t,n,e){var r={done:!1},i=H(t).getTime(),a=n?H(n).getTime():new Date;if(i<a){var o,u=a-i,s=e&&e.length>0?e:xt;r.done=!0;for(var c=0,f=s.length;c<f;c++)u>=(o=s[c])[1]?c===f-1?r[o[0]]=u||0:(r[o[0]]=Math.floor(u/o[1]),u-=r[o[0]]*o[1]):r[o[0]]=0}return r}},Ot=null;"undefined"!=typeof location&&(Ot=location);var Dt={parseUrl:$,getBaseURL:function(){if(Ot){var t=Ot.pathname,n=yt.lastIndexOf(t,"/")+1;return U()+(n===t.length?t:t.substring(0,n))}return""},locat:function(){return Ot?$(Ot.href):{}}},Et={getRandom:function(t,n){return t>=n?t:(t>>=0)+Math.round(Math.random()*((n||9)-t))},arrayMin:Y,min:Y,arrayMax:q,max:q,commafy:function(t,n){var e=yt.objectAssign({spaceNumber:3,separator:",",fixed:0},n),r=parseFloat((""+t).replace(/,/g,"")||0).toFixed(e.fixed).split(".");return r[0].replace(new RegExp("(?=(?!(\\b))(\\d{"+e.spaceNumber+"})+$)","g"),e.separator)+(r[1]?"."+r[1]:"")},toNumber:J,stringToNumber:J,toInteger:z,stringToInteger:z},wt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Nt={};yt.arrayEach(yt.objectKeys(wt),function(t){Nt[wt[t]]=t});var Ft={trim:B,stringTrim:B,trimLeft:K,stringTrimLeft:K,trimRight:Q,stringTrimRight:Q,escape:V(wt),unescape:V(Nt),camelCase:function(t){return(""+t).replace(/(-[a-zA-Z])/g,function(t,n){return n.substring(1).toLocaleUpperCase()})},kebabCase:function(t){return(""+t).replace(/([A-Z])/g,function(t,n){return"-"+n.toLowerCase()})},repeat:Z,stringRepeat:Z,padStart:X,stringPadStart:X,padEnd:G,stringPadEnd:G,startsWith:_,stringStartsWith:_,endsWith:tt,stringEndsWith:tt},Tt={};return yt.objectAssign(Tt,nt,yt,dt,bt,jt,Dt,Et,Ft),t.mixin=function(n){Tt.objectEach(n,function(n,e){t[e]=-1==="cookie".indexOf(e)&&Tt.isFunction(n)?function(){var e=n.apply(t.$context,arguments);return t.$context=null,e}:n})},t.mixin(Tt),t}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.XEUtils=n()}(this,function(){"use strict";function t(){}function n(t){var n=[];return dt.isArray(t)&&dt.arrayEach(t,function(t){n.includes(t)||n.push(t)}),n}function e(){for(var t=[],e=0,r=arguments.length;e<r;e++)t=t.concat(arguments[e]);return n(t)}function r(t,n,e){return dt.isArray(t)?t.sort(n?dt.isFunction(n)?n.bind(e||this):function(t,e){return t[n]>e[n]?1:-1}:function(t,n){return t>n?1:-1}):t}function i(t){for(var n=[],e=dt.objectValues(t),r=e.length-1;r>=0;r--){var i=r>0?wt.getRandom(0,r):0;n.push(e[i]),e.splice(i,1)}return n}function a(t,n){var e=i(t);return 1===arguments.length?e[0]:(n<e.length&&(e.length=n||0),e)}function o(t,n,e){if(t){if(e=e||this,dt.isArray(t))return t.some(n,e);for(var r in t)if(t.hasOwnProperty(r)&&n.call(e,t[r],r,t))return!0}return!1}function u(t,n,e){if(t){if(e=e||this,dt.isArray(t))return t.every(n,e);for(var r in t)if(t.hasOwnProperty(r)&&!n.call(e,t[r],r,t))return!1}return!0}function s(t,n,e){if(t){if(e=e||this,dt.isArray(t))return t.filter(n,e);var r={};return dt.each(t,function(i,a){n.call(e,i,a,t)&&(r[a]=i)}),r}return[]}function c(t,n,e){if(t){if(e=e||this,dt.isArray(t))return t.find(n,e);for(var r in t)if(t.hasOwnProperty(r)&&n.call(e,t[r],r,t))return t[r]}}function f(t,n,e){var r=[];if(t){if(e=e||this,dt.isArray(t))return t.map(n,e);dt.each(t,function(){r.push(n.apply(e,arguments))})}return r}function l(t,n,e){var r=0;return e=e||this,dt.each(t,n?dt.isFunction(n)?function(){r+=n.apply(e,arguments)}:function(t,e){r+=t[n]}:function(t,n){r+=t}),r}function h(t,n,e){var r=e,i=0,a=t.length;for(void 0===e&&(r=t[0],i=1);i<a;i++)r=n.call(global,r,t[i],i,t);return r}function g(t,n,e,r){var i=n>>0,a=e>>0,o=t.length,u=arguments.length>3?r>>0:o;if(i<o&&(i=i>=0?i:o+i)>=0&&(a=a>=0?a:o+a,u=u>=0?u:o+u,a<u))for(var s=0,c=t.slice(a,u);i<o&&!(c.length<=s);i++)t[i]=c[s++];return t}function p(t){return"function"==typeof t}function y(t){return"string"==typeof t}function d(t){return"number"==typeof t}function m(t){return"object"==typeof t}function v(t){return!!t&&t.constructor===Object}function b(t){return"[object Date]"===rt.call(t)}function S(t){return"undefined"!=typeof Symbol&&Symbol.isSymbol?Symbol.isSymbol(t):"symbol"==typeof t}function M(t){return function(n,e){if(n){if(y(n)||it(n))return t(n,e);for(var r in n)if(e===n[r])return r}return-1}}function x(t,n){return-1!==ut(t,n)}function j(t,n,e){for(var r,i=1,a=n.length;i<a;i++)r=n[i],T(O(n[i]),function(n){t[n]=e?k(r[n],e):r[n]});return t}function O(t){var n=[];if(t){if(Object.keys)return Object.keys(t);F(t,function(t,e){n.push(e)})}return n}function D(t){if(Object.values)return t?Object.values(t):[];var n=[];return T(O(t),function(e){n.push(t[e])}),n}function E(t){if(Object.entries)return t?Object.entries(t):[];var n=[];return T(O(t),function(e){n.push([e,t[e]])}),n}function w(t){return D(t)[0]}function N(t){var n=D(t);return n[n.length-1]}function F(t,n,e){for(var r in t)t.hasOwnProperty(r)&&n.call(e||this,t[r],r,t)}function T(t,n,e){for(var r=0,i=t.length||0;r<i;r++)n.call(e||this,t[r],r,t)}function A(t,n,e){return t?it(t)?p(t.forEach)?t.forEach(n,e||this):T(t,n,e||this):F(t,n,e||this):t}function W(n){return v(n)?function(t){var n={};return A(t,function(t,e){n[e]=W(t)}),n}(n):it(n)?function(n){return t.arrayMap(n,W)}(n):n}function k(t,n){return t?n?W(t):ft(v(t)?{}:[],t):t}function I(t,n){var e=parseFloat(n),r=new Date,i=r.getTime();switch(t){case"y":return Ot.getWhatYear(r,e).getTime();case"M":return Ot.getWhatMonth(r,e).getTime();case"d":return Ot.getWhatDay(r,e).getTime();case"H":return i+60*e*60*1e3;case"m":return i+60*e*1e3;case"s":return i+1e3*e}return i}function R(t){return(dt.isDate(t)?t:new Date(t)).toUTCString()}function H(t,n,e){var r=[],i="undefined"!=typeof document;if(this&&this.$context&&(this.$context=null),dt.isArray(t)?r=t:arguments.length>1?r=[dt.objectAssign({name:t,value:n},e)]:dt.isObject(t)&&(r=[t]),!(r.length>0)){var a={};return i&&document.cookie&&dt.arrayEach(document.cookie.split("; "),function(t){var n=t.indexOf("=");a[vt(t.substring(0,n))]=vt(t.substring(n+1)||"")}),1===arguments.length?a[t]:a}i&&dt.arrayEach(r,function(t){var n=dt.objectAssign({},t),e=[];if(n.name){var r=n.expires;e.push(bt(n.name)+"="+bt(dt.isObject(n.value)?JSON.stringify(n.value):n.value)),r&&(isNaN(r)?n.expires=r.replace(/^([0-9]+)(y|M|d|H|m|s)$/,function(t,n,e){return R(I(e,n))}):/^[0-9]{11,13}$/.test(r)||dt.isDate(r)?n.expires=R(r):n.expires=R(I("d",r))),dt.arrayEach(["expires","path","domain","secure"],function(t){void 0!==n[t]&&e.push(n[t]&&"secure"===t?t:t+"="+n[t])})}document.cookie=e.join("; ")})}function P(t,n){if(t){if(dt.isDate(t))return t;if(/^[0-9]{11,13}$/.test(t))return new Date(t);if(dt.isString(t)){n=n||"yyyy-MM-dd HH:mm:ss.SSS";var e=[];return dt.arrayEach(xt,function(r){for(var i,a,o=0,u=r.rules,s=u.length;o<s;o++){if(i=u[o],(a=n.indexOf(i[0]))>-1){e.push(parseFloat(t.substring(a,a+i[1])||0)+(r.offset||0));break}o===s-1&&e.push(0)}}),new Date(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}}return"Invalid Date"}function C(t,n,e){var r=P(t),i=n&&!isNaN(n)?n:0,a=r.getHours(),o=r.getMinutes(),u=r.getSeconds(),s=r.getMilliseconds();if("first"===e){var c=r.getFullYear(),f=r.getMonth();return(f+=i)<0?new Date(c-Math.ceil((f=Math.abs(f))/12),12-(f%12||1),1,a,o,u,s):new Date(c+Math.floor(f/12),f%12,1,a,o,u,s)}if("last"===e)return new Date(C(r,i+1,"first").getTime()-864e5);var l=r.getDate(),h=C(r,i,"first"),g=h.getMonth();for(h.setDate(l);g<h.getMonth();)h.setDate(--l);return h}function U(t){var n={},e=t.split("?")[1]||"";return e&&dt.arrayEach(e.split("&"),function(t){var e=t.split("=");n[decodeURIComponent(e[0])]=decodeURIComponent(e[1]||"")}),n}function $(){return Dt?Dt.origin||Dt.protocol+"//"+Dt.host:""}function L(t){var n=""+t;0===n.indexOf("/")&&(n=$()+n);var e=n.replace(/#.*/,"").match(/(\?.*)/),r={href:n,hash:"",host:"",hostname:"",protocol:"",port:"",search:e?e[1]:""};r.path=n.replace(/^([a-z0-9.+-]*:)\/\//,function(t,n){return r.protocol=n,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\//,function(t,n,e){var i=e||"";return r.port=i.replace(":",""),r.hostname=n,r.host=n+i,"/"}).replace(/(#.*)/,function(t,n){return r.hash=n,""});var i=r.hash.match(/#((.*)\?|(.*))/);return r.pathname=r.path.replace(/(\?|#.*).*/,""),r.origin=r.protocol+"//"+r.host,r.hashKey=i?i[2]||"":"",r.hashQuery=U(r.hash),r.searchQuery=U(r.search),r}function Y(t,n){return dt.isFunction(n)?et.arraySort(et.arrayMap(t,n,this)):et.arraySort(t,n)}function q(){return Y.apply(this,arguments)[0]}function J(){return Y.apply(this,arguments).reverse()[0]}function z(t){if(t){var n=parseFloat(t);return isNaN(n)?0:n}return 0}function B(t){return parseInt(z(t))}function K(t){return t&&t.trim?t.trim():V(Q(t))}function Q(t){return t&&t.trimLeft?t.trimLeft():(""+t).replace(/^[\s\uFEFF\xA0]+/g,"")}function V(t){return t&&t.trimRight?t.trimRight():(""+t).replace(/[\s\uFEFF\xA0]+$/g,"")}function Z(t){var n=new RegExp("(?:"+dt.objectKeys(t).join("|")+")","g");return function(e){return(""+e).replace(n,function(n){return t[n]})}}function X(t,n){var e=""+t;if(t.repeat)return t.repeat(n);var r=isNaN(n)?[]:new Array(parseInt(n));return r.join(e)+(r.length>0?e:"")}function G(t,n,e){var r=""+t;return r.padStart?r.padStart(n,e):n>>0>r.length?(e=String(e||" "),(n-=r.length)>e.length&&(e+=X(e,n/e.length)),e.slice(0,n)+r):r}function _(t,n,e){var r=""+t;return r.padEnd?r.padEnd(n,e):n>>0>r.length?(e=String(e||" "),(n-=r.length)>e.length&&(e+=X(e,n/e.length)),r+e.slice(0,n)):r}function tt(t,n,e){var r=""+t;return 0===(1===arguments.length?r:r.substring(e)).indexOf(n)}function nt(t,n,e){var r=""+t;return 1===arguments.length?r.indexOf(n)===r.length-1:r.substring(0,e).indexOf(n)===e-1}t.version="1.5.28";var et={arrayUniq:n,uniq:n,arrayUnion:e,union:e,arraySort:r,sort:r,arrayShuffle:i,shuffle:i,arraySample:a,sample:a,arraySome:o,some:o,arrayEvery:u,every:u,arrayFilter:s,filter:s,arrayFind:c,find:c,arrayMap:f,map:f,arraySum:l,sum:l,arrayReduce:h,reduce:h,arrayCopyWithin:g,copyWithin:g},rt=Object.prototype.toString,it=Array.isArray||function(t){return"[object Array]"===rt.call(t)},at=Number.isInteger,ot=0,ut=M(function(t,n){if(t.indexOf)return t.indexOf(n);for(var e=0,r=t.length;e<r;e++)if(n===t[e])return e}),st=M(function(t,n){if(t.lastIndexOf)return t.lastIndexOf(n);for(var e=t.length-1;e>=0;e--)if(n===t[e])return e;return-1}),ct=x,ft=function(t){if(t){var n=arguments;if(!0!==t)return Object.assign?Object.assign.apply(Object,n):j(t,n);if(n.length>1)return t=it(t[1])?[]:{},j(t,n,!0)}return t},lt=O,ht=D,gt=E,pt=w,yt=N,dt={isNaN:isNaN,isFinite:isFinite,isArray:it,isFloat:function(t){return null!==t&&!isNaN(t)&&!at(t)},isInteger:at,isFunction:p,isBoolean:function(t){return"boolean"==typeof t},isString:y,isNumber:d,isRegExp:function(t){return"[object RegExp]"===rt.call(t)},isObject:m,isPlainObject:v,isDate:b,isError:function(t){return"[object Error]"===rt.call(t)},isTypeError:function(t){return!!t&&t.constructor===TypeError},isEmpty:function(t){if(0===t||!d(t)){for(var n in t)return!1;return!0}return!1},isNull:function(t){return null===t},isSymbol:S,isArguments:function(t){return"[object Arguments]"===rt.call(t)},isElement:function(t){return t&&y(t.nodeName)&&d(t.nodeType)},isDocument:function(t){return t&&9===t.nodeType&&"undefined"!=typeof document},isWindow:function(t){return t&&t===t.window&&"undefined"!=typeof window},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isMap:function(t){return"undefined"!=typeof Map&&t instanceof Map},isWeakMap:function(t){return"undefined"!=typeof WeakMap&&t instanceof WeakMap},isSet:function(t){return"undefined"!=typeof Set&&t instanceof Set},isWeakSet:function(t){return"undefined"!=typeof WeakSet&&t instanceof WeakSet},isLeapYear:function(n){var e=(n?t.stringToDate(n):new Date).getFullYear();return e%4==0&&(e%100!=0||e%400==0)},getType:function(t){return null===t?""+t:S(t)?"symbol":b(t)?"date":it(t)?"array":typeof t},uniqueId:function(){return++ot},getSize:function(t){var n=0;return y(t)||it(t)?t.length:(A(t,function(){n++}),n)},lastIndexOf:st,includes:x,contains:ct,objectAssign:ft,assign:ft,extend:ft,stringToJson:function(t){if(m(t))return t;if(y(t))try{return JSON.parse(t)}catch(t){console.error(t)}return{}},jsonToString:function(t){if(m(t))try{return JSON.stringify(t)}catch(t){console.error(t)}return t?""+t:""},objectKeys:O,keys:lt,objectValues:D,values:ht,objectEntries:E,entries:gt,arrayFirst:w,first:pt,arrayLast:N,last:yt,objectEach:F,arrayEach:T,each:A,groupBy:function(t,n,e){var r,i,a={};return t&&(y(n)?(i=n,n=null):n=p(n)?n.bind(e||this):i=null,A(t,function(e,o){r=n?n(e,o,t):i?e[i]:e,a[r]?a[r].push(e):a[r]=[e]})),a},objectMap:function(t,n,e){var r={};return A(t,function(i,a){r[a]=n.call(e||this,i,a,t)}),r},clone:k},mt={browse:function(){var t={isNode:!1,isMobile:!1,isPC:!1};if("undefined"==typeof window&&"undefined"!=typeof process)t.nodeJS=!0;else if(t.isMobile=function(){for(var t=["Android","webOS","iPhone","iPad","iPod","SymbianOS","BlackBerry","Windows Phone"],n=navigator.userAgent,e=0;e<t.length;e++)if(n.indexOf(t[e])>0)return!0;return!1}(),t.isPC=!t.isMobile,"undefined"!=typeof document){var n=document.body||document.documentElement;dt.arrayEach(["webkit","khtml","moz","ms","o"],function(e){t["-"+e]=!!n[e+"MatchesSelector"]})}return t}},vt=decodeURIComponent,bt=encodeURIComponent;dt.objectAssign(H,{setItem:function(t,n,e){H(t,n,e)},getItem:function(t){return H(t)},removeItem:function(t){H(t,null,{expires:-1})},getJSON:function(){return H()}});var St={cookie:H},Mt=Date.now||function(){return(new Date).getTime()},xt=[{rules:[["yyyy",4],["yyy",3],["yy",2]]},{rules:[["MM",2],["M",1]],offset:-1},{rules:[["dd",2],["d",1]]},{rules:[["HH",2],["H",1]]},{rules:[["mm",2],["m",1]]},{rules:[["ss",2],["s",1]]},{rules:[["SSS",3],["SS",2],["S",1]]}],jt=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]],Ot={timestamp:Mt,now:Mt,stringToDate:P,dateToString:function(t,n){if(t){if(t=P(t),dt.isDate(t)){var e=["日","一","二","三","四","五","六"],r={"q+":Math.floor((t.getMonth()+3)/3),"M+":t.getMonth()+1,"E+":t.getDay(),"d+":t.getDate(),"H+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),S:t.getMilliseconds()},i=String(n||"yyyy-MM-dd HH:mm:ss").replace(/(y+)/,function(n){return(""+t.getFullYear()).substr(4-n.length)});for(var a in r)if(r.hasOwnProperty(a)){var o=""+r[a];i=i.replace(new RegExp("("+a+")"),function(t){return"q+"===a||"E+"===a?e[o]:1===t.length?o:("00"+o).substr(o.length)})}return i}return t}return""},getWhatYear:function(t,n){var e=P(t);if(n){var r=n&&!isNaN(n)?n:0;e.setFullYear(e.getFullYear()+r)}return e},getWhatMonth:C,getWhatWeek:function(t,n,e){var r=P(t),i=Number(/^[0-7]$/.test(e)?e:r.getDay()),a=r.getDay(),o=r.getTime()+864e5*((0===i?7:i)-(0===a?7:a));return n&&!isNaN(n)&&(o+=6048e5*n),new Date(o)},getWhatDay:function(t,n){var e=P(t);return n?new Date(e.getTime()+(n&&!isNaN(n)?864e5*n:0)):e},getDaysOfMonth:function(t,n){return Math.floor((C(t,n,"last").getTime()-C(t,n,"first").getTime())/864e5)+1},getDateDiff:function(t,n,e){var r={done:!1},i=P(t).getTime(),a=n?P(n).getTime():new Date;if(i<a){var o,u=a-i,s=e&&e.length>0?e:jt;r.done=!0;for(var c=0,f=s.length;c<f;c++)u>=(o=s[c])[1]?c===f-1?r[o[0]]=u||0:(r[o[0]]=Math.floor(u/o[1]),u-=r[o[0]]*o[1]):r[o[0]]=0}return r}},Dt=null;"undefined"!=typeof location&&(Dt=location);var Et={parseUrl:L,getBaseURL:function(){if(Dt){var t=Dt.pathname,n=dt.lastIndexOf(t,"/")+1;return $()+(n===t.length?t:t.substring(0,n))}return""},locat:function(){return Dt?L(Dt.href):{}}},wt={getRandom:function(t,n){return t>=n?t:(t>>=0)+Math.round(Math.random()*((n||9)-t))},arrayMin:q,min:q,arrayMax:J,max:J,commafy:function(t,n){var e=dt.objectAssign({spaceNumber:3,separator:",",fixed:0},n),r=parseFloat((""+t).replace(/,/g,"")||0).toFixed(e.fixed).split(".");return r[0].replace(new RegExp("(?=(?!(\\b))(\\d{"+e.spaceNumber+"})+$)","g"),e.separator)+(r[1]?"."+r[1]:"")},toNumber:z,stringToNumber:z,toInteger:B,stringToInteger:B},Nt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ft={};dt.arrayEach(dt.objectKeys(Nt),function(t){Ft[Nt[t]]=t});var Tt={trim:K,stringTrim:K,trimLeft:Q,stringTrimLeft:Q,trimRight:V,stringTrimRight:V,escape:Z(Nt),unescape:Z(Ft),camelCase:function(t){return(""+t).replace(/(-[a-zA-Z])/g,function(t,n){return n.substring(1).toLocaleUpperCase()})},kebabCase:function(t){return(""+t).replace(/([A-Z])/g,function(t,n){return"-"+n.toLowerCase()})},repeat:X,stringRepeat:X,padStart:G,stringPadStart:G,padEnd:_,stringPadEnd:_,startsWith:tt,stringStartsWith:tt,endsWith:nt,stringEndsWith:nt},At={};return dt.objectAssign(At,et,dt,mt,St,Ot,Et,wt,Tt),t.mixin=function(n){At.objectEach(n,function(n,e){t[e]=-1==="cookie".indexOf(e)&&At.isFunction(n)?function(){var e=n.apply(t.$context,arguments);return t.$context=null,e}:n})},t.mixin(At),t}); |
{ | ||
"name": "xe-utils", | ||
"version": "1.5.27", | ||
"version": "1.5.28", | ||
"description": "XEUtils 函数库", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
303
README.md
@@ -15,11 +15,18 @@ # XEUtils 函数库 | ||
## CDN 安装 | ||
使用 script 方式安装,XEUtils 会定义为全局变量 | ||
使用 script 方式安装,XEUtils 会定义为全局变量 | ||
生产环境请使用 xe-utils.min.js,更小的压缩版本,可以带来更快的速度体验。 | ||
### cdnjs 获取最新版本 | ||
[点击浏览](https://cdn.jsdelivr.net/npm/xe-utils/)已发布的所有 npm 包源码 | ||
```HTML | ||
<script src="https://cdn.jsdelivr.net/npm/xe-utils/dist/xe-utils.js"></script> | ||
``` | ||
### unpkg 获取最新版本 | ||
[点击浏览](https://unpkg.com/xe-utils/)已发布的所有 npm 包源码 | ||
```HTML | ||
@@ -30,3 +37,5 @@ <script src="https://unpkg.com/xe-utils/dist/xe-utils.js"></script> | ||
## AMD 安装 | ||
### require.js | ||
```JavaScript | ||
@@ -43,2 +52,3 @@ // require 配置 | ||
## NPM 安装 | ||
```JavaScript | ||
@@ -49,2 +59,3 @@ npm install xe-utils --save | ||
### NodeJS 导入 | ||
```JavaScript | ||
@@ -55,2 +66,3 @@ const XEUtils = require('xe-utils') | ||
### ES6 Module import 部分导入 | ||
```JavaScript | ||
@@ -61,2 +73,3 @@ import { dateToString, stringToDate } from 'xe-utils' | ||
### ES6 Module import 导入所有 | ||
```JavaScript | ||
@@ -67,3 +80,5 @@ import XEUtils from 'xe-utils' | ||
## API | ||
### isNaN (val) 判断是否非数值 | ||
```JavaScript | ||
@@ -74,3 +89,3 @@ import XEUtils from 'xe-utils' | ||
XEUtils.isNaN({}) // true | ||
XEUtils.isNaN('num') // true | ||
XEUtils.isNaN('num') // true | ||
XEUtils.isNaN(true) // false | ||
@@ -80,3 +95,5 @@ XEUtils.isNaN(null) // false | ||
``` | ||
### isFinite (val) 判断是否为有限数值 | ||
```JavaScript | ||
@@ -89,3 +106,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isArray (val) 判断是否数组 | ||
```JavaScript | ||
@@ -98,3 +117,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isFloat (val) 判断是否小数 | ||
```JavaScript | ||
@@ -108,3 +129,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isInteger (val) 判断是否整数 | ||
```JavaScript | ||
@@ -118,3 +141,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
#### isFunction (val) 判断是否方法 | ||
```JavaScript | ||
@@ -126,3 +151,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isBoolean (val) 判断是否Boolean对象 | ||
```JavaScript | ||
@@ -134,3 +161,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isString (val) 判断是否String对象 | ||
```JavaScript | ||
@@ -144,3 +173,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isNumber (val) 判断是否Number对象 | ||
```JavaScript | ||
@@ -153,3 +184,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isRegExp (val) 判断是否RegExp对象 | ||
```JavaScript | ||
@@ -163,3 +196,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isObject (val) 判断是否Object对象 | ||
```JavaScript | ||
@@ -173,3 +208,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isPlainObject (val) 判断是否是一个对象 | ||
```JavaScript | ||
@@ -183,3 +220,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isDate (val) 判断是否Date对象 | ||
```JavaScript | ||
@@ -193,3 +232,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isError (val) 判断是否Error对象 | ||
```JavaScript | ||
@@ -202,3 +243,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isTypeError (val) 判断是否TypeError对象 | ||
```JavaScript | ||
@@ -211,3 +254,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isEmpty (val) 判断是否为空,包括空对象、空数值、空字符串 | ||
```JavaScript | ||
@@ -222,3 +267,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isNull (val) 判断是否为Null | ||
```JavaScript | ||
@@ -231,3 +278,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isSymbol (val) 判断是否Symbol对象 | ||
```JavaScript | ||
@@ -239,3 +288,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isArguments (val) 判断是否Arguments对象 | ||
```JavaScript | ||
@@ -247,3 +298,5 @@ import { isArguments } from 'xe-utils' | ||
``` | ||
### isElement (val) 判断是否Element对象 | ||
```JavaScript | ||
@@ -255,3 +308,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isDocument (val) 判断是否Document对象 | ||
```JavaScript | ||
@@ -263,3 +318,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isWindow (val) 判断是否Window对象 | ||
```JavaScript | ||
@@ -271,3 +328,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isFormData (val) 判断是否FormData对象 | ||
```JavaScript | ||
@@ -279,3 +338,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isMap (val) 判断是否Map对象 | ||
```JavaScript | ||
@@ -287,3 +348,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isWeakMap (val) 判断是否WeakMap对象 | ||
```JavaScript | ||
@@ -295,3 +358,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isSet (val) 判断是否Set对象 | ||
```JavaScript | ||
@@ -303,3 +368,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isWeakSet (val) 判断是否WeakSet对象 | ||
```JavaScript | ||
@@ -311,3 +378,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### isLeapYear (date) 判断是否闰年 | ||
```JavaScript | ||
@@ -320,3 +389,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### getType (obj) 获取对象类型 | ||
```JavaScript | ||
@@ -333,3 +404,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### uniqueId ( ) 获取一个全局唯一标识 | ||
```JavaScript | ||
@@ -341,3 +414,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### getSize ( obj ) 返回对象的长度 | ||
```JavaScript | ||
@@ -350,3 +425,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### indexOf (obj, val) 返回对象第一个索引值 | ||
```JavaScript | ||
@@ -358,3 +435,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### lastIndexOf (obj, val) 从最后开始的索引值,返回对象第一个索引值 | ||
```JavaScript | ||
@@ -366,3 +445,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### includes (obj, val) 判断对象是否包含该值,成功返回true否则false | ||
```JavaScript | ||
@@ -374,3 +455,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### assign/objectAssign/extend ([deep], target, ...) 浅拷贝一个或者多个对象到目标对象中,如果第一值是true,则使用深拷贝 | ||
```JavaScript | ||
@@ -394,3 +477,5 @@ import XEUtils, { objectAssign } from 'xe-utils' | ||
``` | ||
### stringToJson (str) 字符串转JSON | ||
```JavaScript | ||
@@ -402,3 +487,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### jsonToString (obj) JSON转字符串 | ||
```JavaScript | ||
@@ -410,3 +497,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### keys/objectKeys (obj) 获取对象所有属性 | ||
```JavaScript | ||
@@ -418,3 +507,5 @@ import XEUtils, { objectKeys } from 'xe-utils' | ||
``` | ||
### values/objectValues (obj) 获取对象所有值 | ||
```JavaScript | ||
@@ -426,3 +517,5 @@ import XEUtils, { objectValues } from 'xe-utils' | ||
``` | ||
### entries/objectEntries (obj) 获取对象所有属性、值 | ||
```JavaScript | ||
@@ -434,3 +527,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### first/arrayFirst (obj) 获取对象第一个值 | ||
```JavaScript | ||
@@ -442,3 +537,5 @@ import XEUtils, { arrayFirst } from 'xe-utils' | ||
``` | ||
### last/arrayLast (obj) 获取对象最后一个值 | ||
```JavaScript | ||
@@ -450,3 +547,5 @@ import XEUtils, { arrayLast } from 'xe-utils' | ||
``` | ||
### each/objectEach/arrayEach ( obj, iteratee, context ) 迭代器 | ||
```JavaScript | ||
@@ -465,12 +564,14 @@ import XEUtils, { objectEach, arrayEach } from 'xe-utils' | ||
``` | ||
### groupBy ( obj, iteratee, context ) 集合分组,默认使用键值分组,如果有iteratee则使用结果进行分组 | ||
```JavaScript | ||
import XEUtils from 'xe-utils' | ||
const result1 = XEUtils.groupBy([{type: 'a'}, {type: 'b'}], 'type') // {a: [{a: 'a'}], b: [{b: 'b'}]} | ||
const result2 = XEUtils.groupBy([{type: 'a'}, {type: 'b'}], (item, key) => { | ||
return item.type | ||
}) // {a: [{a: 'a'}], b: [{b: 'b'}]} | ||
const result1 = XEUtils.groupBy([{type: 'a'}, {type: 'b'}], 'type') // {a: [{type: 'a'}], b: [{type: 'b'}]} | ||
const result2 = XEUtils.groupBy([{type: 'a'}, {type: 'b'}], item => item.type) // {a: [{a: 'a'}], b: [{b: 'b'}]} | ||
``` | ||
### objectMap ( obj, iteratee, context ) 指定方法后的返回值组成的新对象 | ||
```JavaScript | ||
@@ -480,7 +581,7 @@ import XEUtils from 'xe-utils' | ||
const result = [] | ||
XEUtils.objectMap([{type: 'a'}, {type: 'b'}], (item, key) => { | ||
return item.type | ||
}) // {a: {type: 'a', b: {type: 'b'}}} | ||
XEUtils.objectMap({a: {type: 'a'}, b: {type: 'b'}}, item => item.type) // {a: "a", b: "b"} | ||
``` | ||
### clone (obj, deep) 浅拷贝/深拷贝 | ||
```JavaScript | ||
@@ -501,2 +602,3 @@ import XEUtils from 'xe-utils' | ||
### uniq/arrayUniq ( array ) 数组去重 | ||
```JavaScript | ||
@@ -508,3 +610,5 @@ import XEUtils, { arrayUniq } from 'xe-utils' | ||
``` | ||
### union/arrayUnion ( ...array ) 将多个数的值返回唯一的并集数组 | ||
```JavaScript | ||
@@ -516,3 +620,5 @@ import XEUtils, { arrayUnion } from 'xe-utils' | ||
``` | ||
### sort/arraySort ( arr, iteratee, context ) 数组按属性值升序 | ||
```JavaScript | ||
@@ -522,8 +628,7 @@ import XEUtils, { arraySort } from 'xe-utils' | ||
XEUtils.sort([{a: 9}, {a: 4}, {a: 5}], 'a') // [{a: 4}, {a: 5}, {a: 9}] | ||
arraySort([{a: 9}, {a: 4}, {a: 5}], (v1, v2) => { | ||
return v1.a > v2.a ? 1 : -1 | ||
}) // [{a: 4}, {a: 5}, {a: 9}] | ||
arraySort([{a: 9}, {a: 4}, {a: 5}], (v1, v2) => v1.a > v2.a ? 1 : -1) // [{a: 4}, {a: 5}, {a: 9}] | ||
``` | ||
``` | ||
### shuffle/arrayShuffle ( array ) 将一个数组随机打乱,返回一个新的数组 | ||
```JavaScript | ||
@@ -535,3 +640,5 @@ import XEUtils, { arrayShuffle } from 'xe-utils' | ||
``` | ||
### sample/arraySample ( array, number ) 从一个数组中随机返回几个元素 | ||
```JavaScript | ||
@@ -543,59 +650,61 @@ import XEUtils, { arraySample } from 'xe-utils' | ||
``` | ||
### some/arraySome ( obj, iteratee, context ) 对象中的值中的每一项运行给定函数,如果函数对任一项返回true,则返回true,否则返回false | ||
```JavaScript | ||
import XEUtils, { arraySome } from 'xe-utils' | ||
XEUtils.some([{a: 11}, {a: 22}], (item, key) => { | ||
return item.a === 55 | ||
}) // false | ||
arraySome([{a: 11}, {a: 22}], (item, key) => { | ||
return item.a === 11 | ||
}) // true | ||
XEUtils.some([{a: 11}, {a: 22}], item => item.a === 55) // false | ||
arraySome([{a: 11}, {a: 22}], item => item.a === 11) // true | ||
``` | ||
### every/arrayEvery ( obj, iteratee, context ) 对象中的值中的每一项运行给定函数,如果该函数对每一项都返回true,则返回true,否则返回false | ||
```JavaScript | ||
import XEUtils, { arrayEvery } from 'xe-utils' | ||
XEUtils.every([{a: 11}, {a: 22}], (item, key) => { | ||
return item.a === 11 | ||
}) // false | ||
arrayEvery([{a: 11}, {a: 22}]], (item, key) => { | ||
return item.a === 11 || item.a === 22 | ||
}) // true | ||
XEUtils.every([{a: 11}, {a: 22}], item => item.a === 11) // false | ||
arrayEvery([{a: 11}, {a: 22}]], item => item.a === 11 || item.a === 22) // true | ||
``` | ||
### filter/arrayFilter ( obj, iteratee, context ) 根据回调过滤数据 | ||
```JavaScript | ||
import XEUtils, { arrayFilter } from 'xe-utils' | ||
XEUtils.filter([{a: 11}, {a: 22}], (item, key) => { | ||
return item.a > 11 | ||
}) // [{a: 22}] | ||
arrayFilter([{a: 11}, {a: 22}], (item, key) => { | ||
return item.a > 11 | ||
}) // [{a: 22}] | ||
XEUtils.filter([{a: 11}, {a: 22}], item => item.a > 11) // [{a: 22}] | ||
arrayFilter([{a: 11}, {a: 22}], item => item.a > 11) // [{a: 22}] | ||
``` | ||
### find/arrayFind ( obj, iteratee, context ) 查找匹配第一条数据 | ||
```JavaScript | ||
import XEUtils, { arrayFind } from 'xe-utils' | ||
XEUtils.find([{a: 11}, {a: 22}], (item, key) => { | ||
return item.a === 55 | ||
}) // null | ||
arrayFind([{a: 11}, {a: 22}], (item, key) => { | ||
return item.a === 22 | ||
}) // {a: 22} | ||
XEUtils.find([{a: 11}, {a: 22}], item => item.a === 55) // null | ||
arrayFind([{a: 11}, {a: 22}], item => item.a === 22) // {a: 22} | ||
``` | ||
### map/arrayMap ( obj, iteratee, context ) 指定方法后的返回值组成的新数组 | ||
```JavaScript | ||
import XEUtils, { arrayMap } from 'xe-utils' | ||
XEUtils.map([{a: 11}, {a: 22}], (item, key) => { | ||
return item.a | ||
}) // [11, 22] | ||
arrayMap([{a: 11}, {a: 22}], (item, key) => { | ||
return item.a | ||
}) // [11, 22] | ||
XEUtils.map([{a: 11}, {a: 22}], item => item.a) // [11, 22] | ||
arrayMap([{a: 11}, {a: 22}], item => item.a) // [11, 22] | ||
``` | ||
### copyWithin/arrayCopyWithin ( array, target, start, end ) 浅复制数组的一部分到同一数组中的另一个位置,数组大小不变 | ||
```JavaScript | ||
import XEUtils, { arrayCopyWithin } from 'xe-utils' | ||
XEUtils.copyWithin([11, 22, 33, 44], 0, 2) // [33, 44, 33, 44] | ||
XEUtils.copyWithin([11, 22, 33, 44], 0, -1) // [44, 22, 33, 44] | ||
arrayCopyWithin([11, 22, 33, 44], 0, 2) // [33, 44, 33, 44] | ||
arrayCopyWithin([11, 22, 33, 44], 0, -1) // [44, 22, 33, 44] | ||
``` | ||
### sum/arraySum ( obj, iteratee, context ) 求和函数,将数值相加 | ||
```JavaScript | ||
@@ -606,14 +715,16 @@ import XEUtils, { arraySum } from 'xe-utils' | ||
XEUtils.sum([{aa: 11}, {aa: 22}, {aa: 66}], 'aa') // 99 | ||
arraySum([{aa: 11}, {aa: 22}, {aa: 66}], (item, key) => item.aa * 2) // 198 | ||
arraySum([{aa: 11}, {aa: 22}, {aa: 66}], item => item.aa * 2) // 198 | ||
``` | ||
### reduce/arrayReduce ( array, callback, initialValue ) 接收一个函数作为累加器(accumulator),数组中的每个值(从左到右)开始合并,最终为一个值 | ||
### reduce/arrayReduce ( array, callback, initialValue ) 接收一个函数作为累加器,数组中的每个值(从左到右)开始合并,最终为一个值 | ||
```JavaScript | ||
import XEUtils, { arrayReduce } from 'xe-utils' | ||
XEUtils.reduce([22, 66, 88], (previous, item, index) => previous + item) // 176 | ||
arrayReduce([22, 66, 88], (previous, item, index) => (previous + item) * 2) // 528 | ||
XEUtils.reduce([22, 66, 88], (previous, item) => previous + item) // 176 | ||
arrayReduce([22, 66, 88], (previous, item) => (previous + item) * 2) // 528 | ||
``` | ||
### now/timestamp ( ) 返回时间戳 | ||
```JavaScript | ||
@@ -625,3 +736,5 @@ import XEUtils, { timestamp } from 'xe-utils' | ||
``` | ||
### stringToDate ( str, format ) 任意格式字符串转为日期(yyyy年份、MM月份、dd天、HH小时、mm分钟、ss秒、SSS毫秒) | ||
```JavaScript | ||
@@ -636,3 +749,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### dateToString ( date, format ) 日期化为任意格式字符串(yyyy年份、MM月份、dd天、HH小时、mm分钟、ss秒、S毫秒、E星期几、q季度) | ||
```JavaScript | ||
@@ -648,3 +763,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### getWhatYear ( date, year ) 返回前几年或后几年的日期 | ||
```JavaScript | ||
@@ -658,3 +775,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### getWhatMonth ( date, mode, month ) 返回前几月或后几月的日期,可以指定月初或月末,默认当前 | ||
```JavaScript | ||
@@ -670,3 +789,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### getWhatWeek ( date, mode, week ) 返回前几周或后几周的日期,可以指定星期几,默认当前 | ||
```JavaScript | ||
@@ -682,3 +803,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### getWhatDay ( date, day ) 返回前几天或后几天的日期 | ||
```JavaScript | ||
@@ -692,3 +815,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### getDaysOfMonth ( date, month ) 返回当前日期月份的天数,可以指定前几个月或后几个月,默认当前 | ||
```JavaScript | ||
@@ -703,3 +828,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### getDateDiff ( startDate, endDate, rules ) 返回两个日期之间差距,如果结束日期小于开始日期done为fasle | ||
```JavaScript | ||
@@ -717,2 +844,3 @@ import XEUtils from 'xe-utils' | ||
### getRandom ( min, max ) 获取一个指定范围内随机数 | ||
```JavaScript | ||
@@ -725,3 +853,5 @@ import XEUtils from 'xe-utils' | ||
``` | ||
### min/arrayMin ( arr, iteratee ) 获取最小值 | ||
```JavaScript | ||
@@ -732,7 +862,7 @@ import XEUtils, { arrayMin } from 'xe-utils' | ||
arrayMin([{a: 11}, {a: 44}], 'a') // 11 | ||
arrayMin([{a: 11}, {a: 44}], (item) => { | ||
return item.a | ||
}) // {a: 11} | ||
arrayMin([{a: 11}, {a: 44}], item => item.a) // {a: 11} | ||
``` | ||
### max/arrayMax ( arr, iteratee ) 获取最大值 | ||
```JavaScript | ||
@@ -743,8 +873,7 @@ import XEUtils, { arrayMax } from 'xe-utils' | ||
arrayMax([{a: 11}, {a: 44}], 'a') // 44 | ||
arrayMax([{a: 11}, {a: 44}], (item) => { | ||
return item.a | ||
}) // {a: 44} | ||
arrayMax([{a: 11}, {a: 44}], item => item.a) // {a: 44} | ||
``` | ||
### commafy ( num, options ) 数值千分位分隔符、小数点 | ||
```JavaScript | ||
@@ -762,2 +891,3 @@ import XEUtils from 'xe-utils' | ||
### toNumber/stringToNumber ( num ) 转数值 | ||
```JavaScript | ||
@@ -772,2 +902,3 @@ import XEUtils, { stringToNumber } from 'xe-utils' | ||
### toInteger/stringToInteger ( num ) 转整数 | ||
```JavaScript | ||
@@ -782,6 +913,7 @@ import XEUtils, { stringToInteger } from 'xe-utils' | ||
### trim/stringTrim ( str ) 去除字符串左右两边的空格 | ||
```JavaScript | ||
import XEUtils, { stringTrim } from 'xe-utils' | ||
XEUtils.stringTrim(' abc ') // 'abc' | ||
XEUtils.trim(' abc ') // 'abc' | ||
stringTrim(' abc ') // 'abc' | ||
@@ -791,6 +923,7 @@ ``` | ||
### trimLeft/stringTrimLeft ( str ) 去除字符串左边的空格 | ||
```JavaScript | ||
import XEUtils, { stringTrimLeft } from 'xe-utils' | ||
XEUtils.stringTrimLeft(' abc ') // 'abc ' | ||
XEUtils.trimLeft(' abc ') // 'abc ' | ||
stringTrimLeft(' abc ') // 'abc ' | ||
@@ -800,6 +933,7 @@ ``` | ||
### trimRight/stringTrimRight ( str ) 去除字符串右边的空格 | ||
```JavaScript | ||
import XEUtils, { stringTrimRight } from 'xe-utils' | ||
XEUtils.stringTrimRight(' abc ') // ' aa' | ||
XEUtils.trimRight(' abc ') // ' aa' | ||
stringTrimRight(' abc ') // ' aa' | ||
@@ -809,2 +943,3 @@ ``` | ||
### escape ( str ) 转义HTML字符串,替换&, <, >, ", ', `字符 | ||
```JavaScript | ||
@@ -817,2 +952,3 @@ import XEUtils from 'xe-utils' | ||
### unescape ( str ) 反转escape | ||
```JavaScript | ||
@@ -824,3 +960,4 @@ import XEUtils from 'xe-utils' | ||
### camelCase ( str ) 将字符串转成驼峰字符串 | ||
### camelCase ( str ) 将带驼峰字符串转成字符串 | ||
```JavaScript | ||
@@ -832,3 +969,4 @@ import XEUtils from 'xe-utils' | ||
### kebabCase ( str ) 将带驼峰字符串转成字符串 | ||
### kebabCase ( str ) 将字符串转成驼峰字符串 | ||
```JavaScript | ||
@@ -840,3 +978,4 @@ import XEUtils from 'xe-utils' | ||
### stringRepeat ( str, count ) 将字符串重复 n次 | ||
### stringRepeat ( str, count ) 将字符串重复 n 次 | ||
```JavaScript | ||
@@ -850,2 +989,3 @@ import XEUtils, { stringRepeat } from 'xe-utils' | ||
### padStart/stringPadStart ( str, targetLength, padString ) 用指定字符从前面开始补全字符串 | ||
```JavaScript | ||
@@ -859,2 +999,3 @@ import XEUtils, { stringPadStart } from 'xe-utils' | ||
### padEnd/stringPadEnd ( str, targetLength, padString ) 用指定字符从后面开始补全字符串 | ||
```JavaScript | ||
@@ -868,2 +1009,3 @@ import XEUtils, { stringPadEnd } from 'xe-utils' | ||
### startsWith/stringStartsWith ( str, val, startIndex ) 判断字符串是否在源字符串的头部 | ||
```JavaScript | ||
@@ -877,2 +1019,3 @@ import XEUtils, { stringStartsWith } from 'xe-utils' | ||
### endsWith/stringEndsWith ( str, val, startIndex ) 判断字符串是否在源字符串的尾部 | ||
```JavaScript | ||
@@ -886,2 +1029,3 @@ import XEUtils, { stringEndsWith } from 'xe-utils' | ||
### browse ( ) 获取浏览器内核 | ||
```JavaScript | ||
@@ -892,8 +1036,8 @@ import XEUtils from 'xe-utils' | ||
// { | ||
// "-khtml": false, | ||
// "-moz": false, | ||
// "-ms": fasle, | ||
// "-o": false, | ||
// "-webkit": true, | ||
// isMobile: false, | ||
// "-khtml": false, | ||
// "-moz": false, | ||
// "-ms": fasle, | ||
// "-o": false, | ||
// "-webkit": true, | ||
// isMobile: false, | ||
// isNode: false, | ||
@@ -905,2 +1049,3 @@ // isPC: true | ||
### locat ( ) 获取地址栏信息 | ||
```JavaScript | ||
@@ -911,7 +1056,7 @@ import XEUtils from 'xe-utils' | ||
// { | ||
// hash: '', | ||
// hostname: '', | ||
// protocol: '', | ||
// port: '', | ||
// origin: '', | ||
// hash: '', | ||
// hostname: '', | ||
// protocol: '', | ||
// port: '', | ||
// origin: '', | ||
// ... | ||
@@ -922,2 +1067,3 @@ // } | ||
### parseUrl ( url ) 解析 URL 参数 | ||
```JavaScript | ||
@@ -928,5 +1074,5 @@ import XEUtils from 'xe-utils' | ||
// { | ||
// hostname: 'xuliangzhan.com', | ||
// protocol: 'http:', | ||
// port: '8080', | ||
// hostname: 'xuliangzhan.com', | ||
// protocol: 'http:', | ||
// port: '8080', | ||
// ... | ||
@@ -937,2 +1083,3 @@ // } | ||
### getBaseURL ( ) 获取上下文路径 | ||
```JavaScript | ||
@@ -944,3 +1091,4 @@ import XEUtils from 'xe-utils' | ||
### cookie ( ) Cookie操作函数 | ||
### cookie ( ) Cookie 操作函数 | ||
```JavaScript | ||
@@ -998,3 +1146,5 @@ import XEUtils from 'xe-utils' | ||
## 混合函数 | ||
### 文件 ./customs.js | ||
```JavaScript | ||
@@ -1005,5 +1155,7 @@ import XEUtils from 'xe-utils' | ||
return XEUtils.dateToString(date, 'yyyy-MM-dd HH:mm') | ||
} | ||
} | ||
``` | ||
### 示例 ./main.js | ||
```JavaScript | ||
@@ -1021,2 +1173,3 @@ import Vue from 'vue' | ||
## License | ||
Copyright (c) 2017-present, Xu Liangzhan |
@@ -5,4 +5,4 @@ 'use strict' | ||
XEUtils.version = '1.5.27' | ||
XEUtils.version = '1.5.28' | ||
module.exports = XEUtils |
@@ -249,3 +249,3 @@ 'use strict' | ||
/** | ||
* 接收一个函数作为累加器(accumulator),数组中的每个值(从左到右)开始合并,最终为一个值。 | ||
* 接收一个函数作为累加器,数组中的每个值(从左到右)开始合并,最终为一个值。 | ||
* | ||
@@ -271,2 +271,34 @@ * @param {Array} array 数组 | ||
/** | ||
* 浅复制数组的一部分到同一数组中的另一个位置,数组大小不变 | ||
* | ||
* @param {Array} array 数组 | ||
* @param {Number} target 从该位置开始替换数据 | ||
* @param {Number} start 从该位置开始读取数据,默认为 0 。如果为负值,表示倒数 | ||
* @param {Number} end 到该位置前停止读取数据,默认等于数组长度。如果为负值,表示倒数 | ||
* @return {Array} | ||
*/ | ||
function copyWithin (array, target, start, end) { | ||
var targetIndex = target >> 0 | ||
var startIndex = start >> 0 | ||
var len = array.length | ||
var endIndex = arguments.length > 3 ? end >> 0 : len | ||
if (targetIndex < len) { | ||
targetIndex = targetIndex >= 0 ? targetIndex : len + targetIndex | ||
if (targetIndex >= 0) { | ||
startIndex = startIndex >= 0 ? startIndex : len + startIndex | ||
endIndex = endIndex >= 0 ? endIndex : len + endIndex | ||
if (startIndex < endIndex) { | ||
for (var replaceIndex = 0, replaceArray = array.slice(startIndex, endIndex); targetIndex < len; targetIndex++) { | ||
if (replaceArray.length <= replaceIndex) { | ||
break | ||
} | ||
array[targetIndex] = replaceArray[replaceIndex++] | ||
} | ||
} | ||
} | ||
} | ||
return array | ||
} | ||
var arrayExports = { | ||
@@ -296,5 +328,7 @@ arrayUniq: arrayUniq, | ||
arrayReduce: arrayReduce, | ||
reduce: arrayReduce | ||
reduce: arrayReduce, | ||
arrayCopyWithin: copyWithin, | ||
copyWithin: copyWithin | ||
} | ||
module.exports = arrayExports |
142647
2.39%3455
1.95%1079
16.52%