trim-obj
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.3 • Public • Published

    Trim Obj

    GitHub package.json version GitHub license GitHub license

    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

    Install

    npm i trim-obj

    DownloadsWeekly Downloads

    2

    Version

    0.0.3

    License

    MIT

    Unpacked Size

    19.6 kB

    Total Files

    12

    Last publish

    Collaborators

    • riscarrott