diff options
author | codecalm <codecalm@gmail.com> | 2022-07-09 17:03:12 +0200 |
---|---|---|
committer | codecalm <codecalm@gmail.com> | 2022-07-09 17:03:12 +0200 |
commit | 036d995c77bd8f4df746bd10efb5a0ac45409231 (patch) | |
tree | 733bd5675b14a454cc28735b0afe2cbbd2640a1b /build/helpers.js | |
parent | Release 1.72.0 (diff) | |
download | tabler-icons-036d995c77bd8f4df746bd10efb5a0ac45409231.tar.xz |
new build processdev-react
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"[^>]+>/, '') +} |