proposal-bind-operator
proposal-bind-operator copied to clipboard
Calling :: on Primitives
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();
Primitives can be used as this
values in modern JavaScript engines just fine. It should work.
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.
looks like "use strict"
solves that
see related issue https://github.com/elado/lodash-bound/issues/1