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

Calling :: on Primitives #50

Open
7fe opened this issue Jul 26, 2017 · 3 comments
Open

Calling :: on Primitives #50

7fe opened this issue Jul 26, 2017 · 3 comments

Comments

@7fe
Copy link

7fe commented Jul 26, 2017

Would the following work or not? Apologies if this has already been answered couldn't find an issue on this. I would assume the answer is an obvious yes.

"div.myClass"::find("p")::html("hahaha");
23::times(23);
[2,3]::equals([2,3]);
/1/::equals(/1/)

I would assume assume that it would work or objects not native to current page and are from an iframe yes?

EDIT: Would I need to wrap objects like the following?

{y:'z'}::test();
({y:'z'})::test();

And the following would throw an error yes?

null::f();
var x = null;
x::f();
@michaelficarra
Copy link
Member

Primitives can be used as this values in modern JavaScript engines just fine. It should work.

@robotlolita
Copy link

All of these are compiled like so: a::b(c) => b.call(a, b). None of them will throw an error. In older engines a would be boxed.

@elado
Copy link

elado commented Mar 8, 2018

looks like "use strict" solves that
see related issue elado/lodash-bound#1

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

4 participants