This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (sheet) => { | |
const variableRegex = /\$(.+):\s+(.+);?/; | |
const variables = {}; | |
sheet.split('\n').forEach((line) => { | |
const variable = variableRegex.exec(line); | |
if (!variable) return; | |
const name = variable[1].trim(); | |
const value = variable[2].replace(/!default|!important/g, '').trim(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* naive implementation of singular/plural sentence based on count. | |
* e.g.: | |
* var str = "Do you want to delete this? There {are|is} [num] book{s} attached." | |
* | |
* pluralize(str, 1); // => Do you want to delete this? There is 1 book attached." | |
* pluralize(str, 2); // => "Do you want to delete this? There are 2 books attached." | |
* | |
* @method function | |
* |