diff options
Diffstat (limited to 'build/helpers.js')
-rw-r--r-- | build/helpers.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/build/helpers.js b/build/helpers.js new file mode 100644 index 00000000..b064a87e --- /dev/null +++ b/build/helpers.js @@ -0,0 +1,20 @@ +const path = require('path'); + +const camelize = function (str) { + str = str.replace(/-/g, ' ') + + return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) { + return word.toUpperCase() + }).replace(/\s+/g, '') +} + +exports.componentName = function (file) { + file = path.basename(file, '.svg') + file = camelize(`Icon ${file}`) + + return file +} + +exports.optimizeSvgCode = function (svgCode) { + return svgCode.replace(/<path stroke="none" d="M0 0h24v24H0z"[^>]+>/, '') +} |