Skip to content

feat(micro-utilities): add is-property to replacements - #1087

Open
dreyfus92 wants to merge 1 commit into
mainfrom
add/mr-026
Open

feat(micro-utilities): add is-property to replacements#1087
dreyfus92 wants to merge 1 commit into
mainfrom
add/mr-026

Conversation

@dreyfus92

Copy link
Copy Markdown
Member

🔗 Linked issue

closes: #1025

📚 Description

adds is-property to the micro-utilities manifest

"id": "snippet::is-identifier-name",
"type": "simple",
"description": "You can test a string against the `ID_Start` and `ID_Continue` Unicode properties to check whether it is a valid identifier name, and so usable as an unquoted property.",
"example": "const identifierNameRE = /^[$_\\p{ID_Start}][$\\u200c\\u200d\\p{ID_Continue}]*$/u;\n\nconst isProperty = (str) => identifierNameRE.test(str);"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we could simplify this a bunch:

  • inline it into the isProperty function
  • remove u200d and u200c since only insane people would put those in property names afaict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Replacement]: is-property

2 participants