Skip to content

Commit

Permalink
fix: @putout/operate: extract: quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Jun 24, 2024
1 parent 21e0647 commit 4efc9b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/operate/lib/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ function extract(node) {
if (isTSTypeReference(node))
return extract(node.typeName);

throw Error(`"operator.extract(node)" understands only Literals, Identifiers, TemplateLiteral, TemplateElement, RegExpLiteral, ArrayExpression, MemberExpression, JSXAttribute, JSXText and TSTypeReference🤷, found: ${node.type}`);
const nodeTypes = [
'Literals', 'Identifiers', 'TemplateLiteral', 'TemplateElement', 'RegExpLiteral', 'ArrayExpression', 'MemberExpression', 'JSXAttribute', 'JSXText',
].join(', ');

throw Error(`'operator.extract(node)' understands only ${nodeTypes} and TSTypeReference🤷, found: ${node.type}`);
}

function extractArrayExpression(node, collector = []) {
Expand Down
2 changes: 1 addition & 1 deletion packages/operate/lib/extract.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ test('operate: extract: unknown', (t) => {
};

const [error] = tryCatch(extract, node);
const expected = '"operator.extract(node)" understands only Literals, Identifiers, TemplateLiteral, TemplateElement, RegExpLiteral, ArrayExpression, MemberExpression, JSXAttribute, JSXText and TSTypeReference🤷, found: UnknownStatement';
const expected = `'operator.extract(node)' understands only Literals, Identifiers, TemplateLiteral, TemplateElement, RegExpLiteral, ArrayExpression, MemberExpression, JSXAttribute, JSXText and TSTypeReference🤷, found: UnknownStatement`;

t.equal(error.message, expected);
t.end();
Expand Down

0 comments on commit 4efc9b2

Please sign in to comment.