Socket
Book a DemoInstallSign in
Socket

bs-clean-deep

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bs-clean-deep

Remove empty or nullable values from javascript objects

2.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
-88.89%
Maintainers
1
Weekly downloads
 
Created
Source

bs-clean-deep

NPM version Build Status

Bindings for clean-deep, a library for removing empty or nullable values from javascript objects.

Getting started

yarn add bs-clean-deep

Then add bs-clean-deep as a dependency to bsconfig.json:

"bs-dependencies": [
+  "bs-clean-deep"
]

Example

open BsCleanDeep;

let jsObject = [%bs.raw {|
{
  bar: {},
  baz: null,
  biz: 'baz',
  foo: '',
  net: [],
  nit: undefined,
  qux: {
    baz: 'boz',
    txi: ''
  }
}
|}];

let cleaned = CleanDeep.cleanDeep(jsObject);

Js.log(cleaned);
/* => { biz: 'baz', qux: { baz: 'boz' } } */

let cleanedKeepStrings = jsObject |> CleanDeep.cleanDeep(~emptyStrings=false);

Js.log(cleanedKeepStrings);
/* => { biz: 'baz', foo: '', qux: { baz: 'boz', txi: '' } } */

let cleanedCustomValues = jsObject |> CleanDeep.cleanDeep(~cleanValues=[|"baz"|]);

Js.log(cleanedCustomValues);
/* => { qux: { baz: 'boz' } } */

See also example-project.

Contribute

If you find bugs or there are updates in clean-deep, feel free to open an issue or PR. If you are upgrading any dependencies, please use yarn so yarn.lock is updated.

Keywords

BuckleScript

FAQs

Package last updated on 06 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.