Comparing version 0.3.10 to 0.3.11
@@ -47,2 +47,6 @@ "use strict"; | ||
}); | ||
// sort files | ||
customAnnotationFiles.sort((a, b) => { | ||
return Utils_1.Utils.compare(a, b); | ||
}); | ||
let hasPaintingAnnotation = false; | ||
@@ -154,2 +158,6 @@ await Promise.all(customAnnotationFiles.map(async (file) => { | ||
}); | ||
// sort files | ||
paintableFiles.sort((a, b) => { | ||
return Utils_1.Utils.compare(a, b); | ||
}); | ||
this._annotateFiles(canvasJson, paintableFiles); | ||
@@ -156,0 +164,0 @@ } |
@@ -36,2 +36,6 @@ "use strict"; | ||
}); | ||
// sort canvases | ||
canvases.sort((a, b) => { | ||
return Utils_1.Utils.compare(a, b); | ||
}); | ||
await Promise.all(canvases.map(async (canvas) => { | ||
@@ -50,2 +54,6 @@ console.log(chalk.green('creating canvas for: ') + canvas); | ||
}); | ||
// sort canvases | ||
directories.sort((a, b) => { | ||
return Utils_1.Utils.compare(a, b); | ||
}); | ||
await Promise.all(directories.map(async (directory) => { | ||
@@ -70,2 +78,6 @@ console.log(chalk.green('creating directory for: ') + directory); | ||
}); | ||
// sort files | ||
paintableFiles.sort((a, b) => { | ||
return Utils_1.Utils.compare(a, b); | ||
}); | ||
paintableFiles.forEach((file) => { | ||
@@ -165,5 +177,4 @@ console.log(chalk.green('creating canvas for: ') + file); | ||
// sort items | ||
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }); | ||
this.indexJson.items.sort((a, b) => { | ||
return collator.compare(a.label['@none'][0].toLowerCase(), b.label['@none'][0].toLowerCase()); | ||
return Utils_1.Utils.compare(a.label['@none'][0].toLowerCase(), b.label['@none'][0].toLowerCase()); | ||
}); | ||
@@ -182,5 +193,4 @@ } | ||
})); | ||
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }); | ||
this.indexJson.items.sort((a, b) => { | ||
return collator.compare(a.id, b.id); | ||
return Utils_1.Utils.compare(a.id, b.id); | ||
}); | ||
@@ -210,2 +220,13 @@ } | ||
} | ||
if (this.infoYml.behavior) { | ||
this.indexJson.behavior = []; | ||
if (Array.isArray(this.infoYml.behavior)) { | ||
this.infoYml.behavior.forEach(behavior => { | ||
this.indexJson.behavior.push(behavior); | ||
}); | ||
} | ||
else { | ||
this.indexJson.behavior.push(this.infoYml.behavior); | ||
} | ||
} | ||
} | ||
@@ -212,0 +233,0 @@ } |
{ | ||
"name": "biiif", | ||
"version": "0.3.10", | ||
"version": "0.3.11", | ||
"description": "A CLI to build IIIF collections", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,2 +18,6 @@ "use strict"; | ||
class Utils { | ||
static compare(a, b) { | ||
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }); | ||
return collator.compare(a, b); | ||
} | ||
static getTypeByExtension(motivation, extension) { | ||
@@ -20,0 +24,0 @@ const m = config.annotation.motivations[motivation]; |
52767
965