New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

clarify-js

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clarify-js

Flatten and simplify javascript objects

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Build Status

Clarify

clarify-js is a small utility library with the intent of simplifying and/or serializing javascript objects. We all know about JSON.stringify, but if any of us have ever tried serializing an Error object, we know it doesn't always work how we might expect.

JSON.stringify has two core properties that sometimes make it hard to cache our javascript objects:

  • It does not serialize properties on the prototype
  • It will not serialize properties that are non-enumerable

Now hopefully you will go your entire career without needing clarify-js, as most of the time the objects you are serializing are fully in your control. In the event that you're working with a package or library that generates these difficult to work with objects, it's this simple:

import clarify from "clarify-js";

const simplifiedObject = clarify(nonEnumerableObject);
const json = JSON.stringify(simplifiedObject);

OR

import { serialize } from "clarify-js";

const json = serialize(nonEnumerableObject);

For those of you not using import:

const clarify = require("clarify-js").default;

const simplifiedObject = clarify(nonEnumerableObject);

Keywords

javascript

FAQs

Package last updated on 22 Aug 2017

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