Comparing version 1.18.0 to 2.0.0
{ | ||
"name": "utility", | ||
"version": "1.18.0", | ||
"version": "2.0.0", | ||
"description": "A collection of useful utilities.", | ||
"main": "utility.js", | ||
"files": [ | ||
"*.js", | ||
"index.d.ts" | ||
], | ||
"scripts": { | ||
"test": "npm run lint && npm run test-local", | ||
"test-ts": "npm run test-local-ts", | ||
"test-local": "ava test/**/*.test.js", | ||
"test-local-ts": "ava-ts test_ts/**/*.test.ts", | ||
"test-cov": "nyc ava test/**/*.test.js && nyc report --reporter=lcov", | ||
"lint": "jshint .", | ||
"ci": "npm run lint && npm run test-cov && npm run test-ts", | ||
"test-optimized": "node --allow-natives-syntax --trace_opt --trace_deopt test/optimized.js", | ||
"contributor": "git-contributor" | ||
"lint": "eslint src test --ext ts", | ||
"pretest": "npm run lint -- --fix && npm run prepublishOnly", | ||
"test": "egg-bin test", | ||
"test-local": "egg-bin test", | ||
"preci": "npm run prepublishOnly", | ||
"ci": "egg-bin cov", | ||
"contributor": "git-contributor", | ||
"prepublishOnly": "tshy && tshy-after" | ||
}, | ||
"dependencies": { | ||
"copy-to": "^2.0.1", | ||
"escape-html": "^1.0.3", | ||
"mkdirp": "^0.5.1", | ||
"mz": "^2.7.0", | ||
"unescape": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/escape-html": "0.0.20", | ||
"@types/node": "^10.12.12", | ||
"ava": "^0.25.0", | ||
"ava-ts": "^0.25.2", | ||
"beautify-benchmark": "*", | ||
"benchmark": "^2.1.0", | ||
"@eggjs/tsconfig": "^1.3.3", | ||
"@types/escape-html": "^1.0.4", | ||
"@types/mocha": "^10.0.6", | ||
"@types/node": "^20.10.0", | ||
"beautify-benchmark": "^0.2.4", | ||
"benchmark": "^2.1.4", | ||
"contributors": "*", | ||
"git-contributor": "^1.0.10", | ||
"jshint": "*", | ||
"egg-bin": "^6.5.2", | ||
"eslint": "^8.54.0", | ||
"eslint-config-egg": "^13.0.0", | ||
"git-contributor": "^2.1.5", | ||
"moment": "^2.22.2", | ||
"nyc": "6", | ||
"object-assign": "^4.1.1", | ||
"optimized": "^1.2.0", | ||
"rimraf": "^2.6.2", | ||
"time-require": "^0.1.2", | ||
"ts-node": "^7.0.1", | ||
"typescript": "^5.0.4" | ||
"tsd": "^0.28.1", | ||
"tshy": "^1.8.1", | ||
"tshy-after": "^1.0.0", | ||
"typescript": "^5.2.2" | ||
}, | ||
@@ -50,4 +43,3 @@ "homepage": "https://github.com/node-modules/utility", | ||
"type": "git", | ||
"url": "git://github.com/node-modules/utility.git", | ||
"web": "https://github.com/node-modules/utility" | ||
"url": "git://github.com/node-modules/utility.git" | ||
}, | ||
@@ -64,6 +56,32 @@ "keywords": [ | ||
"engines": { | ||
"node": ">= 0.12.0" | ||
"node": ">= 16.0.0" | ||
}, | ||
"author": "fengmk2 <fengmk2@gmail.com> (https://github.com/fengmk2)", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"type": "module", | ||
"tshy": { | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": "./src/index.ts" | ||
} | ||
}, | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"import": { | ||
"types": "./dist/esm/index.d.ts", | ||
"default": "./dist/esm/index.js" | ||
}, | ||
"require": { | ||
"types": "./dist/commonjs/index.d.ts", | ||
"default": "./dist/commonjs/index.js" | ||
} | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"main": "./dist/commonjs/index.js", | ||
"types": "./dist/commonjs/index.d.ts" | ||
} |
# utility | ||
[![NPM version][npm-image]][npm-url] | ||
[![build status][travis-image]][travis-url] | ||
[![CI](https://github.com/node-modules/utility/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/utility/actions/workflows/nodejs.yml) | ||
[![Test coverage][codecov-image]][codecov-url] | ||
[![npm download][download-image]][download-url] | ||
[![Dependency Status][dependency-image]][dependency-url] | ||
[![devDependency Status][devDependency-image]][devDependency-url] | ||
[npm-image]: https://img.shields.io/npm/v/utility.svg?style=flat-square | ||
[npm-url]: https://npmjs.org/package/utility | ||
[travis-image]: https://img.shields.io/travis/node-modules/utility.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/node-modules/utility | ||
[codecov-image]: https://codecov.io/github/node-modules/utility/coverage.svg?branch=master | ||
@@ -18,6 +14,2 @@ [codecov-url]: https://codecov.io/github/node-modules/utility?branch=master | ||
[download-url]: https://npmjs.org/package/utility | ||
[dependency-image]: https://david-dm.org/node-modules/utility.svg | ||
[dependency-url]: https://david-dm.org/node-modules/utility | ||
[devDependency-image]: https://david-dm.org/node-modules/utility/dev-status.svg | ||
[devDependency-url]: https://david-dm.org/node-modules/utility#info=devDependencies | ||
@@ -29,3 +21,3 @@ A collection of useful utilities. | ||
```bash | ||
$ npm install utility | ||
npm install utility | ||
``` | ||
@@ -38,4 +30,6 @@ | ||
``` | ||
Also you can use it within typescript, like this ↓ | ||
```js | ||
```ts | ||
import * as utility from 'utility'; | ||
@@ -224,3 +218,5 @@ ``` | ||
``` | ||
```Note``` that when you use ```typescript```, you must use the following methods to call ' Try ' | ||
```js | ||
@@ -236,3 +232,3 @@ import * as utility from 'utility'; | ||
```js | ||
function() { | ||
function foo() { | ||
const arr = utility.argumentsToArray(arguments); | ||
@@ -265,3 +261,3 @@ console.log(arr.join(', ')); | ||
> **Hint:** In `utils.writeJSON*()`, if `pkg` is an object, the **optional** third parameter `options` may contain two | ||
> __Hint:__ In `utils.writeJSON*()`, if `pkg` is an object, the __optional__ third parameter `options` may contain two | ||
> keys. | ||
@@ -274,9 +270,7 @@ > | ||
> | ||
> + https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter | ||
> + https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument | ||
> + <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter> | ||
> + <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument> | ||
### Object.assign | ||
```js | ||
@@ -292,7 +286,7 @@ // assign object | ||
* [jsperf: access log date format](http://jsperf.com/access-log-date-format) | ||
* [benchmark/date_format.js](https://github.com/fengmk2/utility/blob/master/benchmark/date_format.js) | ||
+ [jsperf: access log date format](http://jsperf.com/access-log-date-format) | ||
+ [benchmark/date_format.js](https://github.com/node-modules/utility/blob/master/benchmark/date_format.cjs) | ||
```bash | ||
$ node benchmark/date_format.js | ||
$ node benchmark/date_format.cjs | ||
@@ -317,6 +311,6 @@ moment().format("DD/MMM/YYYY:HH:mm:ss ZZ"): "16/Apr/2013:21:12:32 +0800" | ||
[benchmark/date_YYYYMMDD.js](https://github.com/fengmk2/utility/blob/master/benchmark/date_YYYYMMDD.js) | ||
[benchmark/date_YYYYMMDD.js](https://github.com/node-modules/utility/blob/master/benchmark/date_YYYYMMDD.cjs) | ||
```bash | ||
$ node benchmark/date_YYYYMMDD.js | ||
$ node benchmark/date_YYYYMMDD.cjs | ||
@@ -337,7 +331,8 @@ parseInt(moment().format("YYYYMMDD"), 10): 20130416 | ||
|[<img src="https://avatars0.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars3.githubusercontent.com/u/985607?v=4" width="100px;"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src="https://avatars1.githubusercontent.com/u/1147375?v=4" width="100px;"/><br/><sub><b>alsotang</b></sub>](https://github.com/alsotang)<br/>|[<img src="https://avatars1.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars2.githubusercontent.com/u/1207064?v=4" width="100px;"/><br/><sub><b>gxcsoccer</b></sub>](https://github.com/gxcsoccer)<br/>|[<img src="https://avatars3.githubusercontent.com/u/2842176?v=4" width="100px;"/><br/><sub><b>XadillaX</b></sub>](https://github.com/XadillaX)<br/>| | ||
|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/985607?v=4" width="100px;"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src="https://avatars.githubusercontent.com/u/1147375?v=4" width="100px;"/><br/><sub><b>alsotang</b></sub>](https://github.com/alsotang)<br/>|[<img src="https://avatars.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars.githubusercontent.com/u/1207064?v=4" width="100px;"/><br/><sub><b>gxcsoccer</b></sub>](https://github.com/gxcsoccer)<br/>|[<img src="https://avatars.githubusercontent.com/u/5127897?v=4" width="100px;"/><br/><sub><b>danielsss</b></sub>](https://github.com/danielsss)<br/>| | ||
| :---: | :---: | :---: | :---: | :---: | :---: | | ||
[<img src="https://avatars1.githubusercontent.com/u/24466804?v=4" width="100px;"/><br/><sub><b>mosikoo</b></sub>](https://github.com/mosikoo)<br/>|[<img src="https://avatars2.githubusercontent.com/u/2569835?v=4" width="100px;"/><br/><sub><b>haoxins</b></sub>](https://github.com/haoxins)<br/>|[<img src="https://avatars1.githubusercontent.com/u/546535?v=4" width="100px;"/><br/><sub><b>leoner</b></sub>](https://github.com/leoner)<br/>|[<img src="https://avatars3.githubusercontent.com/u/33921398?v=4" width="100px;"/><br/><sub><b>ddzy</b></sub>](https://github.com/ddzy)<br/> | ||
|[<img src="https://avatars.githubusercontent.com/u/2842176?v=4" width="100px;"/><br/><sub><b>XadillaX</b></sub>](https://github.com/XadillaX)<br/>|[<img src="https://avatars.githubusercontent.com/u/23133919?v=4" width="100px;"/><br/><sub><b>ulivz</b></sub>](https://github.com/ulivz)<br/>|[<img src="https://avatars.githubusercontent.com/u/24466804?v=4" width="100px;"/><br/><sub><b>mosikoo</b></sub>](https://github.com/mosikoo)<br/>|[<img src="https://avatars.githubusercontent.com/u/546535?v=4" width="100px;"/><br/><sub><b>leoner</b></sub>](https://github.com/leoner)<br/>|[<img src="https://avatars.githubusercontent.com/u/8603442?v=4" width="100px;"/><br/><sub><b>legend80s</b></sub>](https://github.com/legend80s)<br/>|[<img src="https://avatars.githubusercontent.com/u/32174276?v=4" width="100px;"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>| | ||
[<img src="https://avatars.githubusercontent.com/u/33921398?v=4" width="100px;"/><br/><sub><b>ddzy</b></sub>](https://github.com/ddzy)<br/>|[<img src="https://avatars.githubusercontent.com/u/8896314?v=4" width="100px;"/><br/><sub><b>zhanghengyao</b></sub>](https://github.com/zhanghengyao)<br/> | ||
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sat Mar 23 2019 12:09:41 GMT+0800`. | ||
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Mon Dec 11 2023 00:23:06 GMT+0800`. | ||
@@ -344,0 +339,0 @@ <!-- GITCONTRIBUTOR_END --> |
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
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
166904
2
60
2930
Yes
19
334
- Removedcopy-to@^2.0.1
- Removedmkdirp@^0.5.1
- Removedmz@^2.7.0
- Removedany-promise@1.3.0(transitive)
- Removedcopy-to@2.0.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedmz@2.7.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedthenify@3.3.1(transitive)
- Removedthenify-all@1.6.0(transitive)