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.2.0 to 3.0.1

4

lib/index.js

@@ -20,2 +20,3 @@ "use strict";

monocellNotebook = _require.monocellNotebook,
createCodeCell = _require.createCodeCell,
appendCellToNotebook = _require.appendCellToNotebook,

@@ -39,3 +40,2 @@ insertCellAt = _require.insertCellAt,

if (Immutable.Map.isMap(notebook)) {
// $FlowFixMe: Immutable
var immNotebook = notebook;

@@ -48,3 +48,2 @@ if (immNotebook.has("cellOrder") && immNotebook.has("cellMap")) {

// $FlowFixMe: Immutable
var notebookJSON = notebook;

@@ -87,2 +86,3 @@

createCodeCell: createCodeCell,
parseNotebook: parseNotebook,

@@ -89,0 +89,0 @@ stringifyNotebook: stringifyNotebook,

@@ -74,4 +74,6 @@ "use strict";

return immnb.withMutations(function (nb) {
// $FlowFixMe: Fixed by making ImmutableNotebook a typed Record.
var cellStructure = {
cellOrder: nb.get("cellOrder"),
// $FlowFixMe: Fixed by making ImmutableNotebook a typed Record.
cellMap: nb.get("cellMap")

@@ -90,3 +92,5 @@ };

return notebook.withMutations(function (nb) {
return nb.setIn(["cellMap", cellID], cell).set("cellOrder", nb.get("cellOrder").insert(index, cellID));
return nb.setIn(["cellMap", cellID], cell)
// $FlowFixMe: Fixed by making ImmutableNotebook a typed record.
.set("cellOrder", nb.get("cellOrder").insert(index, cellID));
});

@@ -96,3 +100,5 @@ }

function insertCellAfter(notebook, cell, cellID, priorCellID) {
return insertCellAt(notebook, cell, cellID, notebook.get("cellOrder").indexOf(priorCellID) + 1);
return insertCellAt(notebook, cell, cellID,
// $FlowFixMe: Fixed by making ImmutableNotebook a typed record.
notebook.get("cellOrder").indexOf(priorCellID) + 1);
}

@@ -99,0 +105,0 @@

@@ -234,2 +234,3 @@ "use strict";

// $FlowFixMe: Fails now as a result of the above.
return {

@@ -292,2 +293,3 @@ cell_type: "markdown",

// is part of the format, not a multiline string
// $FlowFixMe: Need to expand scope of Output type.
return immOutput.toJS();

@@ -303,2 +305,3 @@ default:

// $FlowFixMe: Ditto above.
return {

@@ -317,2 +320,3 @@ cell_type: "code",

// $FlowFixMe: Ditto above. Cells should be Records.
return {

@@ -326,2 +330,3 @@ cell_type: "raw",

function cellToJS(immCell) {
// $FlowFixMe: Cell needs to be a typed record.
var cellType = immCell.get("cell_type");

@@ -328,0 +333,0 @@ switch (cellType) {

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

@@ -9,7 +9,9 @@ "main": "index.js",

"prepare": "npm run build",
"build": "npm run build:clean && npm run build:lib && npm run build:flow",
"prepublishOnly": "npm run build && npm run build:flow",
"build": "npm run build:clean && npm run build:lib",
"build:clean": "rimraf lib",
"build:flow": "flow-copy-source -v -i '**/__tests__/**' src lib",
"build:lib": "babel -d lib src --ignore '**/__tests__/**'",
"build:lib:watch": "npm run build:lib -- --watch"
"build:lib:watch": "npm run build:lib -- --watch",
"build:watch": "npm run build:clean && npm run build:lib:watch && npm run build:flow"
},

@@ -28,5 +30,6 @@ "repository": "https://github.com/nteract/nteract/tree/master/packages/commutable",

"dependencies": {
"immutable": "^3.8.1",
"@nteract/types": "^1.0.1",
"immutable": "^4.0.0-rc.9",
"uuid": "^3.1.0"
}
}

@@ -6,11 +6,6 @@ /* @flow */

import type { ImmutableNotebook, JSONType } from "./types";
import type { ImmutableNotebook, JSONType } from "@nteract/types/commutable";
import * as Immutable from "immutable";
type PlaceholderNotebook = {
nbformat: number,
nbformat_minor: number
};
const v4 = require("./v4");

@@ -25,3 +20,3 @@ const v3 = require("./v3");

monocellNotebook,
createCodeCell,
appendCellToNotebook,

@@ -34,3 +29,3 @@

export type Notebook = PlaceholderNotebook & v4Notebook & v3Notebook;
export type Notebook = v4Notebook | v3Notebook;

@@ -50,3 +45,2 @@ function freezeReviver(k: string, v: JSONType): JSONType {

if (Immutable.Map.isMap(notebook)) {
// $FlowFixMe: Immutable
const immNotebook: ImmutableNotebook = notebook;

@@ -61,3 +55,2 @@ if (immNotebook.has("cellOrder") && immNotebook.has("cellMap")) {

// $FlowFixMe: Immutable
const notebookJSON: Notebook = notebook;

@@ -107,2 +100,3 @@

createCodeCell,
parseNotebook,

@@ -109,0 +103,0 @@ stringifyNotebook,

@@ -113,4 +113,6 @@ /* @flow */

return immnb.withMutations(nb => {
const cellStructure = {
// $FlowFixMe: Fixed by making ImmutableNotebook a typed Record.
const cellStructure: CellStructure = {
cellOrder: nb.get("cellOrder"),
// $FlowFixMe: Fixed by making ImmutableNotebook a typed Record.
cellMap: nb.get("cellMap")

@@ -132,2 +134,3 @@ };

.setIn(["cellMap", cellID], cell)
// $FlowFixMe: Fixed by making ImmutableNotebook a typed record.
.set("cellOrder", nb.get("cellOrder").insert(index, cellID))

@@ -147,2 +150,3 @@ );

cellID,
// $FlowFixMe: Fixed by making ImmutableNotebook a typed record.
notebook.get("cellOrder").indexOf(priorCellID) + 1

@@ -149,0 +153,0 @@ );

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

export type ErrorOutput = {|
output_type: "error",
output_type: "error" | "pyerr",
ename: string,

@@ -331,2 +331,3 @@ evalue: string,

// $FlowFixMe: Fails now as a result of the above.
return {

@@ -391,2 +392,3 @@ cell_type: "markdown",

// is part of the format, not a multiline string
// $FlowFixMe: Need to expand scope of Output type.
return immOutput.toJS();

@@ -410,2 +412,3 @@ default:

// $FlowFixMe: Ditto above.
return {

@@ -424,2 +427,3 @@ cell_type: "code",

// $FlowFixMe: Ditto above. Cells should be Records.
return {

@@ -433,2 +437,3 @@ cell_type: "raw",

function cellToJS(immCell: ImmutableCell): Cell {
// $FlowFixMe: Cell needs to be a typed record.
const cellType: "markdown" | "raw" | "code" = immCell.get("cell_type");

@@ -435,0 +440,0 @@ switch (cellType) {

Sorry, the diff of this file is not supported yet

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