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

@nteract/commutable

Package Overview
Dependencies
Maintainers
8
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nteract/commutable - npm Package Compare versions

Comparing version 2.1.2 to 2.2.0

20

lib/index.js

@@ -5,2 +5,8 @@ "use strict";

var _immutable = require("immutable");
var Immutable = _interopRequireWildcard(_immutable);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var v4 = require("./v4");

@@ -31,3 +37,15 @@ var v3 = require("./v3");

function fromJS(notebookJSON) {
function fromJS(notebook) {
if (Immutable.Map.isMap(notebook)) {
// $FlowFixMe: Immutable
var immNotebook = notebook;
if (immNotebook.has("cellOrder") && immNotebook.has("cellMap")) {
return immNotebook;
}
throw new TypeError("commutable was passed an Immutable.Map structure that is not a notebook");
}
// $FlowFixMe: Immutable
var notebookJSON = notebook;
if (notebookJSON.nbformat === 4 && notebookJSON.nbformat_minor >= 0) {

@@ -34,0 +52,0 @@ if (Array.isArray(notebookJSON.cells) && _typeof(notebookJSON.metadata) === "object") {

4

lib/v4.js

@@ -48,3 +48,3 @@ "use strict";

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Output Types

@@ -54,3 +54,3 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Cell Types

@@ -57,0 +57,0 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

{
"name": "@nteract/commutable",
"version": "2.1.2",
"version": "2.2.0",
"description": "library for immutable notebook operations",

@@ -15,7 +15,8 @@ "main": "index.js",

},
"repository": {
"type": "git",
"url": "https://github.com/nteract/nteract/tree/master/packages/commutable"
},
"keywords": ["commutable", "nteract", "notebooks"],
"repository": "https://github.com/nteract/nteract/tree/master/packages/commutable",
"keywords": [
"commutable",
"nteract",
"notebooks"
],
"publishConfig": {

@@ -22,0 +23,0 @@ "access": "public"

@@ -8,2 +8,4 @@ /* @flow */

import * as Immutable from "immutable";
type PlaceholderNotebook = {

@@ -44,3 +46,17 @@ nbformat: number,

function fromJS(notebookJSON: Notebook): ImmutableNotebook {
function fromJS(notebook: Notebook | ImmutableNotebook): ImmutableNotebook {
if (Immutable.Map.isMap(notebook)) {
// $FlowFixMe: Immutable
const immNotebook: ImmutableNotebook = notebook;
if (immNotebook.has("cellOrder") && immNotebook.has("cellMap")) {
return immNotebook;
}
throw new TypeError(
`commutable was passed an Immutable.Map structure that is not a notebook`
);
}
// $FlowFixMe: Immutable
const notebookJSON: Notebook = notebook;
if (notebookJSON.nbformat === 4 && notebookJSON.nbformat_minor >= 0) {

@@ -59,3 +75,5 @@ if (

throw new TypeError(
`nbformat v${notebookJSON.nbformat}.${notebookJSON.nbformat_minor} not recognized`
`nbformat v${notebookJSON.nbformat}.${
notebookJSON.nbformat_minor
} not recognized`
);

@@ -62,0 +80,0 @@ }

@@ -53,3 +53,3 @@ /* @flow */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Output Types

@@ -85,3 +85,3 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Cell Types

@@ -88,0 +88,0 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

Sorry, the diff of this file is not supported yet

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