array-unique-zjj
v1.0.0
Published
``` npm install zjj-time ```
Downloads
7
Maintainers
Readme
安装
npm install zjj-time
使用 基本数据类型数组去重
const { unique } = require('./index.js');
let arr = [1,2,3,1,2,3,4,5];
console.log(unique(arr)); // [1,2,3,4,5]
使用 复杂数据类型数组去重
const { unique } = require('./index.js');
let arr = [
{ name: "张三", id: 1},
{ name: "李四", id: 2},
{ name: "王五", id: 2},
{ name: "赵六", id: 4}
]
console.log(unique(arr, 'id')); // [{ name: "张三", id: 1},{ name: "李四", id: 2},{ name: "赵六", id: 4}]
对package.json的理解
{
"name": "zjj-time", // 包名
"version": "1.0.0", // 版本
"description": "格式化时间", // 包的功能描述
"main": "index.js", // 被导入时的入口
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [], // 搜索关键字 npm搜什么容易找到这个包
"author": "",
"license": "ISC" // 遵循的协议
}