json-nested-replace

1.1.0 • Public • Published

json-nested-replace

Build NPM Version NPM Downloads Github Repo Size LICENSE Contributors Commit

Searches and replace values at every level of nested json

Give us a if you like our work ❤️

Install

$ npm install json-nested-replace

Usage

const jnestedReplace = require('json-nested-replace');

const INPUT_JSON = {
  'name': 'json-nested-replace',
  'author': 'Arshad Kazmi',
  'repository': {
    'url': 'https://github.com/arshadkazmi42/json-nested-replace',
    'language': 'js'
  }
};

const replacedJSONValue = jnestedReplace(INPUT_JSON, 'json-nested-replace', 'jnested-replace', ['url']);
console.log(replacedJSONValue);
// Output
/** {
 *   'name': 'jnested-replace',
 *   'author': 'Arshad Kazmi',
 *   'repository': {
 *     'url': 'https://github.com/arshadkazmi42/json-nested-replace',
 *     'language': 'js'
 *   }
 * }
 **/

Function Parameters

Function jnestedReplace takes following parameters respectively

  • input: Object/Array on which nested replace to apply
  • searchValue: Value which needs to be replaced in the JSON
  • newValue: New Value which needs to be added in place of searchValue
  • skipKeys: Optinal field, if any key needs to be skipped from this replacing

Contributing

Interested in contributing to this project? You can log any issues or suggestion related to this library here

Read our contributing guide on getting started with contributing to the codebase

Contributors

Thank you to all the contributors who have helped us in making this project better 🙌

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    10
    • latest

Version History

Package Sidebar

Install

npm i json-nested-replace

Weekly Downloads

11

Version

1.1.0

License

MIT

Unpacked Size

6.7 kB

Total Files

4

Last publish

Collaborators

  • arshadkazmi42