Guest User

Untitled

a guest
Jan 18th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. function isValidPropertyName(node: ts.ComputedPropertyName): boolean {
  2. if (
  3. ts.isStringLiteral(node.expression) &&
  4. isValidEs6Identifier(node.expression.text)
  5. ) {
  6. return true
  7. }
  8.  
  9. if (ts.isNumericLiteral(node.expression)) {
  10. return true
  11. }
  12.  
  13. return false
  14. }
  15.  
  16. function isValidPropertyName2(node: ts.ComputedPropertyName): boolean {
  17. return (
  18. (ts.isStringLiteral(node.expression) &&
  19. isValidEs6Identifier(node.expression.text)) ||
  20. ts.isNumericLiteral(node.expression)
  21. )
  22. }
Add Comment
Please, Sign In to add comment