1.0.1 • Published 3 years ago

@sir_koty/json-extractor v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
3 years ago

JSON-EXTRACTOR

This library make easy the way to extract property into a json object

Installation

Usage the npm package manager npm to install json-extractor

npm install @sir_koty/json-extractor

Usage

import { jsonExtract } from '@sir_koty/json-extractor';

const myData = { person: { 
                            firstname: 'J@mes', 
                            lastname: 'Bond'
                 },
                 country: {
                            name: 'Ivory Coast',
                            code: 225
                  }
                };
const propertiesToExtract = ['person/firstname+lastname@fullname', 'country/name'];
const newJson = jsonExtract(myData, propertiesToExtract);

// newJson value {fullname: 'J@mes Bond', country__name: 'Ivory Coast' }
console.log('newJson value ', newJson);

Demo

Sample on Stackblitz

License

MIT

1.0.1

3 years ago

1.0.0

3 years ago