This package has been deprecated

Author message:

this package has been deprecated

suppress-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

suppressJS

Suppress json object to speed up your rest api, by removing duplicate entities

What suppressJS does

If you are using nosql database, and your table is look like this, so do suppress of this json, exlude all entities to a nother store object. See here the result.

Why should i use this package

  1. decrease response size, in my example, 674 kb became to 140kb; end response time 53ms became to 33ms.
  2. decrease memory size, if you store the object in memory, using suppress and de-supress, does decrease memory size dramaticaly. in my exmple, 755780B became to 189296B.

Usage

install by npm

npm i suppress-js

suppress response data by:

import { suppress, deSuppress } from 'suppress-js';
suppress(result, //* id property, defualt :'_id'*//);

de-suppress response data by

deSuppress(response);

Use it as express middleware

    resolve = (req, res, next) => {
       const json = res.json;
       res.json = (result) => {
           const suppressResult = suppress(result);
           return json.call(res, suppressResult);
       };
       return next();
   }

Readme

Keywords

none

Package Sidebar

Install

npm i suppress-js

Weekly Downloads

0

Version

1.0.7

License

ISC

Unpacked Size

1.71 MB

Total Files

21

Last publish

Collaborators

  • yantrab