Skip to content

Helper for ThinkJS 3.x

License

Notifications You must be signed in to change notification settings

thinkjs/think-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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}