Package Exports
- trim-obj
- trim-obj/dist/trim-obj.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (trim-obj) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Trim Obj
Recursively trim object values.
Install
NPM
npm install trim-obj
Yarn
yarn add trim-obj
Usage
import { trimObj } from "trim-obj";
const input = {
firstName: " Lewis",
lastName: "Hamilton ",
age: 36,
avatar: {
url: " https://static.wixstatic.com/media/23204b_787f58851a1042648b78f23f45adfe5c~mv2.jpg/v1/fill/w_1710,h_1592,al_c,q_90/23204b_787f58851a1042648b78f23f45adfe5c~mv2.webp ",
size: ["1000 ", " 2000px "],
},
};
const output = trimObj(input);
console.log(output);
// {
// firstName: "Lewis",
// lastName: "Hamilton",
// age: 36,
// avatar: {
// url: "https://static.wixstatic.com/media/23204b_787f58851a1042648b78f23f45adfe5c~mv2.jpg/v1/fill/w_1710,h_1592,al_c,q_90/23204b_787f58851a1042648b78f23f45adfe5c~mv2.webp",
// size: ["1000", "2000px"],
// },
// }
console.log(output === input);
// false