npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

json-serializer

v2.0.12

Published

JSON compatible serializer and deserializer for javascript.

Downloads

100

Readme

json-serializer

The purpose of this library is to have a generic object serialization tool that is JSON compatible (by default). Apart from JSON.stringify(object) compatible json.serialize(object) function, json.serialize can be passed with config options json.serialize(object, config), which properties can be described:

  • excludedInstances=undefined Array of instances that will be excluded from object tree elements (instanceof check)
  • level=undefined Level number (>=1) that serializer should not go below
  • excludedTypes=undefined Array of types that will be excluded from object tree elements (typeof check)
  • excludedNames=undefined Array of property names that will be excluded from object tree elements
  • own=undefined If use hasOwnProperty should be used while checking if object property will be added
  • excludeOnTrue=undefined function reference that will be used to decide which elements will be included
  • dateAsString=true How date will be returned
  • raw = false dont use "json" standard output and serialize real values (undefines, dates as numbers etc)
  • includeFunctions=false if functions will be ignored or not, if not, they will be treated like objects
  • fakeFunctions = false if includeFunctions is used, this options tell to return blank function instead of traversing it as object
  • realFunctions = false if includeFunctions is used, functions will be returned as their "toString()" values
  • prettyPrint=false return output "prettyfied", it does not prettify functions contents.

By default json.serialize(object) will output normal JSON, same as known JSON.stringify.

json have following features:

  • does not pollute Object.prototype - it is simple static function
  • implementation is very minimal and kept simple (feel free to commit to work)
  • delivers function json.parse which is a similar method to JSON.parse, with a simpler regex used.

If you have any queries or sugesstions please write to [email protected]