1.0.3 • Published 1 year ago

polyfill-json-stringify-omit-null-value v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Polyfill - JSON.stringify() - omit null value

Change original JSON.stringify method to omit null values by default

Usage

npm install polyfill-json-stringify-omit-null-value

Then require this script somewhere before all you start using it:

With Javascript:

// with Javascript
require('polyfill-json-stringify-omit-null-value');
const express = require('express');

// with Typescript
import 'polyfill-json-stringify-omit-null-value';
import express from 'express';

When using typescript with ts-node, you can import this directly in tsconfig.json file like this:

{
  "compilerOptions": {},
  "ts-node": {
    "require": [
      "polyfill-json-stringify-omit-null-value"
    ]
  }
}

This polyfill works on both the backend and frontend and works by modifying the JSON.stringify() method so that by default it ignores keys that have a null value

Enjoy!

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago