Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

celia

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

celia - npm Package Compare versions

Comparing version 7.0.1 to 8.0.0-beta.1

index.cjs.js

792

index.js

@@ -1,146 +0,656 @@

/* celia.js v7.0.1 (c) 2018-2020 Jesse Feng Released under the MIT License. */
'use strict';
/* celia.js v8.0.0-beta.1 (c) 2018-2020 Jesse Feng Released under the MIT License. */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.celia = {}));
}(this, (function (exports) { 'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function isFunction (value) {
return typeof value === 'function';
}
var assert = require('./assert.js');
var className = require('./className.js');
var classNames = require('./classNames.js');
var isNil = require('./isNil.js');
var isFunction = require('./isFunction.js');
var isNumber = require('./isNumber.js');
var isArrayLike = require('./isArrayLike.js');
var _forEach = require('./_forEach.js');
var _forOwn = require('./_forOwn.js');
var _forNumber = require('./_forNumber.js');
var each = require('./each.js');
var isObject = require('./isObject.js');
var uid = require('./uid.js');
var easyHash = require('./easyHash.js');
var hasOwn = require('./hasOwn.js');
var _iterate = require('./_iterate.js');
var _assign = require('./_assign.js');
var assign = require('./assign.js');
var looseClone = require('./looseClone.js');
var isDate = require('./isDate.js');
var isRegExp = require('./isRegExp.js');
var looseEqual = require('./looseEqual.js');
var _append = require('./_append.js');
var map = require('./map.js');
var noop = require('./noop.js');
var sleep = require('./sleep.js');
var toString = require('./toString.js');
var transform = require('./transform.js');
var _loop = require('./_loop.js');
var _flatten = require('./_flatten.js');
var flat = require('./flat.js');
var deepFlat = require('./deepFlat.js');
var _transIndex = require('./_transIndex.js');
var forEach = require('./forEach.js');
var _removeAt = require('./_removeAt.js');
var _remove = require('./_remove.js');
var remove = require('./remove.js');
var removeAt = require('./removeAt.js');
var _some = require('./_some.js');
var afterCall = require('./afterCall.js');
var aroundCall = require('./aroundCall.js');
var beforeCall = require('./beforeCall.js');
var debounce = require('./debounce.js');
var isAbsoluteURL = require('./isAbsoluteURL.js');
var isAsyncFunction = require('./isAsyncFunction.js');
var isBoolean = require('./isBoolean.js');
var isFalsy = require('./isFalsy.js');
var _isInteger = require('./_isInteger.js');
var isInteger = require('./isInteger.js');
var isLeapYear = require('./isLeapYear.js');
var isPlainObject = require('./isPlainObject.js');
var isPromiseLike = require('./isPromiseLike.js');
var isString = require('./isString.js');
var isUndefined = require('./isUndefined.js');
var isValidDate = require('./isValidDate.js');
var isWindow = require('./isWindow.js');
var forOwn = require('./forOwn.js');
var alias = require('./alias.js');
var deepAssign = require('./deepAssign.js');
var _forIn = require('./_forIn.js');
var forIn = require('./forIn.js');
var _ore = require('./_ore.js');
var _get = require('./_get.js');
var get = require('./get.js');
var set = require('./set.js');
var camelize = require('./camelize.js');
var capitalize = require('./capitalize.js');
var pathJoin = require('./pathJoin.js');
var stringFormat = require('./stringFormat.js');
function isNumber (value) {
return typeof value === 'number';
}
function isArrayLike (value) {
return !!value && isNumber(value.length) && !isFunction(value);
}
function forEach (value, start, end, iterator) {
for (; start < end; start++) {
if (iterator(value[start], start, value) === false) {
break;
}
}
}
exports.assert = assert;
exports.className = className;
exports.classNames = classNames;
exports.isNil = isNil;
exports.isFunction = isFunction;
exports.isNumber = isNumber;
exports.isArrayLike = isArrayLike;
exports._forEach = _forEach;
exports._forOwn = _forOwn;
exports._forNumber = _forNumber;
exports.each = each;
exports.isObject = isObject;
exports.uid = uid;
exports.easyHash = easyHash;
exports.hasOwn = hasOwn;
exports._iterate = _iterate;
exports._assign = _assign;
exports.assign = assign;
exports.looseClone = looseClone;
exports.isDate = isDate;
exports.isRegExp = isRegExp;
exports.looseEqual = looseEqual;
exports._append = _append;
exports.map = map;
exports.noop = noop;
exports.sleep = sleep;
exports.toString = toString;
exports.transform = transform;
exports._loop = _loop;
exports._flatten = _flatten;
exports.flat = flat;
exports.deepFlat = deepFlat;
exports._transIndex = _transIndex;
exports.forEach = forEach;
exports._removeAt = _removeAt;
exports._remove = _remove;
exports.remove = remove;
exports.removeAt = removeAt;
exports._some = _some;
exports.afterCall = afterCall;
exports.aroundCall = aroundCall;
exports.beforeCall = beforeCall;
exports.debounce = debounce;
exports.isAbsoluteURL = isAbsoluteURL;
exports.isAsyncFunction = isAsyncFunction;
exports.isBoolean = isBoolean;
exports.isFalsy = isFalsy;
exports._isInteger = _isInteger;
exports.isInteger = isInteger;
exports.isLeapYear = isLeapYear;
exports.isPlainObject = isPlainObject;
exports.isPromiseLike = isPromiseLike;
exports.isString = isString;
exports.isUndefined = isUndefined;
exports.isValidDate = isValidDate;
exports.isWindow = isWindow;
exports.forOwn = forOwn;
exports.alias = alias;
exports.deepAssign = deepAssign;
exports._forIn = _forIn;
exports.forIn = forIn;
exports._ore = _ore;
exports._get = _get;
exports.get = get;
exports.set = set;
exports.camelize = camelize;
exports.capitalize = capitalize;
exports.pathJoin = pathJoin;
exports.stringFormat = stringFormat;
function append (arr, obj) {
arr[arr.length] = obj;
}
function flatten(arr, result, depth) {
forEach(arr, 0, arr.length, function (n) {
if (depth > 0) {
if (isArrayLike(n)) {
flatten(n, result, --depth);
} else {
append(result, n);
}
} else {
if (isArrayLike(n)) {
forEach(n, 0, n.length, function (m) {
append(result, m);
});
} else {
append(result, n);
}
}
});
return result;
}
function flatten$1 (arr, depth) {
if (arr) {
return arr.flat
? arr.flat(depth || 1)
: flatten(arr, [], depth || 1);
}
return [];
}
function deepFlat (arr) {
return flatten$1(arr, Infinity);
}
function max(a, b) {
return a > b ? a : b;
}
function transIndex (fromIndex, length) {
return fromIndex < 0 ? max(0, length + fromIndex) : fromIndex;
}
function forEach$1 (value, start, end, iterator) {
if (value) {
var len = value.length;
if (isFunction(start)) {
iterator = start;
start = 0;
end = len;
} else if (isFunction(end)) {
iterator = end;
end = len;
start = transIndex(start, len);
} else {
start = transIndex(start, len);
end = transIndex(end, len);
}
forEach(value, start, end, iterator);
}
}
function removeAt (elems, index) {
return elems.splice(index, 1)[0] || null;
}
function remove (elems, value) {
var index = elems.indexOf(value);
if (index > -1) {
return removeAt(elems, index);
}
return null;
}
var isArray = Array.isArray;
function remove$1 (elems, value) {
if (isArray(elems)) {
return remove(elems, value);
}
return null;
}
var isArray$1 = Array.isArray;
function removeAt$1 (elems, index) {
if (isArray$1(elems)) {
return removeAt(elems, index);
}
return null;
}
var PROTOCOL = /^([a-z][a-z\d+\-.]*:)?\/\//i;
function isAbsoluteURL (url) {
return PROTOCOL.test(url);
}
var toString = Object.prototype.toString;
function isAsyncFunction (value) {
return toString.call(value) === '[object AsyncFunction]';
}
function isBoolean (value) {
return typeof value === 'boolean';
}
function isDate (value) {
return value instanceof Date;
}
var FALSY = [false, null, undefined, 0, ''];
function isFalsy (bool) {
return FALSY.indexOf(bool) !== -1 || !bool;
}
function _isInteger (value) {
return isNumber(value) &&
isFinite(value) &&
(value >> 0) === value;
}
var isInteger = Number.isInteger || _isInteger;
function isLeapYear (year) {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
}
function isNil (value) {
/* eslint eqeqeq: 0 */
return value == null;
}
function isObject (value) {
return value !== null && typeof value === 'object';
}
var toString$1 = Object.prototype.toString;
function isPlainObject (value) {
return !!value && toString$1.call(value) === '[object Object]';
}
function isPromiseLike (value) {
return !!value &&
isFunction(value.then) &&
isFunction(value.catch);
}
function isRegExp (value) {
return value instanceof RegExp;
}
function isString (value) {
return typeof value === 'string';
}
function isUndefined (value) {
return typeof value === 'undefined';
}
function isValidDate (date) {
return isDate(date) && date.toString() !== 'Invalid Date';
}
function isWindow (elem) {
return !!elem && elem === elem.window;
}
function assert (condition, msg) {
if (!condition) {
throw new Error(msg);
}
}
var ref = Object.prototype;
var hasOwnProperty = ref.hasOwnProperty;
function checkOwnProperty(object, key) {
// eslint-disable-next-line no-prototype-builtins
return object.hasOwnProperty(key);
}
function checkOwnProperty2(object, key) {
return hasOwnProperty.call(object, key);
}
function _forOwn (object, iterator) {
var hasOwn = object.hasOwnProperty ? checkOwnProperty : checkOwnProperty2;
for (var key in object) {
if (hasOwn(object, key) && iterator(object[key], key, object) === false) {
break;
}
}
}
function _forNumber (value, iterator) {
for (var i = 0; i < value;i++) {
if(iterator(i+1, i, value) === false) {
break;
}
}
return value;
}
function each (value, cb) {
if (isArrayLike(value)) {
forEach(value, 0, value.length, cb);
} else if (isNumber(value)) {
_forNumber(value, cb);
} else if (!isNil(value)) {
_forOwn(value, cb);
}
}
var UID_PROPERTY = "__CUID__" + (Math.random().toString(36).slice(2));
var uidCounter = 0;
function uid (obj) {
var uid = obj[UID_PROPERTY];
if (!uid) {
uid = ++uidCounter;
Object.defineProperty(obj, UID_PROPERTY, {
configurable: true,
value: uidCounter
});
}
return uid;
}
function easyHash (value) {
return isObject(value)
? ("o" + (uid(value)))
: (typeof value)[0] + value;
}
var isArray$2 = Array.isArray;
var keys = Object.keys;
function looseEqual(a, b) {
if (a === b) {
return true;
}
if (isObject(a) && isObject(b)) {
if (isArray$2(a) && isArray$2(b)) { // 判断是否是数组
return a.length === b.length && a.every(function (e, i) {
return looseEqual(e, b[i]);
});
} else if (isDate(a) && isDate(b)) { // 判断日期
return Number(a) === Number(b);
} else if (isRegExp(a) && isRegExp(b)) { // 正则
return a.toString() === b.toString();
} else { // 对象
var keysA = keys(a);
var keysB = keys(b);
return keysA.length === keysB.length && keysA.every(function (key) {
return looseEqual(a[key], b[key]);
});
}
}
return false;
}
function map (elems, callback) {
var ret = [];
each(elems, function (elem, key) {
elem = callback(elem, key);
!isNil(elem) && append(ret, elem);
});
return ret;
}
function noop() { }
function sleep (ms) {
return new Promise(function (resolve) {
setTimeout(resolve, ms);
});
}
var toString$2 = Object.prototype.toString;
function toString$3 (value) {
return toString$2.call(value);
}
function forNumber (value, iterator) {
if (isNil(value)) {
return value;
}
_forNumber(value, iterator);
}
function forOwn (object, iterator) {
if (isNil(object)) {
return object;
}
_forOwn(object, iterator);
}
var isArray$3 = Array.isArray;
function alias (proto, mappings) {
if (!isObject(proto)) {
return proto;
}
forOwn(mappings, function (mapping, key) {
var fn = proto[key];
if (isArray$3(mapping)) {
mapping.forEach(function (m) {
proto[m] = fn;
});
} else {
proto[mapping] = fn;
}
});
return proto;
}
function _assign (target) {
var arguments$1 = arguments;
if (isNil(target)) {
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var i = 1, len = arguments.length; i < len; i++) {
var nextSource = arguments$1[i];
forOwn(nextSource, function (nextVal, nextKey) {
to[nextKey] = nextVal;
});
}
return to;
}
var assign = Object.assign || _assign;
function assign$1(target, nextSource) {
var copy;
if (isNil(nextSource)) {
return;
}
forOwn(nextSource, function (nextVal, nextKey) {
copy = target[nextKey];
if (isObject(copy) && isObject(nextVal)) {
assign$1(copy, nextVal);
} else {
target[nextKey] = nextVal;
}
});
}
function deepAssign (target) {
var arguments$1 = arguments;
if (isNil(target)) {
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var i = 1, len = arguments.length; i < len; i++) {
var nextSource = arguments$1[i];
assign$1(to, nextSource);
}
return to;
}
var isArray$4 = Array.isArray;
function copy(value) {
return isObject(value) ? assign({}, value) : value;
}
function copyDeep(value) {
var target = value;
if (isArray$4(value)) {
target = [];
value.forEach(function (val, i) {
target[i] = copyDeep(val);
});
} else if (isObject(value)) {
target = {};
forOwn(value, function (val, key) {
target[key] = copyDeep(val);
});
}
return target;
}
function looseClone (value, deep) {
return deep ? copyDeep(value) : copy(value);
}
function forIn (object, iterator) {
if (isNil(object)) {
return object;
}
for (var key in object) {
if (iterator(object[key], key, object) === false) {
break;
} }
}
var ore = {
PROP_NAME_RE: /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,
ESCAPE_CHAR_RE: /\\(\\)?/g,
IS_DEEP_PROP_RE: /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/
};
var PROP_NAME_RE = ore.PROP_NAME_RE;
var ESCAPE_CHAR_RE = ore.ESCAPE_CHAR_RE;
var IS_DEEP_PROP_RE = ore.IS_DEEP_PROP_RE;
function get (object, path) {
if (!isString(path) || !IS_DEEP_PROP_RE.test(path)) {
return object[path];
}
var part;
PROP_NAME_RE.lastIndex = 0;
while (!isNil(object) && (part = PROP_NAME_RE.exec(path))) {
var match = part[0];
var number = part[1];
var quote = part[2];
var subString = part[3];
var prop = quote ? subString.replace(ESCAPE_CHAR_RE, '$1') : number || match;
object = object[prop];
}
return object;
}
function get$1 (object, path, defaultValue) {
var result = isNil(object) ? undefined : get(object, path);
return result === undefined ? defaultValue : result;
}
var ref$1 = Object.prototype;
var hasOwnProperty$1 = ref$1.hasOwnProperty;
function hasOwn (obj, key) {
return hasOwnProperty$1.call(obj, key);
}
var PROP_NAME_RE$1 = ore.PROP_NAME_RE;
var ESCAPE_CHAR_RE$1 = ore.ESCAPE_CHAR_RE;
var IS_DEEP_PROP_RE$1 = ore.IS_DEEP_PROP_RE;
function set (object, path, value) {
var target = object;
if (isNil(target)) {
return object;
}
if (!isString(path) || !IS_DEEP_PROP_RE$1.test(path)) {
target[path] = value;
return object;
}
var part;
var queue = [];
var i = 0;
var key;
PROP_NAME_RE$1.lastIndex = 0;
while ((part = PROP_NAME_RE$1.exec(path))) {
var match = part[0];
var number = part[1];
var quote = part[2];
var subString = part[3];
var obj = (void 0);
if (quote) {
key = subString.replace(ESCAPE_CHAR_RE$1, '$1');
obj = target[key];
if (isNil(obj)) {
obj = target[key] = {};
}
} else if (number) {
obj = target[key = number];
if (isNil(obj)) {
obj = target[number] = [];
}
} else {
obj = target[key = match];
if (isNil(obj)) {
obj = target[match] = {};
}
}
target = obj;
queue[i++] = obj;
}
target = queue[i - 2];
target[key] = value;
return object;
}
function transform (each, value, iterater, accumulator) {
each(value, function (val, index, object) {
return iterater(accumulator, val, index, object);
});
return accumulator;
}
function transform$1 (value, iterater, accumulator) {
return transform(forOwn, value, iterater, accumulator);
}
function classnames(arg) {
if (arg) {
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
return arg;
} else if (isArrayLike(arg)) {
return forArray(arg);
} else if (typeof arg === 'object') {
return forObject(arg);
}
}
return '';
}
function forArray(args) {
var len = args.length;
if (len > 0) {
var classes = [];
for (var i = 0; i < len; i++) {
var str = classnames(args[i]);
if (str) {
classes[classes.length] = str;
}
}
return classes.join(' ');
}
return '';
}
function forObject(arg) {
var classes = [];
forOwn(arg, function (val, key) {
if (val) {
classes[classes.length] = key;
}
});
return classes.join(' ');
}
classnames.concat = function () {
return forArray(arguments);
};
var classNames = classnames.concat;
exports._append = append;
exports._assign = _assign;
exports._flatten = flatten;
exports._forEach = forEach;
exports._forNumber = _forNumber;
exports._forOwn = _forOwn;
exports._get = get;
exports._isInteger = _isInteger;
exports._ore = ore;
exports._remove = remove;
exports._removeAt = removeAt;
exports._transIndex = transIndex;
exports._transform = transform;
exports.alias = alias;
exports.assert = assert;
exports.assign = assign;
exports.assignDeep = deepAssign;
exports.className = classnames;
exports.classNames = classNames;
exports.cloneLoose = looseClone;
exports.deepAssign = deepAssign;
exports.deepFlat = deepFlat;
exports.each = each;
exports.easyHash = easyHash;
exports.equalLoose = looseEqual;
exports.flat = flatten$1;
exports.flatten = flatten$1;
exports.flattenDeep = deepFlat;
exports.forEach = forEach$1;
exports.forIn = forIn;
exports.forNumber = forNumber;
exports.forOwn = forOwn;
exports.get = get$1;
exports.hasOwn = hasOwn;
exports.isAbsoluteURL = isAbsoluteURL;
exports.isArrayLike = isArrayLike;
exports.isAsyncFunction = isAsyncFunction;
exports.isBoolean = isBoolean;
exports.isDate = isDate;
exports.isFalsy = isFalsy;
exports.isFunction = isFunction;
exports.isInteger = isInteger;
exports.isLeapYear = isLeapYear;
exports.isNil = isNil;
exports.isNumber = isNumber;
exports.isObject = isObject;
exports.isPlainObject = isPlainObject;
exports.isPromiseLike = isPromiseLike;
exports.isRegExp = isRegExp;
exports.isString = isString;
exports.isUndefined = isUndefined;
exports.isValidDate = isValidDate;
exports.isWindow = isWindow;
exports.looseClone = looseClone;
exports.looseEqual = looseEqual;
exports.map = map;
exports.noop = noop;
exports.remove = remove$1;
exports.removeAt = removeAt$1;
exports.set = set;
exports.sleep = sleep;
exports.toString = toString$3;
exports.transform = transform$1;
exports.uid = uid;
Object.defineProperty(exports, '__esModule', { value: true });
})));

42

package.json
{
"name": "celia",
"version": "7.0.1",
"version": "8.0.0-beta.1",
"description": "A modern JavaScript utility library delivering modularity, performance, and extras.",
"main": "index.js",
"module": "es/index.js",
"unpkg": "celia.js",
"jsdelivr": "celia.js",
"main": "index.cjs.js",
"module": "index.esm.js",
"jsnext:main": "index.esm.js",
"unpkg": "index.js",
"jsdelivr": "index.js",
"sideEffects": false,
"scripts": {

@@ -13,3 +15,3 @@ "build": "rollup -c",

"gh-pages": "git subtree push --prefix=gh-pages origin gh-pages",
"release": "npm publish dist"
"release": "npm run build && npm publish dist --tag=beta"
},

@@ -31,23 +33,2 @@ "repository": {

"homepage": "https://github.com/fengxinming/celia#readme",
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"babel-jest": "^25.1.0",
"clrsole": "^3.0.0",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"fs-extra": "^9.0.0",
"jest": "^25.1.0",
"moment": "^2.24.0",
"rollup": "^2.1.0",
"rollup-plugin-combine": "^2.0.0",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-empty": "^1.0.0",
"rollup-plugin-match": "^1.0.0",
"rollup-plugin-terser": "^5.3.0"
},
"husky": {

@@ -67,3 +48,8 @@ "hooks": {

]
},
"dependencies": {
"celia.array": "^1.0.2",
"celia.is": "^1.0.1",
"celia.object": "^2.0.2"
}
}
}
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