@alitajs/autils
Advanced tools
Comparing version 0.3.1 to 0.5.0
@@ -1,33 +0,37 @@ | ||
export { default as arrayToObject } from './array-to-object'; | ||
export { default as arrayToTree } from './array-to-tree'; | ||
export { default as isArray } from './is-array'; | ||
export { default as isBoolean } from './is-boolean'; | ||
export { default as isDate } from './is-date'; | ||
export { default as isEmail } from './is-email'; | ||
export { default as isEmptyObject } from './is-empty-object'; | ||
export { default as isFunction } from './is-function'; | ||
export { default as isIdCard } from './is-id-card'; | ||
export { default as isInteger } from './is-integer'; | ||
export { default as isNan } from './is-nan'; | ||
export { default as isNegativeInteger } from './is-negative-integer'; | ||
export { default as isNil } from './is-nil'; | ||
export { default as isNull } from './is-null'; | ||
export { default as isNumber } from './is-number'; | ||
export { default as isObject } from './is-object'; | ||
export { default as isPhone } from './is-phone'; | ||
export { default as isPromise } from './is-promise'; | ||
export { default as isRegexp } from './is-regexp'; | ||
export { default as isString } from './is-string'; | ||
export { default as isUndefined } from './is-undefined'; | ||
export { default as isUrl } from './is-url'; | ||
export { default as urlToList } from './url-to-list'; | ||
export { default as Policy } from './policy'; | ||
export { default as arrayToObject } from './arrayToObject'; | ||
export { default as arrayToTree } from './arrayToTree'; | ||
export { default as isArray } from './isArray'; | ||
export { default as isBoolean } from './isBoolean'; | ||
export { default as isDate } from './isDate'; | ||
export { default as isEmail } from './isEmail'; | ||
export { default as isEmptyObject } from './isEmptyObject'; | ||
export { default as isFunction } from './isFunction'; | ||
export { default as isIdCard } from './isIdCard'; | ||
export { default as isInteger } from './isInteger'; | ||
export { default as isNaN } from './isNaN'; | ||
export { default as isNegativeInteger } from './isNegativeInteger'; | ||
export { default as isNil } from './isNil'; | ||
export { default as isNull } from './isNull'; | ||
export { default as isNumber } from './isNumber'; | ||
export { default as isObject } from './isObject'; | ||
export { default as isPhone } from './isPhone'; | ||
export { default as isPromise } from './isPromise'; | ||
export { default as isRegexp } from './isRegexp'; | ||
export { default as isString } from './isString'; | ||
export { default as isUndefined } from './isUndefined'; | ||
export { default as isUrl } from './isUrl'; | ||
export { default as urlToList } from './urlToList'; | ||
export { default as Policy } from './Policy'; | ||
export { default as ArabicChinese } from './ArabicChinese'; | ||
export { default as round } from './round'; | ||
export { default as urlRegex } from './url-regexp'; | ||
export { default as emailRegexp } from './email-regexp'; | ||
export { default as phoneRegexp } from './phone-regexp'; | ||
export { default as idCardRegexp } from './id-card-regexp'; | ||
export { default as numberToChinese } from './number-to-chinese'; | ||
export { default as deepClone } from './deep-clone'; | ||
export { getType } from './get-type'; | ||
export { default as groupBy } from './group-by'; | ||
export { default as urlRegexp } from './urlRegexp'; | ||
export { default as emailRegexp } from './emailRegexp'; | ||
export { default as phoneRegexp } from './phoneRegexp'; | ||
export { default as idCardRegexp } from './idCardRegexp'; | ||
export { default as deepClone } from './deepClone'; | ||
export { default as getType } from './getType'; | ||
export { default as groupBy } from './groupBy'; | ||
export { default as forOwn } from './forOwn'; | ||
export * from './dedent'; | ||
export { default as indent } from './indent'; | ||
export * from './enhanceType'; |
@@ -0,41 +1,45 @@ | ||
// @index(['./*', '!./_*', '!./typings.d.ts', '!./*.test.ts'], pp => `export * from '${pp.path}'`) | ||
// Array | ||
export { default as arrayToObject } from './array-to-object'; | ||
export { default as arrayToTree } from './array-to-tree'; // Lang | ||
export { default as arrayToObject } from './arrayToObject'; | ||
export { default as arrayToTree } from './arrayToTree'; // Lang | ||
export { default as isArray } from './is-array'; | ||
export { default as isBoolean } from './is-boolean'; | ||
export { default as isDate } from './is-date'; | ||
export { default as isEmail } from './is-email'; | ||
export { default as isEmptyObject } from './is-empty-object'; | ||
export { default as isFunction } from './is-function'; | ||
export { default as isIdCard } from './is-id-card'; | ||
export { default as isInteger } from './is-integer'; | ||
export { default as isNan } from './is-nan'; | ||
export { default as isNegativeInteger } from './is-negative-integer'; | ||
export { default as isNil } from './is-nil'; | ||
export { default as isNull } from './is-null'; | ||
export { default as isNumber } from './is-number'; | ||
export { default as isObject } from './is-object'; | ||
export { default as isPhone } from './is-phone'; | ||
export { default as isPromise } from './is-promise'; | ||
export { default as isRegexp } from './is-regexp'; | ||
export { default as isString } from './is-string'; | ||
export { default as isUndefined } from './is-undefined'; | ||
export { default as isUrl } from './is-url'; // url utils | ||
export { default as isArray } from './isArray'; | ||
export { default as isBoolean } from './isBoolean'; | ||
export { default as isDate } from './isDate'; | ||
export { default as isEmail } from './isEmail'; | ||
export { default as isEmptyObject } from './isEmptyObject'; | ||
export { default as isFunction } from './isFunction'; | ||
export { default as isIdCard } from './isIdCard'; | ||
export { default as isInteger } from './isInteger'; | ||
export { default as isNaN } from './isNaN'; | ||
export { default as isNegativeInteger } from './isNegativeInteger'; | ||
export { default as isNil } from './isNil'; | ||
export { default as isNull } from './isNull'; | ||
export { default as isNumber } from './isNumber'; | ||
export { default as isObject } from './isObject'; | ||
export { default as isPhone } from './isPhone'; | ||
export { default as isPromise } from './isPromise'; | ||
export { default as isRegexp } from './isRegexp'; | ||
export { default as isString } from './isString'; | ||
export { default as isUndefined } from './isUndefined'; | ||
export { default as isUrl } from './isUrl'; // url utils | ||
export { default as urlToList } from './url-to-list'; // Class | ||
export { default as urlToList } from './urlToList'; // 工具类 | ||
export { default as Policy } from './policy'; // Math | ||
export { default as Policy } from './Policy'; | ||
export { default as ArabicChinese } from './ArabicChinese'; // Math | ||
export { default as round } from './round'; // Regexp | ||
export { default as urlRegex } from './url-regexp'; | ||
export { default as emailRegexp } from './email-regexp'; | ||
export { default as phoneRegexp } from './phone-regexp'; | ||
export { default as idCardRegexp } from './id-card-regexp'; // Utils | ||
export { default as urlRegexp } from './urlRegexp'; | ||
export { default as emailRegexp } from './emailRegexp'; | ||
export { default as phoneRegexp } from './phoneRegexp'; | ||
export { default as idCardRegexp } from './idCardRegexp'; // Utils | ||
export { default as numberToChinese } from './number-to-chinese'; | ||
export { default as deepClone } from './deep-clone'; | ||
export { getType } from './get-type'; | ||
export { default as groupBy } from './group-by'; | ||
export { default as deepClone } from './deepClone'; | ||
export { default as getType } from './getType'; | ||
export { default as groupBy } from './groupBy'; | ||
export { default as forOwn } from './forOwn'; | ||
export * from './dedent'; | ||
export { default as indent } from './indent'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import nativeRound from './utils/native-round'; | ||
import nativeRound from './.internal/nativeRound'; | ||
/** | ||
@@ -3,0 +3,0 @@ * 对传入的数字按给定的精度返回。 |
@@ -1,33 +0,37 @@ | ||
export { default as arrayToObject } from './array-to-object'; | ||
export { default as arrayToTree } from './array-to-tree'; | ||
export { default as isArray } from './is-array'; | ||
export { default as isBoolean } from './is-boolean'; | ||
export { default as isDate } from './is-date'; | ||
export { default as isEmail } from './is-email'; | ||
export { default as isEmptyObject } from './is-empty-object'; | ||
export { default as isFunction } from './is-function'; | ||
export { default as isIdCard } from './is-id-card'; | ||
export { default as isInteger } from './is-integer'; | ||
export { default as isNan } from './is-nan'; | ||
export { default as isNegativeInteger } from './is-negative-integer'; | ||
export { default as isNil } from './is-nil'; | ||
export { default as isNull } from './is-null'; | ||
export { default as isNumber } from './is-number'; | ||
export { default as isObject } from './is-object'; | ||
export { default as isPhone } from './is-phone'; | ||
export { default as isPromise } from './is-promise'; | ||
export { default as isRegexp } from './is-regexp'; | ||
export { default as isString } from './is-string'; | ||
export { default as isUndefined } from './is-undefined'; | ||
export { default as isUrl } from './is-url'; | ||
export { default as urlToList } from './url-to-list'; | ||
export { default as Policy } from './policy'; | ||
export { default as arrayToObject } from './arrayToObject'; | ||
export { default as arrayToTree } from './arrayToTree'; | ||
export { default as isArray } from './isArray'; | ||
export { default as isBoolean } from './isBoolean'; | ||
export { default as isDate } from './isDate'; | ||
export { default as isEmail } from './isEmail'; | ||
export { default as isEmptyObject } from './isEmptyObject'; | ||
export { default as isFunction } from './isFunction'; | ||
export { default as isIdCard } from './isIdCard'; | ||
export { default as isInteger } from './isInteger'; | ||
export { default as isNaN } from './isNaN'; | ||
export { default as isNegativeInteger } from './isNegativeInteger'; | ||
export { default as isNil } from './isNil'; | ||
export { default as isNull } from './isNull'; | ||
export { default as isNumber } from './isNumber'; | ||
export { default as isObject } from './isObject'; | ||
export { default as isPhone } from './isPhone'; | ||
export { default as isPromise } from './isPromise'; | ||
export { default as isRegexp } from './isRegexp'; | ||
export { default as isString } from './isString'; | ||
export { default as isUndefined } from './isUndefined'; | ||
export { default as isUrl } from './isUrl'; | ||
export { default as urlToList } from './urlToList'; | ||
export { default as Policy } from './Policy'; | ||
export { default as ArabicChinese } from './ArabicChinese'; | ||
export { default as round } from './round'; | ||
export { default as urlRegex } from './url-regexp'; | ||
export { default as emailRegexp } from './email-regexp'; | ||
export { default as phoneRegexp } from './phone-regexp'; | ||
export { default as idCardRegexp } from './id-card-regexp'; | ||
export { default as numberToChinese } from './number-to-chinese'; | ||
export { default as deepClone } from './deep-clone'; | ||
export { getType } from './get-type'; | ||
export { default as groupBy } from './group-by'; | ||
export { default as urlRegexp } from './urlRegexp'; | ||
export { default as emailRegexp } from './emailRegexp'; | ||
export { default as phoneRegexp } from './phoneRegexp'; | ||
export { default as idCardRegexp } from './idCardRegexp'; | ||
export { default as deepClone } from './deepClone'; | ||
export { default as getType } from './getType'; | ||
export { default as groupBy } from './groupBy'; | ||
export { default as forOwn } from './forOwn'; | ||
export * from './dedent'; | ||
export { default as indent } from './indent'; | ||
export * from './enhanceType'; |
152
lib/index.js
@@ -6,2 +6,39 @@ "use strict"; | ||
}); | ||
var _exportNames = { | ||
arrayToObject: true, | ||
arrayToTree: true, | ||
isArray: true, | ||
isBoolean: true, | ||
isDate: true, | ||
isEmail: true, | ||
isEmptyObject: true, | ||
isFunction: true, | ||
isIdCard: true, | ||
isInteger: true, | ||
isNaN: true, | ||
isNegativeInteger: true, | ||
isNil: true, | ||
isNull: true, | ||
isNumber: true, | ||
isObject: true, | ||
isPhone: true, | ||
isPromise: true, | ||
isRegexp: true, | ||
isString: true, | ||
isUndefined: true, | ||
isUrl: true, | ||
urlToList: true, | ||
Policy: true, | ||
ArabicChinese: true, | ||
round: true, | ||
urlRegexp: true, | ||
emailRegexp: true, | ||
phoneRegexp: true, | ||
idCardRegexp: true, | ||
deepClone: true, | ||
getType: true, | ||
groupBy: true, | ||
forOwn: true, | ||
indent: true | ||
}; | ||
Object.defineProperty(exports, "arrayToObject", { | ||
@@ -67,6 +104,6 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "isNan", { | ||
Object.defineProperty(exports, "isNaN", { | ||
enumerable: true, | ||
get: function get() { | ||
return _isNan["default"]; | ||
return _isNaN["default"]; | ||
} | ||
@@ -149,5 +186,11 @@ }); | ||
get: function get() { | ||
return _policy["default"]; | ||
return _Policy["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "ArabicChinese", { | ||
enumerable: true, | ||
get: function get() { | ||
return _ArabicChinese["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "round", { | ||
@@ -159,3 +202,3 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "urlRegex", { | ||
Object.defineProperty(exports, "urlRegexp", { | ||
enumerable: true, | ||
@@ -184,8 +227,2 @@ get: function get() { | ||
}); | ||
Object.defineProperty(exports, "numberToChinese", { | ||
enumerable: true, | ||
get: function get() { | ||
return _numberToChinese["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "deepClone", { | ||
@@ -200,3 +237,3 @@ enumerable: true, | ||
get: function get() { | ||
return _getType.getType; | ||
return _getType["default"]; | ||
} | ||
@@ -210,70 +247,99 @@ }); | ||
}); | ||
Object.defineProperty(exports, "forOwn", { | ||
enumerable: true, | ||
get: function get() { | ||
return _forOwn["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "indent", { | ||
enumerable: true, | ||
get: function get() { | ||
return _indent["default"]; | ||
} | ||
}); | ||
var _arrayToObject = _interopRequireDefault(require("./array-to-object")); | ||
var _arrayToObject = _interopRequireDefault(require("./arrayToObject")); | ||
var _arrayToTree = _interopRequireDefault(require("./array-to-tree")); | ||
var _arrayToTree = _interopRequireDefault(require("./arrayToTree")); | ||
var _isArray = _interopRequireDefault(require("./is-array")); | ||
var _isArray = _interopRequireDefault(require("./isArray")); | ||
var _isBoolean = _interopRequireDefault(require("./is-boolean")); | ||
var _isBoolean = _interopRequireDefault(require("./isBoolean")); | ||
var _isDate = _interopRequireDefault(require("./is-date")); | ||
var _isDate = _interopRequireDefault(require("./isDate")); | ||
var _isEmail = _interopRequireDefault(require("./is-email")); | ||
var _isEmail = _interopRequireDefault(require("./isEmail")); | ||
var _isEmptyObject = _interopRequireDefault(require("./is-empty-object")); | ||
var _isEmptyObject = _interopRequireDefault(require("./isEmptyObject")); | ||
var _isFunction = _interopRequireDefault(require("./is-function")); | ||
var _isFunction = _interopRequireDefault(require("./isFunction")); | ||
var _isIdCard = _interopRequireDefault(require("./is-id-card")); | ||
var _isIdCard = _interopRequireDefault(require("./isIdCard")); | ||
var _isInteger = _interopRequireDefault(require("./is-integer")); | ||
var _isInteger = _interopRequireDefault(require("./isInteger")); | ||
var _isNan = _interopRequireDefault(require("./is-nan")); | ||
var _isNaN = _interopRequireDefault(require("./isNaN")); | ||
var _isNegativeInteger = _interopRequireDefault(require("./is-negative-integer")); | ||
var _isNegativeInteger = _interopRequireDefault(require("./isNegativeInteger")); | ||
var _isNil = _interopRequireDefault(require("./is-nil")); | ||
var _isNil = _interopRequireDefault(require("./isNil")); | ||
var _isNull = _interopRequireDefault(require("./is-null")); | ||
var _isNull = _interopRequireDefault(require("./isNull")); | ||
var _isNumber = _interopRequireDefault(require("./is-number")); | ||
var _isNumber = _interopRequireDefault(require("./isNumber")); | ||
var _isObject = _interopRequireDefault(require("./is-object")); | ||
var _isObject = _interopRequireDefault(require("./isObject")); | ||
var _isPhone = _interopRequireDefault(require("./is-phone")); | ||
var _isPhone = _interopRequireDefault(require("./isPhone")); | ||
var _isPromise = _interopRequireDefault(require("./is-promise")); | ||
var _isPromise = _interopRequireDefault(require("./isPromise")); | ||
var _isRegexp = _interopRequireDefault(require("./is-regexp")); | ||
var _isRegexp = _interopRequireDefault(require("./isRegexp")); | ||
var _isString = _interopRequireDefault(require("./is-string")); | ||
var _isString = _interopRequireDefault(require("./isString")); | ||
var _isUndefined = _interopRequireDefault(require("./is-undefined")); | ||
var _isUndefined = _interopRequireDefault(require("./isUndefined")); | ||
var _isUrl = _interopRequireDefault(require("./is-url")); | ||
var _isUrl = _interopRequireDefault(require("./isUrl")); | ||
var _urlToList = _interopRequireDefault(require("./url-to-list")); | ||
var _urlToList = _interopRequireDefault(require("./urlToList")); | ||
var _policy = _interopRequireDefault(require("./policy")); | ||
var _Policy = _interopRequireDefault(require("./Policy")); | ||
var _ArabicChinese = _interopRequireDefault(require("./ArabicChinese")); | ||
var _round = _interopRequireDefault(require("./round")); | ||
var _urlRegexp = _interopRequireDefault(require("./url-regexp")); | ||
var _urlRegexp = _interopRequireDefault(require("./urlRegexp")); | ||
var _emailRegexp = _interopRequireDefault(require("./email-regexp")); | ||
var _emailRegexp = _interopRequireDefault(require("./emailRegexp")); | ||
var _phoneRegexp = _interopRequireDefault(require("./phone-regexp")); | ||
var _phoneRegexp = _interopRequireDefault(require("./phoneRegexp")); | ||
var _idCardRegexp = _interopRequireDefault(require("./id-card-regexp")); | ||
var _idCardRegexp = _interopRequireDefault(require("./idCardRegexp")); | ||
var _numberToChinese = _interopRequireDefault(require("./number-to-chinese")); | ||
var _deepClone = _interopRequireDefault(require("./deepClone")); | ||
var _deepClone = _interopRequireDefault(require("./deep-clone")); | ||
var _getType = _interopRequireDefault(require("./getType")); | ||
var _getType = require("./get-type"); | ||
var _groupBy = _interopRequireDefault(require("./groupBy")); | ||
var _groupBy = _interopRequireDefault(require("./group-by")); | ||
var _forOwn = _interopRequireDefault(require("./forOwn")); | ||
var _dedent = require("./dedent"); | ||
Object.keys(_dedent).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _dedent[key]; | ||
} | ||
}); | ||
}); | ||
var _indent = _interopRequireDefault(require("./indent")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
//# sourceMappingURL=index.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _nativeRound = _interopRequireDefault(require("./utils/native-round")); | ||
var _nativeRound = _interopRequireDefault(require("./.internal/nativeRound")); | ||
@@ -11,0 +11,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
{ | ||
"name": "@alitajs/autils", | ||
"version": "0.3.1", | ||
"version": "0.5.0", | ||
"description": "Awesome Utils(前端常用工具方法)", | ||
@@ -8,6 +8,6 @@ "repository": "git@github.com:alitajs/autils.git", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"main": "lib/index.js", | ||
"unpkg": "lib/index.js", | ||
"module": "es/index.js", | ||
"typings": "es/index.d.ts", | ||
"types": "lib/index.d.ts", | ||
"files": [ | ||
@@ -19,12 +19,20 @@ "es", | ||
"bootstrap": "yarn || npm i", | ||
"lint": "walrus lint", | ||
"test": "walrus test", | ||
"build": "lotus-tools build", | ||
"test": "umi-test" | ||
"docs": "ts-node scripts/buildDocs.ts", | ||
"predeploy": "yarn docs", | ||
"deploy": "gh-pages -d .typedoc" | ||
}, | ||
"devDependencies": { | ||
"@lotus-ui/tools": "^0.2.5", | ||
"@types/jest": "^24.0.12", | ||
"@types/qs": "^6.5.3", | ||
"@types/shelljs": "^0.8.5", | ||
"@walrus/cli": "^0.0.6", | ||
"gh-pages": "^2.1.1", | ||
"qs": "^6.7.0", | ||
"typescript": "^3.4.5", | ||
"umi-test": "^1.7.1" | ||
"shelljs": "^0.8.3", | ||
"ts-node": "^8.4.1", | ||
"typedoc": "^0.15.0", | ||
"typescript": "^3.4.5" | ||
}, | ||
@@ -31,0 +39,0 @@ "publishConfig": { |
144
README.md
@@ -9,17 +9,15 @@ <h1 align="center">autils</h1> | ||
## 特性 | ||
## ✨ 特性 | ||
* ✏️ TypeScript: 使用 TS 编写,类型友好 | ||
* ✨ 源于项目:日常项目的积累 | ||
* 🐳 严格测试:使用Jest对每个方法,进行严格的测试 | ||
* ⚡️ 按需加载: 支持按需加载,请配合babel-plugin-import使用 | ||
* ✏️ 使用TypeScript编写,类型友好 | ||
* ✨ 源于日常项目的积累,更实用 | ||
* 🐳 使用Jest进行严格测试,更稳定 | ||
* ⚡️ 支持按需加载,请配合babel-plugin-import使用 | ||
## 使用 | ||
## 📦 安装 | ||
1. 安装依赖 | ||
* npm安装 | ||
``` | ||
npm install -D @alitajs/autils | ||
npm install @alitajs/autils --save | ||
``` | ||
@@ -33,87 +31,51 @@ | ||
2. 使用 | ||
``` | ||
import { numberToChinese } from '@alitajs/autils'; | ||
## 📝 目录 | ||
// 一 | ||
console.log(numberToChinese(1)); | ||
<!-- 工具类!目录 --> | ||
### 工具类 | ||
* [ArabicChinese](https://alitajs.github.io/autils/classes/arabicchinese.html) 阿拉伯数字和中文数字互转 | ||
* [Policy](https://alitajs.github.io/autils/classes/policy.html) 解析权限策略,并提供验证功能 | ||
<!-- 工具类i目录 --> | ||
// 一万 | ||
console.log(numberToChinese(10000)); | ||
``` | ||
<!-- 工具函数!目录 --> | ||
### 工具函数 | ||
* [arrayToObject](https://alitajs.github.io/autils/globals.html#arraytoobject) 转换数组为对象 | ||
* [arrayToTree](https://alitajs.github.io/autils/globals.html#arraytotree) 将数组转换为树形结构数据 | ||
* [dedent](https://alitajs.github.io/autils/globals.html#dedent) 每一行紧跟前导空白的插入值,为多行时,保持缩进。并移除每一行的公共前导空白。 | ||
* [deepClone](https://alitajs.github.io/autils/globals.html#deepclone) 深拷贝 | ||
* [forOwn](https://alitajs.github.io/autils/globals.html#forown) 遍历对象的可枚举属性。若遍历函数返回 `false`,遍历会提前退出。 | ||
* [getType](https://alitajs.github.io/autils/globals.html#gettype) 检测 `value` 的类型 | ||
* [groupBy](https://alitajs.github.io/autils/globals.html#groupby) 根据迭代函数返回的值对 `data` 进行分组。 | ||
* [indent](https://alitajs.github.io/autils/globals.html#indent) 每一行紧跟前导空白的插入值为多行时,保持缩进。 | ||
* [isArray](https://alitajs.github.io/autils/globals.html#isarray) 检查 `value` 是否是一个数组 | ||
* [isBoolean](https://alitajs.github.io/autils/globals.html#isboolean) 检查 `value` 是否是一个布尔值。 | ||
* [isDate](https://alitajs.github.io/autils/globals.html#isdate) 检查 `value` 是否是一个日期 | ||
* [isEmail](https://alitajs.github.io/autils/globals.html#isemail) 检查`value`是否为邮箱。 | ||
* [isEmptyObject](https://alitajs.github.io/autils/globals.html#isemptyobject) 检查 `obj` 是否是一个空对象 | ||
* [isFunction](https://alitajs.github.io/autils/globals.html#isfunction) 检查 `value` 是否是一个函数 | ||
* [isIdCard](https://alitajs.github.io/autils/globals.html#isidcard) 检查 `value` 是否是一个身份证号 | ||
* [isInteger](https://alitajs.github.io/autils/globals.html#isinteger) 检查 `value` 是否是一个整数。 | ||
* [isNaN](https://alitajs.github.io/autils/globals.html#isnan) 检查 `value` 是否是 `NaN`。 | ||
* [isNegativeInteger](https://alitajs.github.io/autils/globals.html#isnegativeinteger) 检查 `value` 是否是一个负整数 | ||
* [isNil](https://alitajs.github.io/autils/globals.html#isnil) 检查 `value` 是否是 `null` 或 `undefined` | ||
* [isNull](https://alitajs.github.io/autils/globals.html#isnull) 检查 `value` 是否是 `null` | ||
* [isNumber](https://alitajs.github.io/autils/globals.html#isnumber) 检查 `value` 是否是一个数字。 | ||
* [isObject](https://alitajs.github.io/autils/globals.html#isobject) 检查 `value` 是否是一个对象 | ||
* [isPhone](https://alitajs.github.io/autils/globals.html#isphone) 检查`value`是否为手机号。 | ||
* [isPromise](https://alitajs.github.io/autils/globals.html#ispromise) 检查`value`是否为`Promise`。 | ||
* [isRegExp](https://alitajs.github.io/autils/globals.html#isregexp) 检查 `value` 是否是一个正则对象。 | ||
* [isString](https://alitajs.github.io/autils/globals.html#isstring) 检查 `value` 是否是一个字符串 | ||
* [isUndefined](https://alitajs.github.io/autils/globals.html#isundefined) 检查 `value` 是否等于 `undefined`。 | ||
* [isUrl](https://alitajs.github.io/autils/globals.html#isurl) 检查 `value` 是否是一个Url | ||
* [urlToList](https://alitajs.github.io/autils/globals.html#urltolist) 转换url为数组 | ||
<!-- 工具函数i目录 --> | ||
## 目录 | ||
### 📦 工具函数 | ||
* Array | ||
🔖 | 🔖 | 🔖 | 🔖 | ||
--- | --- | --- | --- | ||
[arrayToObject](#arrayToObject) | [arrayToTree](#arrayToTree) | [assign](#assign) | [assign](#assign) | ||
## API | ||
### arrayToObject | ||
将数组转换为对象 | ||
### arrayToTree | ||
将数组转换为树 | ||
### numberToChinese | ||
> 数字转中文工具方法 `numberToChinese(number: number): string` | ||
* 引入版本 | ||
0.0.1 | ||
* 参数 | ||
number(number): 需要转换的数字 | ||
* 返回值 | ||
(string): 转换后的文本 | ||
* 例子 | ||
``` | ||
numberToChinese(1); | ||
// => 一 | ||
``` | ||
## 按需加载 | ||
* 安装 `babel-plugin-import` | ||
``` | ||
yarn add --dev babel-plugin-import | ||
``` | ||
* 配置 | ||
``` | ||
// .babel.config.js | ||
module.exports = function (api) { | ||
api.cache(true) | ||
const plugins = [ | ||
[require.resolve('babel-plugin-import'), { | ||
libraryName: '@alitajs/autils', | ||
libraryDirectory: 'es', | ||
camel2DashComponentName: false | ||
}] | ||
]; | ||
return { | ||
plugins | ||
}; | ||
} | ||
``` | ||
<!-- 工具类型!目录 --> | ||
### 工具类型 | ||
* [AnyFunction](https://alitajs.github.io/autils/globals.html#anyfunction) 任意函数类型。 | ||
* [AnyObject](https://alitajs.github.io/autils/globals.html#anyobject) 任意对象类型。 | ||
* [Defined](https://alitajs.github.io/autils/globals.html#defined) 从 `T` 中排除 `undefined` 类型。 | ||
* [TBrand](https://alitajs.github.io/autils/globals.html#tbrand) 名义化类型。 | ||
* [TLiteralUnion](https://alitajs.github.io/autils/globals.html#tliteralunion) 字面量联合类型 | ||
<!-- 工具类型i目录 --> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
378535
314
5722
10
80
3