Skip to content
Helper for ThinkJS 3.x
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Merge branch 'master' of github.com:thinkjs/think-helper May 27, 2018
.eslintrc Fix eslint errors Jul 12, 2017
.gitignore
.npmignore
.travis.yml update Feb 13, 2017
LICENSE Update year in LICENSE Feb 13, 2017
README.md update readme.md Aug 16, 2017
index.d.ts update d.ts, most about some params is optional and has default value Sep 19, 2017
index.js
package.json change type to types in package.json Sep 28, 2018

README.md

think-helper

Build Status Coverage Status npm

think-helper defines a set of helper functions for ThinkJS.

Installation

Using npm:

npm install think-helper

In Node.js:

import helper from 'think-helper';

let md5 = helper.md5('');

APIs:

API Param Description
isInt check integer
isIP check IP
isIPv4 check IPv4
isIPv6 check IPv6
isMaster cluster.isMaster
isArray arg{mix}
return{Boolean}
check if a variable is an Array
isBoolean arg{mix}
return{Boolean}
check if a variable is an Boolean
isNull arg{mix}
return{Boolean}
check if a variable is an null
isNullOrUndefined arg{mix}
return{Boolean}
check if a variable is null or undefined
isNumber arg{mix}
return{Boolean}
check if a variable is an Number
isString arg{mix}
return{Boolean}
check if a variable is an String
isSymbol arg{mix}
return{Boolean}
check if a variable is an Symbol
isUndefined arg{mix}
return{Boolean}
check if a variable is an undefined
isRegExp arg{mix}
return{Boolean}
check if a variable is an RegExp
isObject arg{mix}
return{Boolean}
check if a variable is an Object
isDate arg{mix}
return{Boolean}
check if a variable is an Date
isError arg{mix}
return{Boolean}
check if a variable is an Error
isFunction arg{mix}
return{Boolean}
check if a variable is an Function
isPrimitive arg{mix}
return{Boolean}
check if a variable is an Primitive
isBuffer arg{mix}
return{Boolean}
check if a variable is an Buffer
promisify function{function}
receiver{object}
return Promise
make callback function to promise
extend target{object|array}
args{Object|Array}
return{Object}
extend object
camelCase str{string}
return{String}
make indexAction to index_action
isNumberString str{string}
return{Boolean}
check object is number string
isTrueEmpty obj{mixed}
return{Boolean}
truely
isEmpty obj{object}
return{Boolean}
check object is mepty
defer return defer get deferred object
md5 str{string}
return{string}
get content md5
timeout time{Number}
return Promise
get timeout Promise
escapeHtml str{String}
return {string}
escape html
datetime date{Date|String}
format{String}
return{String}
get datetime
uuid version{String} v1 or v4 generate uuid
isExist dir{String} check path is exist
isFile filePath{String} check filepath is file
isDirectory filePath{String} check path is directory
chmod path{String}
mode{String}
change path mode
mkdir dir{String}
mode{String}
make dir
getdirFiles dir{String}
prefix{String}
get files in path
rmdir path{String}
reserve{Boolean}
return{Promise}
remove dir async
parseAdapterConfig config{Object}
extConfig{Object|String}
parse adapter config
ms time{String} transform humanize time to ms
omit obj{obj}
prop {String
Array}
You can’t perform that action at this time.