Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add genSafeVariableName #10

Merged
merged 13 commits into from
Jun 10, 2022
Merged

feat: add genSafeVariableName #10

merged 13 commits into from
Jun 10, 2022

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Jun 9, 2022

import { genImportName } from 'knitwork'

// _4923_32foo
genImportName('123 foo')

@danielroe danielroe added the enhancement New feature or request label Jun 9, 2022
@danielroe danielroe requested a review from pi0 June 9, 2022 12:02
@danielroe danielroe self-assigned this Jun 9, 2022
@pi0
Copy link
Member

pi0 commented Jun 9, 2022

Can we also embed a set of reserved keywords to avoid accidentally being used?

A list is here: https://mathiasbynens.be/notes/reserved-keywords

More rules if you like to make more robust: https://mathiasbynens.be/notes/javascript-identifiers#:~:text=Keywords%20are%20tokens%20that%20have,void%20%2C%20while%20%2C%20and%20with%20.

Also what about renaming to more generic genSafeVariableName? I (guess) same convention applies to both.

@pi0
Copy link
Member

pi0 commented Jun 9, 2022

src/esm.ts Outdated Show resolved Hide resolved
@danielroe danielroe requested a review from pi0 June 9, 2022 15:13
@pi0 pi0 changed the title feat: add `genImportName feat: add genImportName Jun 10, 2022
@danielroe danielroe changed the title feat: add genImportName feat: add genSafeVariableName Jun 10, 2022
src/esm.ts Outdated Show resolved Hide resolved
@pi0 pi0 merged commit c19a2ee into main Jun 10, 2022
@pi0 pi0 deleted the feat/import-name branch June 10, 2022 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants