Comparing version 5.6.2 to 6.0.0-beta.1
42
each.js
@@ -1,17 +0,29 @@ | ||
import isArrayLike from './isArrayLike'; | ||
import isNumber from './isNumber'; | ||
import forEach from './_internal/_array/_forEach'; | ||
import forOwn from './_internal/_object/_forOwn'; | ||
import forNumber from './_internal/_number/_forNumber'; | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
export default function (arr, cb, context) { | ||
if (arr) { | ||
if (isArrayLike(arr)) { | ||
forEach(arr, cb, context); | ||
} else if (isNumber(arr)) { | ||
forNumber(arr, cb, context); | ||
} else { | ||
forOwn(arr, cb, context); | ||
} | ||
require('./isNil.js'); | ||
var isObject = require('./isObject.js'); | ||
require('./_bindContext.js'); | ||
require('./_forSlice.js'); | ||
var _forOwn = require('./_forOwn.js'); | ||
var _forEach = require('./_forEach.js'); | ||
var _forNumber = require('./_forNumber.js'); | ||
var isNumber = require('./isNumber.js'); | ||
var isFunction = require('./isFunction.js'); | ||
var isArrayLike = require('./isArrayLike.js'); | ||
function each (value, cb, context) { | ||
if (isArrayLike(value)) { | ||
_forEach(value, cb, context); | ||
} else if (isObject(value) || isFunction(value)) { | ||
_forOwn(value, cb, context); | ||
} else if (isNumber(value)) { | ||
_forNumber(value, cb, context); | ||
} | ||
}; | ||
} | ||
module.exports = each; |
@@ -1,4 +0,13 @@ | ||
const hasOwnProperty = Object.prototype.hasOwnProperty; | ||
export default function (obj, key) { | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
function hasOwn (obj, key) { | ||
return hasOwnProperty.call(obj, key); | ||
} | ||
module.exports = hasOwn; |
@@ -1,7 +0,16 @@ | ||
import isNil from './isNil'; | ||
import isFunction from './isFunction'; | ||
import isNumber from './isNumber'; | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
export default function (value) { | ||
var isNil = require('./isNil.js'); | ||
var isNumber = require('./isNumber.js'); | ||
var isFunction = require('./isFunction.js'); | ||
function isArrayLike (value) { | ||
return !isNil(value) && isNumber(value.length) && !isFunction(value); | ||
}; | ||
} | ||
module.exports = isArrayLike; |
@@ -1,5 +0,14 @@ | ||
import toString from './_internal/_toString'; | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
export default function (value) { | ||
var toString = require('./toString.js'); | ||
function isAsyncFunction (value) { | ||
return toString(value) === '[object AsyncFunction]'; | ||
} | ||
module.exports = isAsyncFunction; |
@@ -1,3 +0,12 @@ | ||
export default function (value) { | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
function isBoolean (value) { | ||
return typeof value === 'boolean'; | ||
}; | ||
} | ||
module.exports = isBoolean; |
@@ -0,6 +1,15 @@ | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
// import toString from './_internal/_toString'; | ||
export default function (value) { | ||
function isDate (value) { | ||
// return toString(value) === '[object Date]'; | ||
return value instanceof Date; | ||
}; | ||
} | ||
module.exports = isDate; |
@@ -1,3 +0,12 @@ | ||
export default function (value) { | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
function isFunction (value) { | ||
return typeof value === 'function'; | ||
}; | ||
} | ||
module.exports = isFunction; |
@@ -1,3 +0,13 @@ | ||
import _isInteger from './_internal/_isInteger'; | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
export default Number.isInteger || _isInteger; | ||
require('./isNumber.js'); | ||
var _isInteger = require('./_isInteger.js'); | ||
var isInteger = Number.isInteger || _isInteger; | ||
module.exports = isInteger; |
13
isNil.js
@@ -1,4 +0,13 @@ | ||
export default function (value) { | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
function isNil (value) { | ||
/* eslint eqeqeq: 0 */ | ||
return value == null; | ||
}; | ||
} | ||
module.exports = isNil; |
@@ -1,3 +0,12 @@ | ||
export default function (value) { | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
function isNumber (value) { | ||
return typeof value === 'number'; | ||
}; | ||
} | ||
module.exports = isNumber; |
@@ -1,3 +0,12 @@ | ||
export default function (value) { | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
function isObject (value) { | ||
return value !== null && typeof value === 'object'; | ||
}; | ||
} | ||
module.exports = isObject; |
@@ -1,6 +0,15 @@ | ||
import toString from './_internal/_toString'; | ||
import isNil from './isNil'; | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
export default function (value) { | ||
var isNil = require('./isNil.js'); | ||
var toString = require('./toString.js'); | ||
function isPlainObject (value) { | ||
return !isNil(value) && toString(value) === '[object Object]'; | ||
} | ||
module.exports = isPlainObject; |
@@ -1,4 +0,11 @@ | ||
import isFunction from './isFunction'; | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
export default function (value) { | ||
var isFunction = require('./isFunction.js'); | ||
function isPromiseLike (value) { | ||
return !!value && | ||
@@ -8,1 +15,3 @@ isFunction(value.then) && | ||
} | ||
module.exports = isPromiseLike; |
@@ -0,6 +1,15 @@ | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
// import toString from './_internal/_toString'; | ||
export default function (value) { | ||
function isRegExp (value) { | ||
// return toString(value) === '[object RegExp]'; | ||
return value instanceof RegExp; | ||
}; | ||
} | ||
module.exports = isRegExp; |
@@ -1,3 +0,12 @@ | ||
export default function (value) { | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
function isString (value) { | ||
return typeof value === 'string'; | ||
}; | ||
} | ||
module.exports = isString; |
@@ -1,3 +0,12 @@ | ||
export default function (value) { | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
function isUndefined (value) { | ||
return typeof value === 'undefined'; | ||
}; | ||
} | ||
module.exports = isUndefined; |
@@ -1,3 +0,12 @@ | ||
export default function (elem) { | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
function isWindow (elem) { | ||
return elem && elem === elem.window; | ||
} | ||
module.exports = isWindow; |
@@ -1,10 +0,17 @@ | ||
import isObject from './isObject'; | ||
import isDate from './isDate'; | ||
import isRegExp from './isRegExp'; | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
const { isArray } = Array; | ||
export default function looseEqual(a, b) { | ||
var isObject = require('./isObject.js'); | ||
var isDate = require('./isDate.js'); | ||
var isRegExp = require('./isRegExp.js'); | ||
var isArray = Array.isArray; | ||
function looseEqual(a, b) { | ||
if (isObject(a) && isObject(b)) { | ||
if (isArray(a) && isArray(b)) { // 判断是否是数组 | ||
return a.length === b.length && a.every((e, i) => { | ||
return a.length === b.length && a.every(function (e, i) { | ||
return looseEqual(e, b[i]); | ||
@@ -17,5 +24,5 @@ }); | ||
} else { // 对象 | ||
const keysA = Object.keys(a); | ||
const keysB = Object.keys(b); | ||
return keysA.length === keysB.length && keysA.every((key) => { | ||
var keysA = Object.keys(a); | ||
var keysB = Object.keys(b); | ||
return keysA.length === keysB.length && keysA.every(function (key) { | ||
return looseEqual(a[key], b[key]); | ||
@@ -27,1 +34,3 @@ }); | ||
} | ||
module.exports = looseEqual; |
28
map.js
@@ -1,6 +0,26 @@ | ||
import each from './each'; | ||
import map from './_internal/_map'; | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
export default function (elems, callback, context) { | ||
return map(each, elems, callback, context); | ||
require('./_append.js'); | ||
require('./isNil.js'); | ||
require('./isObject.js'); | ||
require('./_bindContext.js'); | ||
require('./_forSlice.js'); | ||
require('./_forOwn.js'); | ||
require('./_forEach.js'); | ||
require('./_forNumber.js'); | ||
require('./isNumber.js'); | ||
var _map = require('./_map.js'); | ||
require('./isFunction.js'); | ||
require('./isArrayLike.js'); | ||
var each = require('./each.js'); | ||
function map (elems, callback, context) { | ||
return _map(each, elems, callback, context); | ||
} | ||
module.exports = map; |
11
noop.js
@@ -1,1 +0,10 @@ | ||
export default function noop() { } | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
function noop() { } | ||
module.exports = noop; |
{ | ||
"name": "celia", | ||
"version": "5.6.2", | ||
"description": "A modern JavaScript utility library delivering modularity, performance, & extras.", | ||
"main": "./dist/celia.c.js", | ||
"module": "./dist/celia.es.js", | ||
"unpkg": "./dist/celia.js", | ||
"jsdelivr": "./dist/celia.js", | ||
"version": "6.0.0-beta.1", | ||
"description": "A modern JavaScript utility library delivering modularity, performance, and extras.", | ||
"main": "./cjs.js", | ||
"module": "./es.js", | ||
"unpkg": "./umd.js", | ||
"jsdelivr": "./umd.js", | ||
"scripts": { | ||
@@ -21,6 +21,3 @@ "build": "node ./scripts/build.js", | ||
"javascript", | ||
"common", | ||
"util", | ||
"utils", | ||
"celia", | ||
"lodash", | ||
@@ -54,2 +51,3 @@ "underscore" | ||
"rollup-plugin-buble": "^0.19.6", | ||
"rollup-plugin-combine": "^1.0.0-beta.1", | ||
"rollup-plugin-commonjs": "^9.2.0", | ||
@@ -59,3 +57,2 @@ "rollup-plugin-flow-no-whitespace": "^1.0.0", | ||
"rollup-plugin-replace": "^2.1.0", | ||
"rollup-plugin-uglify": "^6.0.2", | ||
"uglify-js": "^3.4.9", | ||
@@ -62,0 +59,0 @@ "zlib": "^1.0.5" |
@@ -7,3 +7,3 @@ # celia | ||
[![NPM version](https://img.shields.io/npm/v/celia.svg?style=flat)](https://npmjs.org/package/celia) [![NPM Downloads](https://img.shields.io/npm/dm/celia.svg?style=flat)](https://npmjs.org/package/celia) | ||
[![NPM version](https://img.shields.io/npm/v/celia.svg?style=flat)](https://npmjs.org/package/celia) [![NPM Downloads](https://img.shields.io/npm/dm/celia.svg?style=flat)](https://npmjs.org/package/celia)[![](https://data.jsdelivr.com/v1/package/npm/celia/badge)](https://www.jsdelivr.com/package/npm/celia) | ||
@@ -27,8 +27,3 @@ --- | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/celia/dist/celia.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/celia/dist/aop.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/celia/dist/browser.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/celia/dist/object.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/celia/dist/qs.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/celia/dist/url.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/celia@6.0.0-beta.1/umd.min.js"></script> | ||
``` | ||
@@ -47,3 +42,3 @@ | ||
// or | ||
import celia from 'celia/dist/celia.es'; | ||
import celia from 'celia/es'; | ||
@@ -53,4 +48,2 @@ // modularity | ||
import isDate from 'celia/isDate'; | ||
import stringify from 'celia/qs/stringify'; | ||
import join from 'celia/url/join'; | ||
@@ -61,5 +54,7 @@ // node | ||
const { isDate } = celia; | ||
const { stringify } = celia.qs; | ||
const { join } = celia.url; | ||
// or | ||
const each = require('celia/each'); | ||
const isDate = require('celia/isDate'); | ||
``` | ||
@@ -71,16 +66,9 @@ | ||
- [manipulate Array](https://www.npmjs.com/package/kick-array) | ||
- [manipulate DOM](https://www.npmjs.com/package/kick-dom) | ||
- [manipulate Date](https://www.npmjs.com/package/kick-date) | ||
### API | ||
- camelCase | ||
- debounce | ||
- assign | ||
- each | ||
- forEach | ||
- forNumber | ||
- forOwn | ||
- get | ||
- getUid | ||
- getUID | ||
- hasOwn | ||
@@ -106,21 +94,5 @@ - isArrayLike | ||
- sleep | ||
- toString | ||
- type | ||
- aop/after | ||
- aop/around | ||
- aop/before | ||
- browser/msie | ||
- browser/os | ||
- number/forNumber | ||
- number/map | ||
- object/assign | ||
- object/forIn | ||
- object/forOwn | ||
- object/get | ||
- object/map | ||
- qs/parse | ||
- qs/prefix | ||
- qs/stringify | ||
- url/isAbsolute | ||
- url/join | ||
## Release History |
13
sleep.js
@@ -1,5 +0,14 @@ | ||
export default function (ms) { | ||
return new Promise((resolve) => { | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
function sleep (ms) { | ||
return new Promise(function (resolve) { | ||
setTimeout(resolve, ms); | ||
}); | ||
} | ||
module.exports = sleep; |
27
type.js
@@ -1,12 +0,19 @@ | ||
import toString from './_internal/_toString'; | ||
import isNil from './isNil'; | ||
import isObject from './isObject'; | ||
import isFunction from './isFunction'; | ||
/* | ||
* celia.js v6.0.0-beta.1 | ||
* (c) 2018-2019 Jesse Feng | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
const RAW_DATA_TYPES = {}; | ||
'Boolean,Number,String,Function,AsyncFunction,Array,Date,RegExp,Object,Error,Symbol'.split(',').forEach((name) => { | ||
RAW_DATA_TYPES[`[object ${name}]`] = name.toLowerCase(); | ||
var isNil = require('./isNil.js'); | ||
var isObject = require('./isObject.js'); | ||
var isFunction = require('./isFunction.js'); | ||
var toString = require('./toString.js'); | ||
var RAW_DATA_TYPES = {}; | ||
'Boolean,Number,String,Function,AsyncFunction,Array,Date,RegExp,Object,Error,Symbol'.split(',').forEach(function (name) { | ||
RAW_DATA_TYPES[("[object " + name + "]")] = name.toLowerCase(); | ||
}); | ||
export default function (value) { | ||
function type (value) { | ||
if (isNil(value)) { | ||
@@ -16,2 +23,4 @@ return value + ''; | ||
return (isObject(value) || isFunction(value)) ? (RAW_DATA_TYPES[toString(value)] || 'object') : typeof value; | ||
}; | ||
} | ||
module.exports = type; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38089
41
1167
1
92
1