@esmilo/yamato

1.0.2 • Public • Published

The sword is said to be able to cut through anything, even the very fabric of space itself.


Yamato is an express middleware to remove extra whitespace(s) inside your request body. For example, if you send a json like this:

{
  "name": "  Dimitri Wahyudiputra",
  "hobbies": ["  Music ", " Playing Tekken"],
  "personalInfo": {
    "phoneNumber": " +6281234567890   ",
    "address": " Somewhere on earth"
  },
  "isPrivate": true
}

Yamato will trim all the extra whitespaces so you'll get:

{
  "name": "Dimitri Wahyudiputra",
  "hobbies": ["Music", "Playing Tekken"],
  "personalInfo": {
    "phoneNumber": "+6281234567890",
    "address": "Somewhere on earth"
  },
  "isPrivate": true
}

Usage

Install Yamato

npm install @esmilo/yamato

Invoke Yamato as a middleware after body-parser

// ...

const yamato = require('@esmilo/yamato');

app.use(express.urlencoded({ extended: false }));
app.use(express.json());
app.use(yamato());

// ...

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i @esmilo/yamato

    Weekly Downloads

    1

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    3.4 kB

    Total Files

    5

    Last publish

    Collaborators

    • dmtrxw
    • ijtj