@nteract/commutable
Advanced tools
Comparing version 7.2.12 to 7.3.0
@@ -86,5 +86,8 @@ import { | ||
const expectedResult = { | ||
"application/vnd.vega.v2+json": { test: "1, 2, 4" } | ||
}; | ||
// Uncomment the reformated result when we turn on the reformatting | ||
const expectedResult = mediaBundle; | ||
// const expectedResult = { | ||
// "application/vnd.vega.v2+json": { test: "1, 2, 4" } | ||
// }; | ||
expect(createOnDiskMediaBundle(mediaBundle)).toStrictEqual(expectedResult); | ||
@@ -97,5 +100,7 @@ }); | ||
const expectedResult = { | ||
"text/html": ["test\n", "\n", "\n", "this\n", "\n", "out"] | ||
}; | ||
// Uncomment the reformated result when we turn on the reformatting | ||
const expectedResult = mediaBundle; | ||
// const expectedResult = { | ||
// "text/html": ["test\n", "\n", "\n", "this\n", "\n", "out"] | ||
// }; | ||
@@ -102,0 +107,0 @@ expect(createOnDiskMediaBundle(mediaBundle)).toStrictEqual(expectedResult); |
@@ -101,21 +101,23 @@ "use strict"; | ||
function createOnDiskMediaBundle(mediaBundle) { | ||
// Technically we could return just the mediaBundle as is | ||
// return mediaBundle; | ||
// Return the bundle as is | ||
return mediaBundle; | ||
// The remultiline function in the code below is costly when the data payload is large | ||
// TODO: figure out a configurable way to reformat the string when needed. | ||
// However for the sake of on-disk readability we write out remultilined | ||
// versions of the array and string ones | ||
const freshBundle = {}; | ||
for (const key in mediaBundle) { | ||
if (IS_VEGA.test(key)) { | ||
freshBundle[key] = JSON.parse(mediaBundle[key]); | ||
} | ||
else if (!isJSONKey(key) && | ||
(typeof mediaBundle[key] === "string" || Array.isArray(mediaBundle[key]))) { | ||
freshBundle[key] = remultiline(mediaBundle[key]); | ||
} | ||
else { | ||
freshBundle[key] = mediaBundle[key]; | ||
} | ||
} | ||
return freshBundle; | ||
// const freshBundle: OnDiskMediaBundle = {}; | ||
// for (const key in mediaBundle) { | ||
// if (IS_VEGA.test(key)) { | ||
// freshBundle[key] = JSON.parse(mediaBundle[key] as string); | ||
// } else if ( | ||
// !isJSONKey(key) && | ||
// (typeof mediaBundle[key] === "string" || Array.isArray(mediaBundle[key])) | ||
// ) { | ||
// freshBundle[key] = remultiline(mediaBundle[key] as MultiLineString); | ||
// } else { | ||
// freshBundle[key] = mediaBundle[key]; | ||
// } | ||
// } | ||
// return freshBundle; | ||
} | ||
exports.createOnDiskMediaBundle = createOnDiskMediaBundle; |
{ | ||
"name": "@nteract/commutable", | ||
"version": "7.2.12", | ||
"version": "7.3.0", | ||
"description": "library for immutable notebook operations", | ||
@@ -27,3 +27,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "48e287db3d8fe3d6b8c078dc06b6cd8dfcc9ea96" | ||
"gitHead": "6effa2f8b46213616b5096b6a451947a3d8c054c" | ||
} |
@@ -212,21 +212,24 @@ import * as Immutable from "immutable"; | ||
): OnDiskMediaBundle { | ||
// Technically we could return just the mediaBundle as is | ||
// return mediaBundle; | ||
// Return the bundle as is | ||
return mediaBundle; | ||
// The remultiline function in the code below is costly when the data payload is large | ||
// TODO: figure out a configurable way to reformat the string when needed. | ||
// However for the sake of on-disk readability we write out remultilined | ||
// versions of the array and string ones | ||
const freshBundle: OnDiskMediaBundle = {}; | ||
for (const key in mediaBundle) { | ||
if (IS_VEGA.test(key)) { | ||
freshBundle[key] = JSON.parse(mediaBundle[key] as string); | ||
} else if ( | ||
!isJSONKey(key) && | ||
(typeof mediaBundle[key] === "string" || Array.isArray(mediaBundle[key])) | ||
) { | ||
freshBundle[key] = remultiline(mediaBundle[key] as MultiLineString); | ||
} else { | ||
freshBundle[key] = mediaBundle[key]; | ||
} | ||
} | ||
return freshBundle; | ||
// const freshBundle: OnDiskMediaBundle = {}; | ||
// for (const key in mediaBundle) { | ||
// if (IS_VEGA.test(key)) { | ||
// freshBundle[key] = JSON.parse(mediaBundle[key] as string); | ||
// } else if ( | ||
// !isJSONKey(key) && | ||
// (typeof mediaBundle[key] === "string" || Array.isArray(mediaBundle[key])) | ||
// ) { | ||
// freshBundle[key] = remultiline(mediaBundle[key] as MultiLineString); | ||
// } else { | ||
// freshBundle[key] = mediaBundle[key]; | ||
// } | ||
// } | ||
// return freshBundle; | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
648895
3076