{"id":13445866,"url":"https://github.com/thinkjs/think-helper","last_synced_at":"2025-06-19T00:05:07.095Z","repository":{"id":48470257,"uuid":"61360270","full_name":"thinkjs/think-helper","owner":"thinkjs","description":"Helper for ThinkJS 3.x","archived":false,"fork":false,"pushed_at":"2022-08-27T05:32:16.000Z","size":81,"stargazers_count":20,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T17:37:35.681Z","etag":null,"topics":["helpers","thinkjs","thinkjs3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinkjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-17T08:58:19.000Z","updated_at":"2022-09-09T05:09:03.000Z","dependencies_parsed_at":"2023-01-16T21:16:00.564Z","dependency_job_id":null,"html_url":"https://github.com/thinkjs/think-helper","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/thinkjs/think-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkjs","download_url":"https://codeload.github.com/thinkjs/think-helper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-helper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260654642,"owners_count":23042675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["helpers","thinkjs","thinkjs3"],"created_at":"2024-07-31T05:00:40.916Z","updated_at":"2025-06-19T00:05:02.079Z","avatar_url":"https://github.com/thinkjs.png","language":"JavaScript","funding_links":[],"categories":["第三方库介绍"],"sub_categories":["工具库"],"readme":"# think-helper\n[![Build Status](https://travis-ci.org/thinkjs/think-helper.svg?branch=master)](https://travis-ci.org/thinkjs/think-helper)\n[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-helper/badge.svg)](https://coveralls.io/github/thinkjs/think-helper)\n[![npm](https://img.shields.io/npm/v/think-helper.svg)](https://www.npmjs.com/package/think-helper)\n\n`think-helper` defines a set of helper functions for ThinkJS.\n\n## Installation\n\nUsing npm:\n\n```sh\nnpm install think-helper\n```\n\nIn Node.js:\n\n```js\nimport helper from 'think-helper';\n\nlet md5 = helper.md5('');\n\n```\n\nAPIs:\n\nAPI | Param | Description\n---|---|---\n`isInt` |  | check integer\n`isIP` |  | check IP\n`isIPv4`   |  | check IPv4\n`isIPv6`   |  | check IPv6\n`isMaster`   | |cluster.isMaster\n`isArray`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an Array\n`isBoolean`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an Boolean\n`isNull`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an null\n`isNullOrUndefined`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is null or undefined\n`isNumber`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an Number\n`isString`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an String\n`isSymbol`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an Symbol\n`isUndefined`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an undefined\n`isRegExp`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an RegExp\n`isObject`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an Object\n`isDate`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an Date\n`isError`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an Error\n`isFunction`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an Function\n`isPrimitive`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an Primitive\n`isBuffer`   | `arg`{mix}\u003cbr\u003e`return`{Boolean} | check if a variable is an Buffer\n`promisify`   |  `function`{function}\u003cbr\u003e`receiver`{object}\u003cbr\u003e`return` Promise  | make callback function to promise\n`extend`   | `target`{object\\|array}\u003cbr\u003e `args`{Object\\|Array}\u003cbr\u003e`return`{Object} | extend object\n`camelCase`   | `str`{string}\u003cbr\u003e`return`{String} | make indexAction to index_action\n`isNumberString`   | `str`{string} \u003cbr\u003e `return`{Boolean} | check object is number string\n`isTrueEmpty`   | `obj`{mixed} \u003cbr\u003e `return`{Boolean}| truely\n`isEmpty`   | `obj`{object}  \u003cbr\u003e `return`{Boolean}| check object is mepty\n`defer`   | `return` defer | get deferred object\n`md5`   | `str`{string} \u003cbr\u003e `return`{string} | get content md5\n`timeout`   | `time`{Number} \u003cbr\u003e `return` Promise | get timeout Promise\n`escapeHtml`   | `str`{String}\u003cbr\u003e `return` {string} | escape html\n`datetime`   | `date`{Date\\|String}\u003cbr\u003e`format`{String}\u003cbr\u003e`return`{String} | get datetime\n`uuid`   | `version`{String} v1 or v4 | generate uuid\n`isExist`   | `dir`{String} | check path is exist\n`isFile`   | `filePath`{String} | check filepath is file\n`isDirectory`   | `filePath`{String}  | check path is directory\n`chmod`   | `path`{String}\u003cbr\u003e `mode`{String}  | change path mode\n`mkdir`   | `dir`{String}\u003cbr\u003e `mode`{String} | make dir\n`getdirFiles`   | `dir`{String}\u003cbr\u003e `prefix`{String} | get files in path\n`rmdir`   | `path`{String}\u003cbr\u003e `reserve`{Boolean}\u003cbr\u003e`return`{Promise} | remove dir async\n`parseAdapterConfig` | `config`{Object}\u003cbr\u003e `extConfig`{Object\\|String} | parse adapter config\n`ms` | `time`{String} | transform humanize time to ms\n`omit` | `obj`{obj} \u003cbr\u003e `prop` {String|Array} | omit object props\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkjs%2Fthink-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkjs%2Fthink-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkjs%2Fthink-helper/lists"}