Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/realign/n-tools

a util tool for dev
https://github.com/realign/n-tools

Last synced: 8 days ago
JSON representation

a util tool for dev

Awesome Lists containing this project

README

        

# n-tools
开发工具函数

## methods
| name | note | other |
| --- | --- | --- |
| typeof | | |
| compareObject | 复杂类型数据比较 | |
| deepClone | 深拷贝 | |
| extend | | |
| merge | | |
| arrayEquals | 数组比较 | |
| keepDecimal | | |
| formatDigital | | |
| deepGet | 深获取 | |

## Usage

```
let _ = require( 'n-tools' );

_.compareObject(x, y);
```

### deepGet

```
var obj = {
a: [
{
b: {
c: 3
}
}
],
e: {
f: [
{
g: 'alj'
},
{
g: 'kakaka'
}
]
}
};

var result = '';

for(var kk = 0; kk < 3; kk++) {
result = _.deepGet(obj, 'e.f[' + kk +'].g', '');
console.log(result);
}

// 'alj'
// 'kakaka'
// ''
```