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

immutable-devtools

Package Overview
Dependencies
Maintainers
1
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.1 to 0.0.2

251

dist/index.js

@@ -1,250 +0,1 @@

module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = install;
var _createFormatter = __webpack_require__(1);
var _createFormatter2 = _interopRequireDefault(_createFormatter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
var installed = false;
// Check for globally defined Immutable and add an install method to it.
if (typeof Immutable !== "undefined") {
Immutable.installDevTools = install.bind(null, Immutable);
}
// I imagine most people are using Immutable as a CommonJS module though...
function install(Immutable) {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === undefined) {
throw new Error("Can only install immutable-devtools in a browser environment.");
}
// Don't install more than once.
if (installed === true) {
return;
}
window.devtoolsFormatters = window.devtoolsFormatters || [];
window.devtoolsFormatters.push((0, _createFormatter2.default)(Immutable));
installed = true;
}
/***/ },
/* 1 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createFormatter;
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
var listStyle = { style: "list-style-type: none; padding: 0; margin: 0 0 0 12px" };
var keyStyle = { style: "color:#881391" };
function createFormatter(Immutable) {
function reference(any, config) {
return ["object", { object: any, config: config }];
}
var stop = {}; // Signals formatter to stop infinite recursion
var defaultFormatter = {
header: function header(x, config) {
if (config === stop) return null;
return reference(x, stop);
},
hasBody: function hasBody(x, config) {
return false;
},
body: function body(x, config) {
return null;
}
};
function notEmpty(collection) {
return collection.size > 0;
}
function keySpan(key) {
return ["span", keyStyle, key + ": "];
}
function displayKeyValueList(collection) {
var children = collection.map(function (value, key) {
return ["li", keySpan(key), reference(value)];
}).toList().toJS();
return ["ol", listStyle].concat(_toConsumableArray(children));
}
var mapFormatter = {
header: function header() {
return ["span", "Map"];
},
hasBody: notEmpty,
body: displayKeyValueList
};
var orderedMapFormatter = {
header: function header() {
return ["span", "OrderedMap"];
},
hasBody: notEmpty,
body: displayKeyValueList
};
var listFormatter = {
header: function header() {
return ["span", "List"];
},
hasBody: notEmpty,
body: displayKeyValueList
};
function setBody(set) {
var children = set.map(function (item) {
return ["li", reference(item)];
}).toJS();
return ["ol", listStyle].concat(_toConsumableArray(children));
}
var stackFormatter = {
header: function header() {
return ["span", "Stack"];
},
hasBody: notEmpty,
body: setBody
};
var setFormatter = {
header: function header() {
return ["span", "Set"];
},
hasBody: notEmpty,
body: setBody
};
var orderedSetFormatter = {
header: function header() {
return ["span", "OrderedSet"];
},
hasBody: notEmpty,
body: setBody
};
var recordFormatter = {
header: function header() {
return ["span", "Record"];
},
hasBody: notEmpty,
body: function body(record) {
var children = record.keySeq().map(function (key) {
return ["li", keySpan(key), reference(record.get(key))];
}).toJS();
return ["ol", listStyle].concat(_toConsumableArray(children));
}
};
var immutableFormatters = {
List: listFormatter,
Map: mapFormatter,
OrderedMap: orderedMapFormatter,
Set: setFormatter,
OrderedSet: orderedSetFormatter,
Stack: stackFormatter
};
function getFormatter(any) {
if (any instanceof Immutable.Record) return recordFormatter;
return Object.keys(immutableFormatters).filter(function (type) {
return Immutable[type]["is" + type](any);
}).map(function (type) {
return immutableFormatters[type];
}).concat(defaultFormatter) // Fallback used when not immutable value
[0];
}
return {
header: function header(any, config) {
return getFormatter(any).header(any, config);
},
hasBody: function hasBody(any, config) {
return getFormatter(any).hasBody(any, config);
},
body: function body(any, config) {
return getFormatter(any).body(any, config);
}
};
}
/***/ }
/******/ ]);
module.exports=function(n){function r(e){if(t[e])return t[e].exports;var o=t[e]={exports:{},id:e,loaded:!1};return n[e].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var t={};return r.m=n,r.c=t,r.p="",r(0)}([function(n,r,t){"use strict";function e(n){return n&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n}var o=t(1);"undefined"!=typeof Immutable&&(Immutable.installDevTools=install.bind(null,Immutable));var u=!1;n.exports=function(n){if(void 0===("undefined"==typeof window?"undefined":e(window)))throw new Error("Can only install immutable-devtools in a browser environment.");u!==!0&&(window.devtoolsFormatters=window.devtoolsFormatters||[],window.devtoolsFormatters.push(o(n)),u=!0)}},function(n,r){"use strict";function t(n){if(Array.isArray(n)){for(var r=0,t=Array(n.length);r<n.length;r++)t[r]=n[r];return t}return Array.from(n)}var e={style:"list-style-type: none; padding: 0; margin: 0 0 0 12px"},o={style:"color:#881391"};n.exports=function(n){function r(n,r){return["object",{object:n,config:r}]}function u(n){return n.size>0}function a(n){return["span",o,n+": "]}function i(n){var o=n.map(function(n,t){return["li",a(t),r(n)]}).toList().toJS();return["ol",e].concat(t(o))}function d(n){var o=n.map(function(n){return["li",r(n)]}).toJS();return["ol",e].concat(t(o))}function c(r){return r instanceof n.Record?v:Object.keys(w).filter(function(t){return n[t]["is"+t](r)}).map(function(n){return w[n]}).concat(f)[0]}var s={},f={header:function(n,t){return t===s?null:r(n,s)},hasBody:function(n,r){return!1},body:function(n,r){return null}},l={header:function(){return["span","Map"]},hasBody:u,body:i},y={header:function(){return["span","OrderedMap"]},hasBody:u,body:i},p={header:function(){return["span","List"]},hasBody:u,body:i},h={header:function(){return["span","Stack"]},hasBody:u,body:d},m={header:function(){return["span","Set"]},hasBody:u,body:d},b={header:function(){return["span","OrderedSet"]},hasBody:u,body:d},v={header:function(){return["span","Record"]},hasBody:u,body:function(n){var o=n.keySeq().map(function(t){return["li",a(t),r(n.get(t))]}).toJS();return["ol",e].concat(t(o))}},w={OrderedMap:y,OrderedSet:b,List:p,Map:l,Set:m,Stack:h};return{header:function(n,r){return c(n).header(n,r)},hasBody:function(n,r){return c(n).hasBody(n,r)},body:function(n,r){return c(n).body(n,r)}}}}]);

2

package.json
{
"name": "immutable-devtools",
"version": "0.0.1",
"version": "0.0.2",
"description": "Chrome Dev Tools formatter for the Immutable JS library",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -34,4 +34,4 @@ # Chrome Dev Tools for Immutable-js

var install = require("immutable-devtools");
install(Immutable);
var devTools = require("immutable-devtools");
devTools.install(Immutable);
```

@@ -38,0 +38,0 @@

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