suffix-array
v0.1.4
Published
Rename duplicates in an array object
Downloads
3
Readme
suffix-array
Rename duplicates in an array object
Installation
npm install suffix-array
Example
import {suffixArrayObject} from 'suffix-array';
const arr = [
{
name: 'John',
age: 17,
},
{
name: 'Rudy',
age: 18,
},
{
name: 'Stella',
age: 19,
},
{
name: 'Rudy',
age: 20,
},
{
name: 'John',
age: 21,
},
{
name: 'Rudy',
age: 22,
},
{
name: 'Rudy',
age: 23,
},
];
suffixArrayObject(arr, 'name', '_{holder}');
Result
[
{
"name": "John",
"age": 17
},
{
"name": "Rudy",
"age": 18
},
{
"name": "Stella",
"age": 19
},
{
"name": "Rudy_1",
"age": 20
},
{
"name": "John_1",
"age": 21
},
{
"name": "Rudy_2",
"age": 22
},
{
"name": "Rudy_3",
"age": 23
}
]
License
MIT