@nteract/commutable
Advanced tools
Comparing version
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.createImmutableMimeBundle = exports.createImmutableOutput = exports.appendCellToNotebook = exports.appendCell = exports.removeCell = exports.insertCellAfter = exports.insertCellAt = exports.stringifyNotebook = exports.parseNotebook = exports.createCodeCell = exports.fromJS = exports.toJS = exports.monocellNotebook = exports.emptyNotebook = exports.emptyMarkdownCell = exports.emptyCodeCell = undefined; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
@@ -79,21 +84,20 @@ | ||
module.exports = { | ||
emptyCodeCell: emptyCodeCell, | ||
emptyMarkdownCell: emptyMarkdownCell, | ||
emptyNotebook: emptyNotebook, | ||
monocellNotebook: monocellNotebook, | ||
toJS: toJS, | ||
fromJS: fromJS, | ||
var createImmutableOutput = v4.createImmutableOutput; | ||
var createImmutableMimeBundle = v4.createImmutableMimeBundle; | ||
createCodeCell: createCodeCell, | ||
parseNotebook: parseNotebook, | ||
stringifyNotebook: stringifyNotebook, | ||
insertCellAt: insertCellAt, | ||
insertCellAfter: insertCellAfter, | ||
removeCell: removeCell, | ||
appendCell: appendCell, | ||
appendCellToNotebook: appendCellToNotebook, | ||
createImmutableOutput: v4.createImmutableOutput, | ||
createImmutableMimeBundle: v4.createImmutableMimeBundle | ||
}; | ||
exports.emptyCodeCell = emptyCodeCell; | ||
exports.emptyMarkdownCell = emptyMarkdownCell; | ||
exports.emptyNotebook = emptyNotebook; | ||
exports.monocellNotebook = monocellNotebook; | ||
exports.toJS = toJS; | ||
exports.fromJS = fromJS; | ||
exports.createCodeCell = createCodeCell; | ||
exports.parseNotebook = parseNotebook; | ||
exports.stringifyNotebook = stringifyNotebook; | ||
exports.insertCellAt = insertCellAt; | ||
exports.insertCellAfter = insertCellAfter; | ||
exports.removeCell = removeCell; | ||
exports.appendCell = appendCell; | ||
exports.appendCellToNotebook = appendCellToNotebook; | ||
exports.createImmutableOutput = createImmutableOutput; | ||
exports.createImmutableMimeBundle = createImmutableMimeBundle; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.createCodeCell = createCodeCell; | ||
exports.createMarkdownCell = createMarkdownCell; | ||
exports.createNotebook = createNotebook; | ||
exports.appendCell = appendCell; | ||
exports.appendCellToNotebook = appendCellToNotebook; | ||
exports.insertCellAt = insertCellAt; | ||
exports.insertCellAfter = insertCellAfter; | ||
exports.removeCell = removeCell; | ||
var uuidv4 = require("uuid").v4; | ||
@@ -42,6 +55,6 @@ | ||
var emptyCodeCell = createCodeCell(); | ||
var emptyMarkdownCell = createMarkdownCell(); | ||
var emptyCodeCell = exports.emptyCodeCell = createCodeCell(); | ||
var emptyMarkdownCell = exports.emptyMarkdownCell = createMarkdownCell(); | ||
var defaultNotebook = Object.freeze({ | ||
var defaultNotebook = exports.defaultNotebook = Object.freeze({ | ||
nbformat: 4, | ||
@@ -61,3 +74,3 @@ nbformat_minor: 4, | ||
var emptyNotebook = createNotebook(); | ||
var emptyNotebook = exports.emptyNotebook = createNotebook(); | ||
@@ -113,19 +126,2 @@ // Intended to make it easy to use this with (temporary mutable cellOrder + cellMap) | ||
var monocellNotebook = appendCellToNotebook(emptyNotebook, emptyCodeCell); | ||
module.exports = { | ||
emptyCodeCell: emptyCodeCell, | ||
emptyMarkdownCell: emptyMarkdownCell, | ||
emptyNotebook: emptyNotebook, | ||
monocellNotebook: monocellNotebook, | ||
createCodeCell: createCodeCell, | ||
createMarkdownCell: createMarkdownCell, | ||
createNotebook: createNotebook, | ||
removeCell: removeCell, | ||
insertCellAfter: insertCellAfter, | ||
insertCellAt: insertCellAt, | ||
appendCellToNotebook: appendCellToNotebook, | ||
appendCell: appendCell | ||
}; | ||
var monocellNotebook = exports.monocellNotebook = appendCellToNotebook(emptyNotebook, emptyCodeCell); |
{ | ||
"name": "@nteract/commutable", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "library for immutable notebook operations", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -128,3 +128,6 @@ /* @flow */ | ||
module.exports = { | ||
const createImmutableOutput = v4.createImmutableOutput; | ||
const createImmutableMimeBundle = v4.createImmutableMimeBundle; | ||
export { | ||
emptyCodeCell, | ||
@@ -136,7 +139,5 @@ emptyMarkdownCell, | ||
fromJS, | ||
createCodeCell, | ||
parseNotebook, | ||
stringifyNotebook, | ||
insertCellAt, | ||
@@ -147,4 +148,4 @@ insertCellAfter, | ||
appendCellToNotebook, | ||
createImmutableOutput: v4.createImmutableOutput, | ||
createImmutableMimeBundle: v4.createImmutableMimeBundle | ||
createImmutableOutput, | ||
createImmutableMimeBundle | ||
}; |
@@ -59,3 +59,5 @@ /* @flow */ | ||
function createCodeCell(cell: CodeCell = defaultCodeCell): ImmutableCodeCell { | ||
export function createCodeCell( | ||
cell: CodeCell = defaultCodeCell | ||
): ImmutableCodeCell { | ||
// $FlowFixMe: Immutable | ||
@@ -65,3 +67,3 @@ return Immutable.Map(cell); | ||
function createMarkdownCell( | ||
export function createMarkdownCell( | ||
cell: MarkdownCell = defaultMarkdownCell | ||
@@ -73,6 +75,6 @@ ): ImmutableMarkdownCell { | ||
const emptyCodeCell = createCodeCell(); | ||
const emptyMarkdownCell = createMarkdownCell(); | ||
export const emptyCodeCell = createCodeCell(); | ||
export const emptyMarkdownCell = createMarkdownCell(); | ||
const defaultNotebook = Object.freeze({ | ||
export const defaultNotebook = Object.freeze({ | ||
nbformat: 4, | ||
@@ -85,3 +87,3 @@ nbformat_minor: 4, | ||
function createNotebook( | ||
export function createNotebook( | ||
notebook: Notebook = defaultNotebook | ||
@@ -93,3 +95,3 @@ ): ImmutableNotebook { | ||
const emptyNotebook = createNotebook(); | ||
export const emptyNotebook = createNotebook(); | ||
@@ -102,3 +104,3 @@ export type CellStructure = { | ||
// Intended to make it easy to use this with (temporary mutable cellOrder + cellMap) | ||
function appendCell( | ||
export function appendCell( | ||
cellStructure: CellStructure, | ||
@@ -114,3 +116,3 @@ immutableCell: ImmutableCell, | ||
function appendCellToNotebook( | ||
export function appendCellToNotebook( | ||
immnb: ImmutableNotebook, | ||
@@ -131,3 +133,3 @@ immCell: ImmutableCell | ||
function insertCellAt( | ||
export function insertCellAt( | ||
notebook: ImmutableNotebook, | ||
@@ -146,3 +148,3 @@ cell: ImmutableCell, | ||
function insertCellAfter( | ||
export function insertCellAfter( | ||
notebook: ImmutableNotebook, | ||
@@ -162,3 +164,3 @@ cell: ImmutableCell, | ||
function removeCell(notebook: ImmutableNotebook, cellID: string) { | ||
export function removeCell(notebook: ImmutableNotebook, cellID: string) { | ||
return notebook | ||
@@ -171,19 +173,5 @@ .removeIn(["cellMap", cellID]) | ||
const monocellNotebook = appendCellToNotebook(emptyNotebook, emptyCodeCell); | ||
module.exports = { | ||
emptyCodeCell, | ||
emptyMarkdownCell, | ||
export const monocellNotebook = appendCellToNotebook( | ||
emptyNotebook, | ||
monocellNotebook, | ||
createCodeCell, | ||
createMarkdownCell, | ||
createNotebook, | ||
removeCell, | ||
insertCellAfter, | ||
insertCellAt, | ||
appendCellToNotebook, | ||
appendCell | ||
}; | ||
emptyCodeCell | ||
); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
82252
0.67%17
-5.56%1604
-0.37%