Socket
Book a DemoInstallSign in
Socket

pretty-immutable

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pretty-immutable

Pretty printing for ImmutableJS

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
41
-41.43%
Maintainers
1
Weekly downloads
 
Created
Source

pretty-immutable

Pretty printing for ImmutableJS

Heavily inspired by (and dependent on) json-stringify-pretty-compact.

npm version Build Status MIT Licensed

Install

npm install pretty-immutable

This library will only work (or really make any sense) if you also have immutable installed.

Usage

var Immutable = require("immutable");
var prettyI = require("pretty-immutable");

var bigMap = Immutable.fromJS({
  a: [1, 2, 3, 4],
  b: {
    blah: {
      blah: [
        {a: 1},
        {b: 2},
        {c: 3}
      ]
    }
  }
});

// Use as a formatter
console.log(prettyI(bigMap)); /*
Map {
  "a": List [ 1, 2, 3, 4 ],
  "b": Map {
    "blah": Map {
      "blah": List [
        Map { "a": 1 },
        Map { "b": 2 },
        Map { "c": 3 }
      ]
    }
  }
}
*/

// Override the built-in inspect() method
prettyI.install(Immutable);

console.log(bigMap.inspect()); /*
Map {
  "a": List [ 1, 2, 3, 4 ],
  "b": Map {
    "blah": Map {
      "blah": List [
        Map { "a": 1 },
        Map { "b": 2 },
        Map { "c": 3 }
      ]
    }
  }
}
*/

License

Copyright 2016 Glen Mailer.

MIT Licensed.

Keywords

immutable

FAQs

Package last updated on 15 Jun 2016

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