Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thinkjs/think-helper

Helper for ThinkJS 3.x
https://github.com/thinkjs/think-helper

helpers thinkjs thinkjs3

Last synced: 4 days ago
JSON representation

Helper for ThinkJS 3.x

Awesome Lists containing this project

README

        

# think-helper
[![Build Status](https://travis-ci.org/thinkjs/think-helper.svg?branch=master)](https://travis-ci.org/thinkjs/think-helper)
[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-helper/badge.svg)](https://coveralls.io/github/thinkjs/think-helper)
[![npm](https://img.shields.io/npm/v/think-helper.svg)](https://www.npmjs.com/package/think-helper)

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

## Installation

Using npm:

```sh
npm install think-helper
```

In Node.js:

```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} | omit object props