@engine9-io/input-tools 1.9.3 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/file/tools.js +10 -0
- package/index.js +7 -5
- package/package.json +1 -1
package/file/tools.js
CHANGED
|
@@ -351,6 +351,15 @@ function appendPostfix(filename, postfix) {
|
|
|
351
351
|
return filenameParts.slice(0, -1).concat(targetFile).join('/');
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
+
function parseJSON5(o, defaultVal) {
|
|
355
|
+
if (o) {
|
|
356
|
+
if (typeof o === 'object') return o;
|
|
357
|
+
if (typeof o === 'string') return JSON5.parse(o);
|
|
358
|
+
throw new Error(`Could not parse object:${o}`);
|
|
359
|
+
}
|
|
360
|
+
return defaultVal || o;
|
|
361
|
+
}
|
|
362
|
+
|
|
354
363
|
module.exports = {
|
|
355
364
|
appendPostfix,
|
|
356
365
|
bool,
|
|
@@ -364,6 +373,7 @@ module.exports = {
|
|
|
364
373
|
getPacketFiles,
|
|
365
374
|
getStringArray,
|
|
366
375
|
makeStrings,
|
|
376
|
+
parseJSON5,
|
|
367
377
|
relativeDate,
|
|
368
378
|
streamPacket,
|
|
369
379
|
writeTempFile
|
package/index.js
CHANGED
|
@@ -15,18 +15,19 @@ const FileUtilities = require('./file/FileUtilities');
|
|
|
15
15
|
const {
|
|
16
16
|
appendPostfix,
|
|
17
17
|
bool,
|
|
18
|
-
|
|
18
|
+
getBatchTransform,
|
|
19
|
+
getDebatchTransform,
|
|
19
20
|
getFile,
|
|
21
|
+
getManifest,
|
|
22
|
+
getPacketFiles,
|
|
23
|
+
getStringArray,
|
|
20
24
|
downloadFile,
|
|
21
25
|
getTempFilename,
|
|
22
26
|
getTempDir,
|
|
23
27
|
isValidDate,
|
|
28
|
+
parseJSON5,
|
|
24
29
|
relativeDate,
|
|
25
30
|
streamPacket,
|
|
26
|
-
getPacketFiles,
|
|
27
|
-
getBatchTransform,
|
|
28
|
-
getDebatchTransform,
|
|
29
|
-
getStringArray,
|
|
30
31
|
makeStrings,
|
|
31
32
|
writeTempFile
|
|
32
33
|
} = require('./file/tools');
|
|
@@ -421,6 +422,7 @@ module.exports = {
|
|
|
421
422
|
isValidDate,
|
|
422
423
|
makeStrings,
|
|
423
424
|
ObjectError,
|
|
425
|
+
parseJSON5,
|
|
424
426
|
relativeDate,
|
|
425
427
|
streamPacket,
|
|
426
428
|
TIMELINE_ENTRY_TYPES,
|