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 support to string in includes #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

alisonrag
Copy link

No description provided.

@alisonrag alisonrag marked this pull request as ready for review September 3, 2024 16:39
@danielduarte
Copy link
Owner

Thanks for your pull request @alisonrag, I'll be reviewing your commits these days to include them in the codebase.

@@ -143,7 +143,7 @@ const evalLiteral = node => {
assert.strictEqual(node.type, NODE_LITERAL);

const { value } = node;
const typeNames = [TYPE_NUMBER, TYPE_BOOLEAN, TYPE_STRING];
const typeNames = [TYPE_NUMBER, TYPE_BOOLEAN, TYPE_STRING, TYPE_OBJECT];
Copy link
Owner

Choose a reason for hiding this comment

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

Please remove TYPE_OBJECT from typeNames since it would be an error if a node of type NODE_LITERAL has an object as value.

},
matchAll: (target, context, options, runState) => {
const pattern = context.get('pattern');
return target.match(pattern);
Copy link
Owner

Choose a reason for hiding this comment

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

Please call matchAll instead.

return target.replace(
searchValue,
newValue instanceof AbstractFunction ?
(x) => newValue.exec(x, context, options, runState) :
Copy link
Owner

Choose a reason for hiding this comment

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

exec method requires the first argument to be an array of parameters. Please fix the code to pass in all the arguments to the replacer function.

return target.replaceAll(
searchValue,
newValue instanceof AbstractFunction ?
(x) => newValue.exec(x, context, options, runState) :
Copy link
Owner

Choose a reason for hiding this comment

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

exec method requires the first argument to be an array of parameters. Please fix the code to pass in all the arguments to the replacer function.

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.

2 participants