Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

immutable-devtools

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immutable-devtools - npm Package Compare versions

Comparing version 0.0.7 to 0.1.0

80

dist/index.js

@@ -55,5 +55,5 @@ (function webpackUniversalModuleDefinition(root, factory) {

/* 0 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {"use strict";

@@ -79,5 +79,3 @@ Object.defineProperty(exports, "__esModule", {

function install(Immutable) {
if (typeof window === "undefined") {
throw new Error("Can only install immutable-devtools in a browser environment.");
}
var gw = typeof window === "undefined" ? global : window;

@@ -89,16 +87,15 @@ // Don't install more than once.

window.devtoolsFormatters = window.devtoolsFormatters || [];
gw.devtoolsFormatters = gw.devtoolsFormatters || [];
var _createFormatters = (0, _createFormatters3.default)(Immutable);
var _createFormatters = (0, _createFormatters3.default)(Immutable),
RecordFormatter = _createFormatters.RecordFormatter,
OrderedMapFormatter = _createFormatters.OrderedMapFormatter,
OrderedSetFormatter = _createFormatters.OrderedSetFormatter,
ListFormatter = _createFormatters.ListFormatter,
MapFormatter = _createFormatters.MapFormatter,
SetFormatter = _createFormatters.SetFormatter,
StackFormatter = _createFormatters.StackFormatter;
var RecordFormatter = _createFormatters.RecordFormatter;
var OrderedMapFormatter = _createFormatters.OrderedMapFormatter;
var OrderedSetFormatter = _createFormatters.OrderedSetFormatter;
var ListFormatter = _createFormatters.ListFormatter;
var MapFormatter = _createFormatters.MapFormatter;
var SetFormatter = _createFormatters.SetFormatter;
var StackFormatter = _createFormatters.StackFormatter;
gw.devtoolsFormatters.push(RecordFormatter, OrderedMapFormatter, OrderedSetFormatter, ListFormatter, MapFormatter, SetFormatter, StackFormatter);
window.devtoolsFormatters.push(RecordFormatter, OrderedMapFormatter, OrderedSetFormatter, ListFormatter, MapFormatter, SetFormatter, StackFormatter);
installed = true;

@@ -109,6 +106,7 @@ }

exports.default = install;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/***/ }),
/* 1 */
/***/ function(module, exports) {
/***/ (function(module, exports) {

@@ -134,2 +132,15 @@ 'use strict';

var isRecord = function isRecord(maybeRecord) {
// Immutable v4
if (maybeRecord['@@__IMMUTABLE_RECORD__@@']) {
// There's also a Immutable.Record.isRecord we could use, but then the
// Immutable instance passed into createFormatter has to be the same
// version as the one used to create the Immutable object.
// That's especially a problem for the Chrome extension.
return true;
}
// Immutable v3
return !!(maybeRecord['@@__IMMUTABLE_KEYED__@@'] && maybeRecord['@@__IMMUTABLE_ITERABLE__@@'] && maybeRecord._defaultValues !== undefined);
};
var reference = function reference(object, config) {

@@ -142,12 +153,18 @@ if (typeof object === 'undefined') return ['span', nullStyle, 'undefined'];else if (object === 'null') return ['span', nullStyle, 'null'];

var renderIterableHeader = function renderIterableHeader(iterable) {
var name = arguments.length <= 1 || arguments[1] === undefined ? 'Iterable' : arguments[1];
var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Iterable';
return ['span', ['span', immutableNameStyle, name], ['span', '[' + iterable.size + ']']];
};
var getKeySeq = function getKeySeq(collection) {
return collection.toSeq().map(function (v, k) {
return k;
}).toIndexedSeq();
};
var hasBody = function hasBody(collection, config) {
return collection.size > 0 && !(config && config.noPreview);
return getKeySeq(collection).size > 0 && !(config && config.noPreview);
};
var renderIterableBody = function renderIterableBody(collection, mapper) {
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

@@ -159,3 +176,10 @@ if (options.sorted) {

}
var children = collection.map(mapper).toList().toJS();
var children = collection.map(mapper).toList();
var jsList = [];
// Can't just call toJS because that will also call toJS on children inside the list
children.forEach(function (child) {
return jsList.push(child);
});
return ['ol', listStyle].concat(_toConsumableArray(children));

@@ -166,3 +190,3 @@ };

header: function header(record, config) {
if (!(record instanceof Immutable.Record)) return null;
if (!isRecord(record)) return null;

@@ -174,7 +198,7 @@ var defaults = record.clear();

var inlinePreview = undefined;
var inlinePreview = void 0;
if (!changed) {
inlinePreview = ['span', inlineValuesStyle, '{}'];
} else {
var preview = record.keySeq().reduce(function (preview, key) {
var preview = getKeySeq(record).reduce(function (preview, key) {
if (Immutable.is(defaults.get(key), record.get(key))) return preview;

@@ -194,6 +218,6 @@ if (preview.length) preview.push(', ');

var defaults = record.clear();
var children = record.keySeq().map(function (key) {
var children = getKeySeq(record).toJS().map(function (key) {
var style = Immutable.is(defaults.get(key), record.get(key)) ? defaultValueKeyStyle : alteredValueKeyStyle;
return ['li', {}, ['span', style, key + ': '], reference(record.get(key))];
}).toJS();
});
return ['ol', listStyle].concat(_toConsumableArray(children));

@@ -298,5 +322,5 @@ }

/***/ }
/***/ })
/******/ ])
});
;
{
"name": "immutable-devtools",
"version": "0.0.7",
"version": "0.1.0",
"description": "Chrome Dev Tools formatter for the Immutable JS library",

@@ -9,3 +9,3 @@ "main": "dist/index.js",

"build": "webpack --config ./webpack.config.js",
"prepublish": "npm build",
"prepublish": "npm run-script build",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -24,3 +24,4 @@ },

"babel-core": "^6.1.4",
"babel-preset-es2015": "^6.1.4"
"babel-preset-es2015": "^6.1.4",
"immutable": "^4.0.0-rc.9"
},

@@ -27,0 +28,0 @@ "repository" : {

@@ -60,3 +60,6 @@ # Chrome Dev Tools for Immutable-js

## Chrome Extension
Matt Zeunert created a [Chrome Extension](https://github.com/mattzeunert/immutable-object-formatter-extension) based on this project. It automatically installs the formatters when you open the DevTools. ([Install from Chrome Web Store](https://chrome.google.com/webstore/detail/immutablejs-object-format/hgldghadipiblonfkkicmgcbbijnpeog)).
## Using with webpack

@@ -63,0 +66,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc