@sineverba/object-handler
v0.1.0
Published
NPM package to handle (manipulate) an array of objects. Useful to transform an API response for a select
Downloads
9
Readme
Object Handler
NPM package to handle (manipulate) an array of objects. Useful to transform an API response for a select.
| CI / CD | Status | | ------- | ------ | | NPM | | | Semaphore CI | | | Circle CI | | | Coverall | | | SonarCloud | |
Installation
npm install @sineverba/object-handler
Usage
- Import module
import { objectHandler } from "@sineverba/object-handler";
const initialObject = { id: 1, player_name: "foo" };
const mapping = { value: "id", label: "player_name" };
const transformedObject = objectHandler(initialObject, mapping);
console.log(transformedObject); // Output: { value: 1, label: "foo" }