Revision 7218849a
Added by koszko over 1 year ago
| common/entities.js | ||
|---|---|---|
| 54 | 54 |
* No version normalization is performed. |
| 55 | 55 |
*/ |
| 56 | 56 |
const version_string = (ver, rev=0) => ver.join(".") + (rev ? `-${rev}` : "");
|
| 57 |
#EXPORT version_string |
|
| 58 |
|
|
| 59 |
/* |
|
| 60 |
* This function overloads on the number of arguments. If one argument is |
|
| 61 |
* passed, it is an item definition (it need not be complete, only identifier, |
|
| 62 |
* version and, if applicable, revision properties are relevant). If two or |
|
| 63 |
* three arguments are given, they are in order: item identifier, item version |
|
| 64 |
* and item revision. |
|
| 65 |
* Returned is a string identifying this version of item. |
|
| 66 |
*/ |
|
| 67 |
function item_id_string(...args) {
|
|
| 68 |
let def = args[0] |
|
| 69 |
if (args.length > 1) |
|
| 70 |
def = {identifier: args[0], version: args[1], revision: args[2]};
|
|
| 71 |
return !Array.isArray(def.version) ? def.identifier : |
|
| 72 |
`${def.identifier}-${version_string(def.version, def.revision)}`;
|
|
| 73 |
} |
|
| 74 |
#EXPORT item_id_string |
|
| 57 | 75 |
|
| 58 | 76 |
/* vers should be an array of comparable values. Return the greatest one. */ |
| 59 | 77 |
const max = vals => Array.reduce(vals, (v1, v2) => v1 > v2 ? v1 : v2); |
Also available in: Unified diff
add a mapping/resources installation dialog