@crowdin/app-project-module
Version:
Module that generates for you all common endpoints for serving standalone Crowdin App
21 lines (20 loc) • 642 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeToArray = normalizeToArray;
exports.resolveInstanceKey = resolveInstanceKey;
const index_1 = require("./index");
function normalizeToArray(value) {
return Array.isArray(value) ? value : [value];
}
function resolveInstanceKey({ identifier, suffix, item, index, isSingle, }) {
if (isSingle) {
return identifier + '-' + suffix;
}
if (item.key) {
return item.key;
}
if (item.name) {
return identifier + '-' + (0, index_1.kebabCase)(item.name);
}
return identifier + '-' + suffix + '-' + index;
}