-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace 'variablePrefix' and 'variableSuffix' with 'getVariableName' …
…(output-components-as-es6)
- Loading branch information
1 parent
b46db83
commit a84402c
Showing
11 changed files
with
112 additions
and
48 deletions.
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# @figma-export/output-components-utils | ||
|
||
> Utils for [@figma-export](https://github.com/marcomontalbano/figma-export) outputters. | ||
## Install | ||
|
||
Using npm: | ||
|
||
```sh | ||
npm install --save-dev @figma-export/output-components-utils | ||
``` | ||
|
||
or using yarn: | ||
|
||
```sh | ||
yarn add @figma-export/output-components-utils --dev | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const camelCase = (str) => str.replace(/[\])}]+/g, '').replace(/^([A-Z])|[\s-_([/\\{]+(\w)/g, (match, p1, p2) => { | ||
if (p2) { | ||
return p2.toUpperCase(); | ||
} | ||
|
||
return p1.toLowerCase(); | ||
}); | ||
|
||
module.exports = { | ||
camelCase, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const { expect } = chai; | ||
|
||
const utils = require('./index'); | ||
|
||
describe('utils', () => { | ||
it('getVariableName', async () => { | ||
expect(utils.camelCase('a')).to.eql('a'); | ||
expect(utils.camelCase('a word')).to.eql('aWord'); | ||
expect(utils.camelCase('a-word')).to.eql('aWord'); | ||
expect(utils.camelCase('a/word')).to.eql('aWord'); | ||
expect(utils.camelCase('a\\word')).to.eql('aWord'); | ||
expect(utils.camelCase('a[wor]d')).to.eql('aWord'); | ||
expect(utils.camelCase('a [word]')).to.eql('aWord'); | ||
expect(utils.camelCase('a (word)')).to.eql('aWord'); | ||
expect(utils.camelCase('a {word}')).to.eql('aWord'); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "@figma-export/output-components-utils", | ||
"version": "1.2.0", | ||
"description": "Utils for @figma-export outputters", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/marcomontalbano/figma-exporter.git", | ||
"directory": "packages/output-components-utils" | ||
}, | ||
"author": "Marco Montalbano <me@marcomontalbano.com>", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
|
||
} | ||
} |