New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ewt/eutils

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ewt/eutils - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

src/attr.js

1178

dist/eUtils.min.js

@@ -1,1178 +0,2 @@

(function(l, i, v, e) { v = l.createElement(i); v.async = 1; v.src = '//' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; e = l.getElementsByTagName(i)[0]; e.parentNode.insertBefore(v, e)})(document, 'script');
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.EUtils = factory());
}(this, (function () { 'use strict';
/**
* Date format and output the formatted date;
*
* @since 1.0.0
* @category date;
* @author yhm1694;
* @param { number | Date } date, the origin date which you want to format;
* @param { string } format, the format that the date you want to output;
* @return { string } formatDate, return the formatted date;
* @create_date 2018/07/15;
* @modify_date 2018/07/15;
*
* @example
*
* dateFormat(1531643785284, 'yyyy-MM-dd');
*
* // => '2018-07-15'
*/
var dateFormat = function dateFormat(date, format) {
if (!format) {
return date;
}
var formattedDate = format;
date = new Date(date);
var regObj = {
'M+': date.getMonth() + 1,
'd+': date.getDate(),
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds(),
'q+': Math.floor((date.getMonth() + 3) / 3),
'S': date.getMilliseconds()
};
var keys = Object.keys(regObj);
if (/(y+)/.test(format)) {
formattedDate = format.replace(RegExp.$1, ('' + date.getFullYear()).substr(4 - RegExp.$1.length));
}
keys.forEach(function (item) {
if (new RegExp('(' + item + ')').test(format)) {
formattedDate = formattedDate.replace(RegExp.$1, RegExp.$1.length === 1 ? regObj[item] : ('00' + regObj[item]).substr(('' + regObj[item]).length));
}
});
return formattedDate;
};
/**
* set url param by object
*
* @since 1.0.0;
* @category Object;
* @author jiaguishan;
* @param paramsObject {Object} param object;
* @return no return
* @create_date 2018/07/09;
* @modify_date 2018/07/18;
* @example
*
* current location href => http://web.ewt360.com
* setUrlParam({
* id: 1,
* token: '807341-111-111aaa7a7a'
* })
* // => 'http://web.ewt360.com?id=1&token=807341-111-111aaa7a7a'
*
* current location href => http://web.ewt360.com?id=2
* setUrlParam({
* id: 1,
* token: '807341-111-111aaa7a7a'
* }, 'http://www.ewt360.com')
* // => 'http://www.ewt360.com?id=1&token=807341-111-111aaa7a7a'
*/
function setUrlParam(targetParams) {
var originUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href;
var resultUrl = originUrl;
var keys = Object.keys(targetParams);
var i = keys.length;
var resArray = [];
while (i--) {
resArray[i] = [keys[i], targetParams[keys[i]]];
}
resArray.forEach(function (_ref) {
var key = _ref[0],
value = _ref[1];
var replaceReg = new RegExp('(^|)' + key + '=([^&]*)(|$)');
var replaceText = key + '=' + value;
if (resultUrl.match(replaceReg)) {
var tmpReg = new RegExp('(' + key + '=)([^&]*)', 'gi');
resultUrl = resultUrl.replace(tmpReg, replaceText);
} else {
var joinFlag = resultUrl.match('[?]') ? '&' : '?';
resultUrl = '' + resultUrl + joinFlag + replaceText;
}
});
return resultUrl;
}
/**
* get url param by name
*
* @since 1.0.0;
* @category string;
* @author jiaguishan;
* @param name {string} param key;
* @return {string};
* @create_date 2018/07/09;
* @modify_date 2018/07/18;
* @example
*
* getUrlParam('token')
* // => '807351-999-1asdni7asdn61621e8'
*/
function getUrlParam(key, originUrl) {
var reg = new RegExp('(^|&)'.concat(key).concat('=([^&]*)(&|$)'), 'i');
originUrl = originUrl ? originUrl.toString() : window.location.href;
var index = originUrl.indexOf('?');
var result = originUrl.substr(index + 1).match(reg);
if (result != null) {
return unescape(result[2]);
}
return '';
}
/**
* Replaces matches for `pattern` in `string` with `replacement`,
* default is not global repalce,
* also 0x00000-0xfffff characters replace.
*
* @since 1.0.0;
* @category string;
* @author fl;
* @param str {string} the first string incoming;
* @param pattern {string|regexp} the second (string|regexp) incoming;
* @param replacement {string} the third string incoming;
* @return {string};
* @create_date 2018/07/06;
* @modify_date 2018/07/06;
* @example
*
* replace('hello world', /o/, 'hi')
* // => 'hellhi world'
*/
function replace() {
var str = "" + (arguments.length <= 0 ? undefined : arguments[0]);
return arguments.length < 3 ? str : str.replace(arguments.length <= 1 ? undefined : arguments[1], arguments.length <= 2 ? undefined : arguments[2]);
}
/**
* Replace global characters,
* also 0x00000-0xfffff characters replace.
*
* @since 1.0.0;
* @category string;
* @author fl2294;
* @param str {string} the first string incoming;
* @param sourcement {string} the second (string|regexp) incoming;
* @param replacement {string} the second string incoming;
* @return {string};
* @create_date 2018/07/06;
* @modify_date 2018/07/06;
* @example
*
* replaceAll('𠮷abcdef𠮷Acdef', /𠮷/, 'k')
* // => 'kabcdefkAcdef'
*/
function replaceAll() {
if (arguments.length < 3) return arguments.length <= 0 ? undefined : arguments[0];
var str = arguments.length <= 0 ? undefined : arguments[0];
var sourcement = arguments.length <= 1 ? undefined : arguments[1];
var replacement = arguments.length <= 2 ? undefined : arguments[2];
var raRegExp = void 0;
var strType = Object.prototype.toString.call(sourcement);
if (strType === '[object RegExp]') {
var _sourcement = sourcement;
if (_sourcement.flags.indexOf('g') <= -1) {
_sourcement = RegExp(_sourcement.source, _sourcement.flags + 'g');
}
raRegExp = _sourcement;
}
if (strType === '[object String]') {
raRegExp = new RegExp(sourcement, 'g');
}
return str.replace(raRegExp, replacement);
}
/**
* Remove specified characters before and after,
* also support 0x00000-0xfffff characters remove.
*
* @since 1.0.0;
* @category string;
* @author fl2294;
* @param str {string} the first string incoming;
* @param chars {string} the second string incoming;
* @return {string};
* @create_date 2018/07/06;
* @modify_date 2018/07/06;
* @example
*
* trim('#sadcdba#s', '#s') trim(' dsa ') trim('𠮷abbb𠮷a', '𠮷a')
* // => 'adcdba' 'dsa' 'bbb'
*/
function trim(str, chars) {
if (str && chars === undefined) {
return str.trim();
}
if (!str || !chars) {
return str;
}
var r = '(^' + chars + ')|(' + chars + '$)';
str = str.replace(new RegExp(r, 'gu'), '');
return str;
}
/**
* All down to uppercase
*
* @since 1.0.0;
* @category string;
* @author fl2294;
* @param str {string} the first string incoming;
* @return {string};
* @create_date 2018/07/06;
* @modify_date 2018/07/06;
* @example
*
* toUpper('aaa')
* // => 'AAA'
*/
function toUpper(str) {
return str.toUpperCase();
}
/**
* All down to lowercase.
*
* @since 1.0.0;
* @category string;
* @author fl2294;
* @param str {string} the first string incoming;
* @return {string};
* @create_date 2018/07/06;
* @modify_date 2018/07/06;
* @example
*
* toLower(’AAA')
* // => 'aaa'
*/
function toLower(str) {
return str.toLowerCase();
}
/**
* Generate UUID, maybe used to render react list;
*
* @since 1.1.0
* @category string;
* @author yhm1694;
* @return { string } uuid;
* @create_date 2018/08/22;
* @modify_date 2018/08/22;
*
* @example
*
* generateUUID();
*
* // => 'af22-3fa8-4028-8dea-30a2'
*/
var generateUUID = function generateUUID() {
var uuid = 'xxxx-xxxx-xxxx-xxxx-xxxx'.replace(/[x]/g, function () {
var randomNum = Math.random() * 16 | 0;
var newChar = randomNum.toString(16);
return newChar;
});
return uuid;
};
/**
* array to unique,
*
* @since 1.1.0;
* @category array;
* @author fl2294;
* @param arr {array} the first array incoming;
* @return {array};
* @create_date 2018/07/19;
* @modify_date 2018/07/19;
* @example
*
* unique([1, 3, 5, 6, 8, 8, 6, 3, [1,2], [1,2], {item: 1, 2: 3}, {item: 1, 2: 3}])
* // => [1, 3, 5, 6, 8, [1,2], {item: 1, 2: 3}]
*/
function unique(arr, iterator) {
var _hash = function _hash(obj) {
var power = 1;
var res = 0;
var string = JSON.stringify(obj, null, 2);
for (var i = 0, l = string.length; i < l; i++) {
switch (string[i]) {
case '{':
power *= 2;
break;
case '}':
power /= 2;
break;
case ' ':
case '\n':
case '\r':
case '\t':
break;
default:
res += string[i].charCodeAt(0) * power;
}
}
return res;
};
var __arr = [];
arr.forEach(function (item) {
if (__arr.some(function (__item) {
return _hash(__item) === _hash(item);
})) return;
__arr.push(item);
});
_hash = null;
if (iterator) {
__arr = __arr.filter(iterator);
}
return __arr;
}
/**
* two of array to union,
*
* @since 1.1.0;
* @category array;
* @author fl2294;
* @param firstArr {array} the first array incoming;
* @param secondArr {array} the second array incoming;
* @return {array};
* @create_date 2018/07/19;
* @modify_date 2018/07/19;
* @example
*
* union([1, 3, 5], [6, 8, 8, 6, 3])
* // => [1, 3, 5, 6, 8]
*/
//并集
function union(firstArr, secondArr) {
return unique(firstArr.concat(secondArr));
}
/**
* find a value in array|string|object,
*
* @since 1.1.0;
* @category array;
* @author fl2294;
* @param collection {array|string|object} the first collection incoming;
* @param value {array} the second value incoming;
* @param fromIndex=0 {array} the three array incoming;
* @return {boolean};
* @create_date 2018/07/19;
* @modify_date 2018/07/19;
* @example
*
* minus([1, 3, 5, 6], [8, 8, 6, 3, 2])
* // => [1, 5]
*/
//查找元素是否在指定集合中
function includes(collection, value) {
var fromIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var _hash = function _hash(obj) {
var power = 1;
var res = 0;
var string = JSON.stringify(obj, null, 2);
for (var i = 0, l = string.length; i < l; i++) {
switch (string[i]) {
case '{':
power *= 2;
break;
case '}':
power /= 2;
break;
case ' ':
case '\n':
case '\r':
case '\t':
break;
default:
res += string[i].charCodeAt(0) * power;
}
}
return res;
};
if (Object.prototype.toString.call(collection) === '[object Array]') {
collection = collection.slice(fromIndex, collection.length);
for (var i = 0, len = collection.length; i < len; i++) {
if (_hash(collection[i]) === _hash(value)) {
return true;
}
}
return false;
}
if (Object.prototype.toString.call(collection) === '[object String]') {
collection = collection.substr(fromIndex);
return collection.indexOf(value) > -1;
}
if (Object.prototype.toString.call(collection) === '[object Object]') {
return collection.hasOwnProperty(value);
}
_hash = null;
return false;
}
/**
* two of array to cross,
*
* @since 1.1.0;
* @category array;
* @author fl2294;
* @param firstArr {array} the first array incoming;
* @param secondArr {array} the second array incoming;
* @return {array};
* @create_date 2018/07/19;
* @modify_date 2018/07/19;
* @example
*
* intersection([1, 3, 5, 6], [8, 8, 6, 3])
* // => [3, 6]
*/
//交集
function intersection(firstArr, secondArr) {
return unique(firstArr).filter(function (o) {
return includes(secondArr, o) ? o : null;
});
}
/**
* two of array to minus,
*
* @since 1.1.0;
* @category array;
* @author fl2294;
* @param firstArr {array} the first array incoming;
* @param secondArr {array} the second array incoming;
* @return {array};
* @create_date 2018/07/19;
* @modify_date 2018/07/19;
* @example
*
* minus([1, 3, 5, 6], [8, 8, 6, 3, 2])
* // => [1, 5]
*/
//差集
function minus(firstArr, secondArr) {
return unique(firstArr).filter(function (o) {
return includes(secondArr, o) ? null : o;
});
}
/**
* indexOf, Find where a specified string value first appears in the string
*
* @since 1.0.0;
* @category array;
* @author jiaguishan;
* @param array {array} origin array;
* @param value {number/string} find value;
* @param fromIndex {number} start number;
* @return {number};
* @create_date 2018/08/27;
* @modify_date 2018/08/27;
* @example
*
* indexOf([1, 2, 1, 2], 2)
* // => 1
*
* // Search from the `fromIndex`
* indexOf([1, 2, 1, 2], 2, 2)
* // => 3
*/
function indexOf(array, value, fromIndex) {
var length = array === null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex ? +fromIndex : 0;
if (index < 0) {
index = Math.max(length + index, 0);
}
index = index - 1;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var js_cookie = createCommonjsModule(function (module, exports) {
(function (factory) {
var registeredInModuleLoader = false;
{
module.exports = factory();
registeredInModuleLoader = true;
}
if (!registeredInModuleLoader) {
var OldCookies = window.Cookies;
var api = window.Cookies = factory();
api.noConflict = function () {
window.Cookies = OldCookies;
return api;
};
}
}(function () {
function extend () {
var i = 0;
var result = {};
for (; i < arguments.length; i++) {
var attributes = arguments[ i ];
for (var key in attributes) {
result[key] = attributes[key];
}
}
return result;
}
function init (converter) {
function api (key, value, attributes) {
var result;
if (typeof document === 'undefined') {
return;
}
// Write
if (arguments.length > 1) {
attributes = extend({
path: '/'
}, api.defaults, attributes);
if (typeof attributes.expires === 'number') {
var expires = new Date();
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
attributes.expires = expires;
}
// We're using "expires" because "max-age" is not supported by IE
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
try {
result = JSON.stringify(value);
if (/^[\{\[]/.test(result)) {
value = result;
}
} catch (e) {}
if (!converter.write) {
value = encodeURIComponent(String(value))
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
} else {
value = converter.write(value, key);
}
key = encodeURIComponent(String(key));
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
key = key.replace(/[\(\)]/g, escape);
var stringifiedAttributes = '';
for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue;
}
stringifiedAttributes += '; ' + attributeName;
if (attributes[attributeName] === true) {
continue;
}
stringifiedAttributes += '=' + attributes[attributeName];
}
return (document.cookie = key + '=' + value + stringifiedAttributes);
}
// Read
if (!key) {
result = {};
}
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling "get()"
var cookies = document.cookie ? document.cookie.split('; ') : [];
var rdecode = /(%[0-9A-Z]{2})+/g;
var i = 0;
for (; i < cookies.length; i++) {
var parts = cookies[i].split('=');
var cookie = parts.slice(1).join('=');
if (!this.json && cookie.charAt(0) === '"') {
cookie = cookie.slice(1, -1);
}
try {
var name = parts[0].replace(rdecode, decodeURIComponent);
cookie = converter.read ?
converter.read(cookie, name) : converter(cookie, name) ||
cookie.replace(rdecode, decodeURIComponent);
if (this.json) {
try {
cookie = JSON.parse(cookie);
} catch (e) {}
}
if (key === name) {
result = cookie;
break;
}
if (!key) {
result[name] = cookie;
}
} catch (e) {}
}
return result;
}
api.set = api;
api.get = function (key) {
return api.call(api, key);
};
api.getJSON = function () {
return api.apply({
json: true
}, [].slice.call(arguments));
};
api.defaults = {};
api.remove = function (key, attributes) {
api(key, '', extend(attributes, {
expires: -1
}));
};
api.withConverter = init;
return api;
}
return init(function () {});
}));
});
/**
* Set Cookie
*
* @since 1.1.0
* @category storage;
* @author caiyue2359;
* @param name {string}
* @param value {string/object}, if value is an object, it will be parsed by JSON.stringify,
* and you can get it as an object using getCookie('key',true)
* @param config {object}, sample:{
* expires:7 {number}, indicating how many days should the cookie expired
* domain:'www.domain.com', {string}, indicating a valid domain where the cookie should be visible. The cookie will also be visible to all subdomains.
* path:'/cookie/path', {string}, indicating the path where the cookie is visible.
* secure:true {boolean}, indicating if the cookie transmission requires a secure protocol (https)
* }
* @create_date 2018/08/27;
* @modify_date 2018/08/27;
*
* @example
*
* setCookie('name','value');
*
*/
var setCookie = function setCookie(name, value, config) {
js_cookie.set.call(null, name, value, config);
};
/**
* Get Cookie
*
* @since 1.1.0
* @category storage;
* @author caiyue2359;
* @param name, {string} cookie name
* @param isObject, {boolean} is the return an object,using JSON.parse
* @return value;
* @create_date 2018/08/27;
* @modify_date 2018/08/27;
*
* @example
*
* getCookie('name');
*
* // => 'value'
*/
var getCookie = function getCookie(name, isObject) {
if (isObject) {
try {
return js_cookie.getJSON(name);
} catch (e) {
return null;
}
} else {
return js_cookie.get(name);
}
};
/**
* Remove Cookie
*
* @since 1.1.0
* @category storage;
* @author caiyue2359;
* @param name {string}
* @param config {object}, sample:{
* domain:'www.domain.com', {string}, indicating a valid domain where the cookie should be visible. The cookie will also be visible to all subdomains.
* path:'/cookie/path', {string}, indicating the path where the cookie is visible.
* }
* IMPORTANT! when deleting a cookie, you must pass the exact same path and domain attributes that was used to set the cookie.
*
* @create_date 2018/08/27;
* @modify_date 2018/08/27;
*
* @example
*
* removeCookie('name',{path:'/the/correct/cookie/path'});
*/
var removeCookie = function removeCookie(name, config) {
js_cookie.remove.call(null, name, config);
};
/**
* Find the maximum value from the array;
*
* @since 1.2.0
* @category Math;
* @author yhm1694;
* @param { Array } array: The array to search;
* @return { String | Number } result: The maximum value;
* @create_date 2018/09/10;
* @modify_date 2018/09/10;
*
* @example
*
* max([1, 2, 3, 4]);
*
* // => 4
*/
var max = function max(array) {
var result = void 0;
if (!array || !Array.isArray(array) || array.length === 0) {
return result;
}
result = array.sort().reverse()[0];
return result;
};
/**
* Has
*
* @since 1.2.0
* @category object;
* @author caiyue;
* @param obj {object}
* @param path {string}
* @create_date 2018/09/18;
* @create_date 2018/09/18;
*
* @example
*
* has({a:{b:1}},'a.b');
* /=> true;
*
*/
var has = function has(obj, path) {
var attrList = path.split('.');
var temp = obj,
attr = '';
for (var i = 0; i < attrList.length; i++) {
attr = attrList[i];
if (!temp.hasOwnProperty(attr)) {
return false;
} else {
temp = temp[attr];
}
}
return true;
};
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
/**
* isEmpty
*
* @since 1.2.0
* @category object;
* @author caiyue;
* @param target {object}
* @create_date 2018/09/18;
* @create_date 2018/09/18;
*
* @example
*
* isEmpty([])
* /=> true;
*
*/
var isEmpty = function isEmpty(target) {
if (!!target === false) {
// null/undefined/''/0
return true;
} else if (Array.isArray(target)) {
// array
return target.length === 0;
} else if (typeof target[Symbol.iterator] === 'function') {
//iterable obj
return target[Symbol.iterator]().next().done;
} else if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object') {
//simple obj
return Object.getOwnPropertyNames(target).length === 0;
} else {
//basic true data type.
return false;
}
};
/**
* isEqual
*
* Performs an optimized deep comparison between the two objects,
* to determine if they should be considered equal.
*
* @since 1.2.0;
* @category string;
* @author jiaguishan;
* @param value {any} first value;
* @param other {any} second value;
* @return {boolean};
* @create_date 2018/09/11;
* @modify_date 2018/09/11;
* @example
*
* isEqual(1, null)
* // => false
*
*/
function isEqual(value, other) {
var isFunction = function isFunction(obj) {
return typeof obj === 'function' || false;
};
var has = function has(obj, path) {
return obj !== null && Object.hasOwnProperty.call(obj, path);
};
var deepEq = function deepEq(value, other) {
var toString = Object.prototype.toString;
var className = toString.call(value);
var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
if (className !== toString.call(other)) {
return false;
}
switch (className) {
case '[object RegExp]':
case '[object String]':
return '' + value === '' + other;
case '[object Number]':
if (+value !== +value) {
return +other !== +other;
}
return +value === 0 ? 1 / +value === 1 / other : +value === +other;
case '[object Date]':
case '[object Boolean]':
return +value === +other;
case '[object Symbol]':
return SymbolProto.valueOf.call(value) === SymbolProto.valueOf.call(other);
}
var areArrays = className === '[object Array]';
if (!areArrays) {
if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object' || (typeof other === 'undefined' ? 'undefined' : _typeof(other)) !== 'object') {
return false;
}
var valueCtor = value.constructor,
otherCtor = other.constructor;
if (valueCtor !== otherCtor && !(isFunction(valueCtor) && valueCtor instanceof valueCtor && isFunction(otherCtor) && otherCtor instanceof otherCtor) && 'constructor' in value && 'constructor' in other) {
return false;
}
}
if (areArrays) {
var length = value.length;
if (length !== other.length) {
return false;
}
while (length--) {
if (!eq(value[length], other[length])) {
return false;
}
}
} else {
var keys = Object.keys(value);
var _length = keys.length;
var key = void 0;
if (Object.keys(other).length !== _length) {
return false;
}
while (_length--) {
key = keys[_length];
if (!(has(other, key) && eq(value[key], other[key]))) {
return false;
}
}
}
return true;
};
var eq = function eq(value, other) {
if (value === other) {
return value !== 0 || 1 / value === 1 / other;
}
if (value === null || other === null) {
return false;
}
if (value !== value) {
return other !== other;
}
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
if (type !== 'function' && type !== 'object' && (typeof other === 'undefined' ? 'undefined' : _typeof(other)) !== 'object') {
return false;
}
return deepEq(value, other);
};
return eq(value, other);
}
/**
* isElement, Determine if the target value is a dom element
*
* @since 1.2.0;
* @category string;
* @author jiaguishan;
* @param any {any} value to be judged;
* @return {boolean};
* @create_date 2018/09/11;
* @modify_date 2018/09/11;
* @example
*
* isElement(document.getElementById('body'))
* // => true
*
*/
function isElement(element) {
return !!(element && element.nodeType === 1);
}
/**
* getStylePrefix
*
* Return different style prefixes according to different browsers
*
* @since 1.2.0;
* @category string;
* @author jiaguishan;
* @param propertyKey {string} css property;
* @param isConcat {boolean} prefix and property is concat;
* @return {string} prefix;
* @create_date 2018/10/09;
* @modify_date 2018/10/09;
* @example
*
* getStylePrefix('transform')
* // => '-webkit-transform'
*
* getStylePrefix('transform', false)
* // => '-webkit-'
*
*/
function getStylePrefix(propertyKey) {
var isConcat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var style = document.body.style;
var isSupport = false;
var prefix = '',
result = '';
if (style[propertyKey] !== undefined) {
prefix = '';
isSupport = true;
} else if (style['-webkit-' + propertyKey] !== undefined) {
prefix = '-webkit-';
isSupport = true;
} else if (style['-moz-' + propertyKey] !== undefined) {
prefix = '-moz-';
isSupport = true;
} else if (style['-ms-' + propertyKey] !== undefined) {
prefix = '-ms-';
isSupport = true;
} else if (style['-o-' + propertyKey] !== undefined) {
prefix = '-o-';
isSupport = true;
} else {
prefix = '';
}
var tmpVal = isSupport ? propertyKey : '';
result = isConcat ? prefix + tmpVal : tmpVal;
return result;
}
/**
* Find the minimum value from the array;
*
* @since 1.2.0
* @category Math;
* @author yhm1694;
* @param { Array } array: The array to search;
* @return { String | Number } result: The minimum value;
* @create_date 2018/09/11;
* @modify_date 2018/09/11;
*
* @example
*
* min([1, 2, 3, 4]);
*
* // => 1
*
* min(['A', 'B', 'C']);
*
* // => 'A'
*/
var min = function min(array) {
var result = void 0;
if (!array || !Array.isArray(array) || array.length === 0) {
return result;
}
result = array.sort()[0];
return result;
};
/**
* Get the current timestamp;
*
* @since 1.2.0
* @category Date;
* @author yhm1694;
* @return { Number } timestamp: Current timestamp;
* @create_date 2018/09/11;
* @modify_date 2018/09/11;
*
* @example
*
* now();
*
* // => 1536659540425
*/
var now = function now() {
return Date.now();
};
/**
* Transform the date to timestamp;
*
* @since 1.2.0
* @category Date;
* @author yhm1694;
* @param { Date | String | number } date: The date to be transformed;
* @return { Number } timestamp: The timestamp;
* @create_date 2018/09/20;
* @modify_date 2018/09/20;
*
* @example
*
* toTimestamp(new Date());
* // => 1536659540425;
*
* toTimestamp('2018-09-09');
* // => 1536451200000;
*
* toTimestamp(1536422400000);
* // => 1536451200000;
*/
var toTimestamp = function toTimestamp(date) {
return new Date(date).getTime();
};
var index = {
dateFormat: dateFormat,
setUrlParam: setUrlParam,
getUrlParam: getUrlParam,
replaceAll: replaceAll,
replace: replace,
trim: trim,
toUpper: toUpper,
toLower: toLower,
generateUUID: generateUUID,
union: union,
intersection: intersection,
minus: minus,
unique: unique,
indexOf: indexOf,
setCookie: setCookie,
getCookie: getCookie,
removeCookie: removeCookie,
max: max,
has: has,
isEmpty: isEmpty,
isEqual: isEqual,
isElement: isElement,
getStylePrefix: getStylePrefix,
min: min,
now: now,
toTimestamp: toTimestamp
};
return index;
})));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.EUtils=t()}(this,function(){"use strict";function n(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=function(e){for(var t=1,n=0,r=JSON.stringify(e,null,2),o=0,i=r.length;o<i;o++)switch(r[o]){case"{":t*=2;break;case"}":t/=2;break;case" ":case"\n":case"\r":case"\t":break;default:n+=r[o].charCodeAt(0)*t}return n};if("[object Array]"!==Object.prototype.toString.call(e))return"[object String]"===Object.prototype.toString.call(e)?-1<(e=e.substr(n)).indexOf(t):"[object Object]"===Object.prototype.toString.call(e)?e.hasOwnProperty(t):(r=null,!1);for(var o=0,i=(e=e.slice(n,e.length)).length;o<i;o++)if(r(e[o])===r(t))return!0;return!1}function r(e,t){var n=function(e){for(var t=1,n=0,r=JSON.stringify(e,null,2),o=0,i=r.length;o<i;o++)switch(r[o]){case"{":t*=2;break;case"}":t/=2;break;case" ":case"\n":case"\r":case"\t":break;default:n+=r[o].charCodeAt(0)*t}return n},r=[];return e.forEach(function(t){r.some(function(e){return n(e)===n(t)})||r.push(t)}),n=null,t&&(r=r.filter(t)),r}var e,o=(function(e,t){var n;n=function(){function v(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}return function e(d){function g(e,t,n){var r;if("undefined"!=typeof document){if(1<arguments.length){if("number"==typeof(n=v({path:"/"},g.defaults,n)).expires){var o=new Date;o.setMilliseconds(o.getMilliseconds()+864e5*n.expires),n.expires=o}n.expires=n.expires?n.expires.toUTCString():"";try{r=JSON.stringify(t),/^[\{\[]/.test(r)&&(t=r)}catch(e){}t=d.write?d.write(t,e):encodeURIComponent(String(t)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=(e=(e=encodeURIComponent(String(e))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var i="";for(var u in n)n[u]&&(i+="; "+u,!0!==n[u]&&(i+="="+n[u]));return document.cookie=e+"="+t+i}e||(r={});for(var c=document.cookie?document.cookie.split("; "):[],f=/(%[0-9A-Z]{2})+/g,a=0;a<c.length;a++){var l=c[a].split("="),s=l.slice(1).join("=");this.json||'"'!==s.charAt(0)||(s=s.slice(1,-1));try{var p=l[0].replace(f,decodeURIComponent);if(s=d.read?d.read(s,p):d(s,p)||s.replace(f,decodeURIComponent),this.json)try{s=JSON.parse(s)}catch(e){}if(e===p){r=s;break}e||(r[p]=s)}catch(e){}}return r}}return(g.set=g).get=function(e){return g.call(g,e)},g.getJSON=function(){return g.apply({json:!0},[].slice.call(arguments))},g.defaults={},g.remove=function(e,t){g(e,"",v(t,{expires:-1}))},g.withConverter=e,g}(function(){})},e.exports=n()}(e={exports:{}},e.exports),e.exports);var i=function(e,t,n,r){for(var o=t.split("."),i=e,u="",c=0;c<o.length;c++){if(u=o[c],!i.hasOwnProperty(u))return n;i=i[u]}return void 0!==r?r:i},p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var t="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t};var u=function(e){return"[object Array]"===Object.prototype.toString.call(e)};return{dateFormat:function(e,t){if(!t)return e;var n=t,r={"M+":(e=new Date(e)).getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()},o=Object.keys(r);return/(y+)/.test(t)&&(n=t.replace(RegExp.$1,(""+e.getFullYear()).substr(4-RegExp.$1.length))),o.forEach(function(e){new RegExp("("+e+")").test(t)&&(n=n.replace(RegExp.$1,1===RegExp.$1.length?r[e]:("00"+r[e]).substr((""+r[e]).length)))}),n},setUrlParam:function(e){for(var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:window.location.href,t=Object.keys(e),n=t.length,r=[];n--;)r[n]=[t[n],e[t[n]]];return r.forEach(function(e){var t=e[0],n=e[1],r=new RegExp("(^|)"+t+"=([^&]*)(|$)"),o=t+"="+n;if(c.match(r)){var i=new RegExp("("+t+"=)([^&]*)","gi");c=c.replace(i,o)}else{var u=c.match("[?]")?"&":"?";c=""+c+u+o}}),c},getUrlParam:function e(t,n){var r=new RegExp("(^|&)".concat(t).concat("=([^&]*)(&|$)"),"i"),o=(n=n?n.toString():window.location.href).indexOf("?"),i=n.substr(o+1);if(-1!==i.indexOf("?"))return e(t,i);var u=i.match(r);return null!=u?unescape(u[2]):""},replaceAll:function(){if(arguments.length<3)return arguments.length<=0?void 0:arguments[0];var e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],n=arguments.length<=2?void 0:arguments[2],r=void 0,o=Object.prototype.toString.call(t);if("[object RegExp]"===o){var i=t;i.flags.indexOf("g")<=-1&&(i=RegExp(i.source,i.flags+"g")),r=i}return"[object String]"===o&&(r=new RegExp(t,"g")),e.replace(r,n)},replace:function(){var e=""+(arguments.length<=0?void 0:arguments[0]);return arguments.length<3?e:e.replace(arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])},trim:function(e,t){if(e&&void 0===t)return e.trim();if(!e||!t)return e;var n="(^"+t+")|("+t+"$)";return e=e.replace(new RegExp(n,"gu"),"")},toUpper:function(e){return e.toUpperCase()},toLower:function(e){return e.toLowerCase()},generateUUID:function(){return"xxxx-xxxx-xxxx-xxxx-xxxx".replace(/[x]/g,function(){return(16*Math.random()|0).toString(16)})},union:function(e,t){return r(e.concat(t))},intersection:function(e,t){return r(e).filter(function(e){return n(t,e)?e:null})},includes:n,difference:function(e,t){return r(e).filter(function(e){return n(t,e)?null:e})},unique:r,indexOf:function(e,t,n){var r=null===e?0:e.length;if(!r)return-1;var o=n?+n:0;for(o<0&&(o=Math.max(r+o,0)),o-=1;++o<r;)if(e[o]===t)return o;return-1},setCookie:function(e,t,n){o.set.call(null,e,t,n)},getCookie:function(e,t){if(!t)return o.get(e);try{return o.getJSON(e)}catch(e){return null}},removeCookie:function(e,t){o.remove.call(null,e,t)},max:function(e){var t=void 0;return e&&Array.isArray(e)&&0!==e.length?t=e.sort().reverse()[0]:t},has:function(e,t){return i(e,t,!1,!0)},isEmpty:function(e){return 0==!!e||(Array.isArray(e)?0===e.length:"function"==typeof e[Symbol.iterator]?e[Symbol.iterator]().next().done:"object"===(void 0===e?"undefined":p(e))&&0===Object.getOwnPropertyNames(e).length)},isEqual:function(e,t){var s=function(e,t){if(e===t)return e===t;if(null===e||null===t)return!1;if(e!=e)return t!=t;var n=void 0===e?"undefined":p(e);return("function"===n||"object"===n||"object"===(void 0===t?"undefined":p(t)))&&function(e,t){var n=Object.prototype.toString,r=n.call(e);if(r!==n.call(t))return!1;switch(r){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Date]":case"[object Boolean]":return+e==+t}var o,i,u="[object Array]"===r;if(!u&&("object"!==(void 0===e?"undefined":p(e))||"object"!==(void 0===t?"undefined":p(t))))return!1;if(u){var c=e.length;if(c!==t.length)return!1;for(;c--;)if(!s(e[c],t[c]))return!1}else{var f=Object.keys(e),a=f.length,l=void 0;if(Object.keys(t).length!==a)return!1;for(;a--;)if(l=f[a],i=l,null===(o=t)||!Object.hasOwnProperty.call(o,i)||!s(e[l],t[l]))return!1}return!0}(e,t)};return s(e,t)},isElement:function(e){return!(!e||1!==e.nodeType)},position:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";return"left"===t.toLowerCase()?e.offsetLeft:"top"===t.toLowerCase()?e.offsetTop:{top:e.offsetTop,left:e.offsetLeft}},scrollTop:function(e,t){var n,r=void 0;if(null!=(n=e)&&n===n.window?r=e:9===e.nodeType&&(r=e.defaultView),void 0===t)return r?r.pageYOffset:e.scrollTop;r?r.scrollTo(r.pageXOffset,t):e.scrollTop=t},getStylePrefix:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=document.body.style,r=!1,o="";void 0!==n[e]?r=!(o=""):void 0!==n["-webkit-"+e]?(o="-webkit-",r=!0):void 0!==n["-moz-"+e]?(o="-moz-",r=!0):void 0!==n["-ms-"+e]?(o="-ms-",r=!0):void 0!==n["-o-"+e]?(o="-o-",r=!0):o="";var i=r?e:"";return t?o+i:i},min:function(e){var t=void 0;return e&&Array.isArray(e)&&0!==e.length?t=e.sort()[0]:t},now:function(){return Date.now()},toTimestamp:function(e){return new Date(e).getTime()},keys:function(e){if(null===e||"object"!==(void 0===e?"undefined":p(e)))return[];var t=[];for(var n in e)t.push(n);return t},isDate:function(e){return"[object Date]"===toString.call(e)},clone:function(e){return t({},e)},get:i,debounce:function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");var n=void 0;function r(){clearTimeout(n)}function o(){n&&r(),n=setTimeout(e,t)}return o.cancel=r,o},throttle:function(t,n){if("function"!=typeof t)throw new TypeError("Expected a function");var r=void 0,o=0;function e(){var e=Date.now();if(o||(o=e),n<=e-o)return t(),void(o=0);clearTimeout(r),r=setTimeout(function(){t(),o=0},n)}return e.cancel=function(){clearTimeout(r),o=0},e},sum:function(e){return null!=e&&e.length?function(e,t){var n=void 0,r=e,o=Array.isArray(r),i=0;for(r=o?r:r[Symbol.iterator]();;){var u;if(o){if(i>=r.length)break;u=r[i++]}else{if((i=r.next()).done)break;u=i.value}var c=t(u);void 0!==c&&(n=void 0===n?c:n+c)}return n}(e,function(e){return e}):0},first:function(e){return null!=e&&e.length?e[0]:void 0},last:function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0},isString:function(e){return"string"==typeof e},isNumber:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},querySelector:function(e,t){return(!t||1!==t.nodeType&&9!==t.nodeType)&&(t=document),e&&"string"==typeof e?t.querySelector(e):null},attr:function(e,t){return e&&1===e.nodeType&&"string"==typeof t?e.getAttribute(t):null},rest:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;if(u(e))return t<=0&&(t=1),e.slice(t)},isArray:u,isObject:function(e){var t=void 0===e?"undefined":p(e);return"function"===t||"object"===t&&!!e}}});
//# sourceMappingURL=eUtils.min.js.map
{
"name": "@ewt/eutils",
"version": "1.2.0",
"version": "1.3.0",
"description": "EUtils -- Ewt front end generic methods library!",

@@ -29,2 +29,3 @@ "main": "dist/eUtils.min.js",

"jsdom": "^12.0.0",
"rimraf": "^2.6.2",
"rollup": "^0.64.0",

@@ -31,0 +32,0 @@ "rollup-plugin-babel": "^3.0.7",

@@ -5,3 +5,3 @@ # EUtils

## 一、安装
1. 直接引入eUtils.min.js
### 1. 直接引入eUtils.min.js
``` html

@@ -14,52 +14,50 @@ <script src="eUtils.min.js"></script>

2. npm/yarn安装
```
npm install @ewt/eutils
```
### 2. npm/yarn安装
npm install @ewt/eutils
## 二、使用
1. 整包引用
```
import EUtils from '@ewt/eutils';
### 1. 整包引用
import EUtils from '@ewt/eutils';
const demo = EUtils.test();
```
2. 引用具体某一函数
```
import { test } from '@ewt/eutils';
const demo = EUtils.test();
### 2. 引用具体某一函数
import { test } from '@ewt/eutils';
const demo = test();
```
const demo = test();
## 三、TODO
1. 按需打包技术开发;
2. 注释转markdown文档技术开发;
3. eslint代码规范调整;
4. 开发模式下的代码调试优化;
1. 按需打包技术开发;
2. 注释转markdown文档技术开发;
3. eslint代码规范调整;
4. 开发模式下的代码调试优化;
## 四、文档
<a href="https://github.com/E-Utils/documents">文档地址</a>
<a href="https://e-utils.github.io/eutils-doc/#/standard">规范文档</a>&nbsp;&nbsp;
<a href="https://e-utils.github.io/eutils-doc/#/manual">官方使用文档</a>
## 五、客户端按需打包配置
## 五、客户端按需打包配置
客户端工程中引入时,为了减小最终打包后的包体积,可引入按需打包技术,工程最终只会将你项目中用到的方法打包,未引用的方法将不会被打入最终的目标文件,配置方法如下:
### 1. 安装依赖
```
为了实现按需打包,引入插件:babel-plugin-import
为了实现按需打包,引入插件:babel-plugin-import
npm install --save-dev babel-plugin-import
```
npm install --save-dev babel-plugin-import
### 2. 配置.babelrc
```
{
"plugins":[["import",
{
"libraryName": "@ewt/eutils",
"libraryDirectory": "src",
"camel2DashComponentName": false,
"camel2UnderlineComponentName": false,
}
]]
}
```
{
"plugins":[["import",
{
"libraryName": "@ewt/eutils",
"libraryDirectory": "src",
"camel2DashComponentName": false,
"camel2UnderlineComponentName": false,
}
]]
}
## 六.仓库地址
eutils官网: http://eutils.mistong.com/
github 开发|doc地址: https://github.com/E-Utils
gitlab 开发地址:http://git.mistong.com/commonjs/e-utils
gitlab doc地址:http://git.mistong.com/commonjs/eutils-doc

@@ -26,17 +26,17 @@ /**

let isSupport = false;
let prefix = '',
result = '';
let prefix = '', result = '';
if (style[propertyKey] !== undefined) {
prefix = '';
isSupport = true;
} else if (style['-webkit-' + propertyKey] !== undefined) {
} else if (style[`-webkit-${propertyKey}`] !== undefined) {
prefix = '-webkit-';
isSupport = true;
} else if (style['-moz-' + propertyKey] !== undefined) {
} else if (style[`-moz-${propertyKey}`] !== undefined) {
prefix = '-moz-';
isSupport = true;
} else if (style['-ms-' + propertyKey] !== undefined) {
} else if (style[`-ms-${propertyKey}`] !== undefined) {
prefix = '-ms-';
isSupport = true;
} else if (style['-o-' + propertyKey] !== undefined) {
} else if (style[`-o-${propertyKey}`] !== undefined) {
prefix = '-o-';

@@ -43,0 +43,0 @@ isSupport = true;

@@ -20,5 +20,7 @@ /**

const index = originUrl.indexOf('?');
const result = originUrl
.substr(index + 1)
.match(reg);
let tmpUrl = originUrl.substr(index + 1);
if (tmpUrl.indexOf('?') !== -1) {
return getUrlParam(key, tmpUrl);
}
const result = tmpUrl.match(reg);
if (result != null) {

@@ -25,0 +27,0 @@ return unescape(result[2]);

@@ -10,3 +10,2 @@ /**

* @create_date 2018/09/18;
* @create_date 2018/09/18;
*

@@ -19,14 +18,6 @@ * @example

*/
import get from './get';
const has = (obj, path) => {
const attrList = path.split('.');
let temp = obj, attr = '';
for (let i = 0; i < attrList.length; i++) {
attr = attrList[i];
if (!temp.hasOwnProperty(attr)) {
return false;
} else {
temp = temp[attr];
}
}
return true;
return get(obj, path, false, true);
};

@@ -33,0 +24,0 @@

@@ -15,3 +15,3 @@ /**

*
* minus([1, 3, 5, 6], [8, 8, 6, 3, 2])
* difference([1, 3, 5, 6], [8, 8, 6, 3, 2])
* // => [1, 5]

@@ -18,0 +18,0 @@ */

@@ -6,2 +6,3 @@ import dateFormat from './dateFormat';

import replaceAll from './replaceAll';
import includes from './includes';
import trim from './trim';

@@ -13,3 +14,3 @@ import toUpper from './toUpper';

import intersection from './intersection';
import minus from './minus';
import difference from './difference';
import unique from './unique';

@@ -20,2 +21,8 @@ import indexOf from './indexOf';

import removeCookie from './removeCookie';
// EUtils 三期;
import toTimestamp from './toTimestamp';
import getStylePrefix from './getStylePrefix';
import min from './min';
import now from './now';
import max from './max';

@@ -26,7 +33,23 @@ import has from './has';

import isElement from './isElement';
import getStylePrefix from './getStylePrefix';
import min from './min';
import now from './now';
import toTimestamp from './toTimestamp';
import scrollTop from './scrollTop';
import position from './position';
// EUtils 四期;
import sum from './sum';
import first from './first';
import last from './last';
import isDate from './isDate';
import keys from './keys';
import clone from './clone';
import get from './get';
import debounce from './debounce';
import throttle from './throttle';
import isString from './isString';
import isNumber from './isNumber';
import attr from './attr';
import querySelector from './querySelector';
import isArray from './isArray';
import isObject from './isObject';
import rest from './rest';
export default {

@@ -44,3 +67,4 @@ dateFormat,

intersection,
minus,
includes,
difference,
unique,

@@ -56,2 +80,4 @@ indexOf,

isElement,
position,
scrollTop,
getStylePrefix,

@@ -61,2 +87,18 @@ min,

toTimestamp,
keys,
isDate,
clone,
get,
debounce,
throttle,
sum,
first,
last,
isString,
isNumber,
querySelector,
attr,
rest,
isArray,
isObject
};

@@ -17,2 +17,3 @@ /**

*/
const isEmpty = (target) => {

@@ -19,0 +20,0 @@ if (!!target === false) {

@@ -22,6 +22,2 @@ /**

function isEqual(value, other) {
const isFunction = (obj) => {
return typeof obj === 'function' || false;
};
const has = (obj, path) => {

@@ -33,3 +29,2 @@ return obj !== null && Object.hasOwnProperty.call(obj, path);

const className = toString.call(value);
const SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
if (className !== toString.call(other)) {

@@ -42,12 +37,5 @@ return false;

return '' + value === '' + other;
case '[object Number]':
if (+value !== +value) {
return +other !== +other;
}
return +value === 0 ? 1 / +value === 1 / other : +value === +other;
case '[object Date]':
case '[object Boolean]':
return +value === +other;
case '[object Symbol]':
return SymbolProto.valueOf.call(value) === SymbolProto.valueOf.call(other);
}

@@ -59,7 +47,2 @@ const areArrays = className === '[object Array]';

}
let valueCtor = value.constructor,
otherCtor = other.constructor;
if (valueCtor !== otherCtor && !(isFunction(valueCtor) && valueCtor instanceof valueCtor && isFunction(otherCtor) && otherCtor instanceof otherCtor) && ('constructor' in value && 'constructor' in other)) {
return false;
}
}

@@ -95,3 +78,3 @@ if (areArrays) {

if (value === other) {
return value !== 0 || 1 / value === 1 / other;
return value === other;
}

@@ -98,0 +81,0 @@ if (value === null || other === null) {

@@ -21,3 +21,3 @@ /**

import baseSum from './.internal/baseSum';
import baseSum from './internal/baseSum';

@@ -24,0 +24,0 @@ const sum = (array) => {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc