mirror of
https://github.com/yldio/copilot.git
synced 2024-11-15 07:40:07 +02:00
8295bd6882
this shall be a progressive process
12 lines
327 B
JavaScript
12 lines
327 B
JavaScript
const flatten = require('lodash.flatten');
|
|
|
|
const BASE = 16;
|
|
|
|
const calc = (base, ...values) =>
|
|
flatten(values.map(value => String(value).split(/\s/gim)))
|
|
.map(value => `${Number(value.replace('px', '')) / base}rem`)
|
|
.join(' ');
|
|
|
|
module.exports = (...values) => calc(BASE, ...values);
|
|
module.exports.withBase = calc;
|