Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch committed Feb 13, 2024
1 parent 9eaff70 commit fe9cdc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/expressions/mapshaper-template-expressions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ export function parseTemplate(str) {
export function applyReplacements(template, replacements) {
var parts = parseTemplateParts(template);
return parts.reduce(function(memo, s, i) {
return i % 2 == 1 ? memo + (replacements.shift() || '') : memo + s;
if (i % 2 == 1) {
memo += replacements.length ? replacements.shift() : '';
} else {
memo += s;
}
return memo;
}, '');
}

Expand Down
2 changes: 1 addition & 1 deletion src/geom/mapshaper-units.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export function convertIntervalPair(opt, crs) {

// Accepts a single value or a list of four values. List order is l,b,t,r
export function convertFourSides(opt, crs, bounds) {
var arr = opt.split(',');
var arr = opt.includes(',') ? opt.split(',') : opt.split(' ');
if (arr.length == 1) {
arr = [arr[0], arr[0], arr[0], arr[0]];
} else if (arr.length != 4) {
Expand Down

0 comments on commit fe9cdc2

Please sign in to comment.