@putout/operate
Advanced tools
Comparing version 6.3.0 to 6.4.0
@@ -10,2 +10,4 @@ 'use strict'; | ||
isIdentifier, | ||
isTemplateElement, | ||
isRegExpLiteral, | ||
} = require('@babel/types'); | ||
@@ -142,7 +144,13 @@ | ||
if (isRegExpLiteral(node)) | ||
return node.pattern; | ||
if (isLiteral(node)) | ||
return node.value; | ||
throw Error('"operator.extract(node)" understands only Literals and Identifiers 🤷'); | ||
if (isTemplateElement(node)) | ||
return node.value.raw; | ||
throw Error(`"operator.extract(node)" understands only Literals, Identifiers, TemplateElement and RegExpLiteral 🤷, found: ${node.type}`); | ||
}; | ||
{ | ||
"name": "@putout/operate", | ||
"version": "6.3.0", | ||
"version": "6.4.0", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -5,0 +5,0 @@ "description": "operate on ast", |
8224
110