shaye-sword
Advanced tools
Comparing version 1.0.5 to 1.0.10
@@ -1,65 +0,4 @@ | ||
import 'core-js/modules/es6.regexp.to-string'; | ||
import { isCorrect } from './variables.js'; | ||
/** | ||
* @namespace variables | ||
*/ | ||
/** | ||
* 判断变量是否是object | ||
* @memberOf variables | ||
* @function isObject | ||
* @param {*} obj | ||
*/ | ||
function isObject(obj) { | ||
return Object.prototype.toString.call(obj) === "[object Object]"; | ||
} | ||
/** | ||
* 判断object是否是空的 | ||
* @memberOf variables | ||
* @function isEmptyObject | ||
* @param {object} obj | ||
*/ | ||
function isEmptyObject(obj) { | ||
for (var key in obj) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
/** | ||
* 检验变量是否有正确的值 | ||
* @memberOf variables | ||
* @function isCorrect | ||
* @param {*} variable - 被检验的变量 | ||
* @param {boolean} [notBezero=false] - 是否不允许变量等于零 | ||
*/ | ||
function isCorrect(variable, notBezero) { | ||
var result = true; | ||
if (typeof variable === "string" && (variable === "" || variable === "undefined" || variable === "null" || variable === "NaN" || variable === "Infinity")) { | ||
result = false; | ||
} else if (typeof variable === "number" && (isNaN(variable) || !isFinite(variable) || notBezero && variable === 0)) { | ||
result = false; | ||
} else if (variable === null) { | ||
result = false; | ||
} else if (typeof variable === "undefined") { | ||
result = false; | ||
} else if (isObject(variable)) { | ||
if (isEmptyObject(variable)) { | ||
result = false; | ||
} | ||
} else if (Array.isArray(variable)) { | ||
if (variable.length === 0) { | ||
result = false; | ||
} | ||
} | ||
return result; | ||
} | ||
/** | ||
* @namespace objTool | ||
@@ -66,0 +5,0 @@ */ |
import 'core-js/modules/web.dom.iterable'; | ||
import 'core-js/modules/es6.regexp.split'; | ||
import 'core-js/modules/es6.regexp.to-string'; | ||
import { isCorrect } from './variables.js'; | ||
/** | ||
* @namespace variables | ||
*/ | ||
/** | ||
* 判断变量是否是object | ||
* @memberOf variables | ||
* @function isObject | ||
* @param {*} obj | ||
*/ | ||
function isObject(obj) { | ||
return Object.prototype.toString.call(obj) === "[object Object]"; | ||
} | ||
/** | ||
* 判断object是否是空的 | ||
* @memberOf variables | ||
* @function isEmptyObject | ||
* @param {object} obj | ||
*/ | ||
function isEmptyObject(obj) { | ||
for (var key in obj) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
/** | ||
* 检验变量是否有正确的值 | ||
* @memberOf variables | ||
* @function isCorrect | ||
* @param {*} variable - 被检验的变量 | ||
* @param {boolean} [notBezero=false] - 是否不允许变量等于零 | ||
*/ | ||
function isCorrect(variable, notBezero) { | ||
var result = true; | ||
if (typeof variable === "string" && (variable === "" || variable === "undefined" || variable === "null" || variable === "NaN" || variable === "Infinity")) { | ||
result = false; | ||
} else if (typeof variable === "number" && (isNaN(variable) || !isFinite(variable) || notBezero && variable === 0)) { | ||
result = false; | ||
} else if (variable === null) { | ||
result = false; | ||
} else if (typeof variable === "undefined") { | ||
result = false; | ||
} else if (isObject(variable)) { | ||
if (isEmptyObject(variable)) { | ||
result = false; | ||
} | ||
} else if (Array.isArray(variable)) { | ||
if (variable.length === 0) { | ||
result = false; | ||
} | ||
} | ||
return result; | ||
} | ||
/** | ||
* 把URL查询参数转换为object | ||
@@ -68,0 +7,0 @@ * @memberOf strTool |
{ | ||
"name": "shaye-sword", | ||
"version": "1.0.5", | ||
"version": "1.0.10", | ||
"description": "a javascript tool library", | ||
"module": "es.js", | ||
"module": "es/index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
@@ -7,0 +8,0 @@ "build": "rollup -c ./build/rollup.config.js", |
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
31022
24
1013
1