mathiasbynens / array.of Goto Github PK
View Code? Open in Web Editor NEWA robust & optimized ES3-compatible polyfill for the `Array.of` method in ECMAScript 6.
Home Page: https://mths.be/array-of
License: MIT License
A robust & optimized ES3-compatible polyfill for the `Array.of` method in ECMAScript 6.
Home Page: https://mths.be/array-of
License: MIT License
Could you provide make this library (and other useful libraries that you create) unobtrusive? I can't reuse it at either library or application level since it overrides native stuff.
Thanks for reviewing my pull requests and merging them. I was wondering when a new release to NPMJS' registry would be published, it isn't an urgent issue, please don't feel rushed with it :-)
It seems that some other bugs have been fixed which have not been released, here is the difference since the last release - I believe the only release that has been made is from the project's initial commit.
Array#slice
with NodeList
s errors in IE < 9. So, we should avoid Array#slice
. +@jdalton
isConstructor
should not execute the constructor function, but that can't be fixed without ES6 Proxies. πPut(result, "length")
before return result
. Also requires "use strict"
directive for proper semantics. Test case:Array.of.call(Object).length === 0;
Array.of.call(function(){ return Object.freeze({}); }); // should throw
Object.defineProperty()
to avoid executing setters. Test case:Object.defineProperty(Array.prototype, "0", {
set: function(x) { throw "set:" + x }
});
Array.of("abc"); // should not throw
Since itβs impossible for new C()
to return a falsy value in JavaScript, we can simplify isConstructor
and the surrounding code into something like useConstructor(C, len) || Array(len)
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.