Use String.padStart(), as SE3 version 3.3 now supports it
This commit is contained in:
parent
7a3d1d2ec5
commit
d3cbf1de9c
|
@ -100,10 +100,6 @@ function int_or_null(inp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function leftPad(str, len, fill) {
|
|
||||||
return fill.repeat(Math.max(len - str.length, 0)) + str;
|
|
||||||
}
|
|
||||||
|
|
||||||
function replaceAll(str, search, replace) {
|
function replaceAll(str, search, replace) {
|
||||||
return str.split(search).join(replace);
|
return str.split(search).join(replace);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +118,7 @@ function build_card(component, pack_code, cycle_prefix, copies) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_data() {
|
function common_data() {
|
||||||
const code = cycle_prefix + leftPad(String(component.settings.get('CollectionNumber')), 3, '0');
|
const code = cycle_prefix + String(component.settings.get('CollectionNumber')).padStart(3, '0');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: substitute_tags(String(component.getName())),
|
name: substitute_tags(String(component.getName())),
|
||||||
|
|
Loading…
Reference in New Issue