mirror of
https://github.com/postlight/mercury-parser
synced 2024-11-18 21:28:22 +00:00
18 lines
384 B
JavaScript
18 lines
384 B
JavaScript
|
export default function insertValues(strings, ...values) {
|
||
|
if (values.length) {
|
||
|
return strings.reduce((result, part, idx) => {
|
||
|
let value = values[idx];
|
||
|
|
||
|
if (value && typeof value.toString === 'function') {
|
||
|
value = value.toString();
|
||
|
} else {
|
||
|
value = '';
|
||
|
}
|
||
|
|
||
|
return result + part + value;
|
||
|
}, '');
|
||
|
}
|
||
|
|
||
|
return strings.join('');
|
||
|
}
|