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

Missing examples #61

Open
nickshanks opened this issue Aug 11, 2023 · 3 comments
Open

Missing examples #61

nickshanks opened this issue Aug 11, 2023 · 3 comments

Comments

@nickshanks
Copy link

nickshanks commented Aug 11, 2023

Need new lines at the end of the README examples block:

assert.ok(isCallable(Function(''));
assert.ok(isCallable(new Function);
assert.ok(isCallable(new Function(''));
assert.ok(isCallable(new Function([], ''));
@nickshanks nickshanks changed the title Missing example Missing examples Aug 11, 2023
@ljharb
Copy link
Member

ljharb commented Aug 11, 2023

Since Function should never be used, I'm not sure why it would be a good idea to include them in examples?

@nickshanks
Copy link
Author

nickshanks commented Aug 14, 2023

To show that this function can cope when legacy code is thrown at it. Isn't that the point? You don't know if you are being passed an object that can be invoked (presumably because you don't control the other end, and it may have been written in 1996), so you need to validate it.

Feel free to annotate the above examples with a comment such as // invoking Function is deprecated but supported.

@ljharb
Copy link
Member

ljharb commented Aug 14, 2023

I suppose that’s fair, but has there ever been an instance in any engine when a Function produced something distinguishable from a normal function? Why would anyone have any expectation that using Function changes anything?

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

No branches or pull requests

2 participants