Skip to content

Commit

Permalink
Array.of
Browse files Browse the repository at this point in the history
  • Loading branch information
msn0 committed Apr 25, 2017
1 parent f2b8381 commit e9d3e61
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ import 'mdn-polyfills/Array.prototype.filter';
import 'mdn-polyfills/Array.prototype.includes';
```

## [Array.of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of#Polyfill)

```js
import 'mdn-polyfills/Array.of';
```

# License

MIT © [Michał Jezierski](https://github.com/msn0)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"array.forEach",
"array.filter",
"array.includes",
"array.of",
"object.assign",
"object.create"
],
Expand Down
5 changes: 5 additions & 0 deletions src/Array.of/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import of from './of';

if (!Array.of) {
Array.of = of;
}
3 changes: 3 additions & 0 deletions src/Array.of/of.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function () {
return Array.prototype.slice.call(arguments);
};
8 changes: 8 additions & 0 deletions src/Array.of/spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import test from 'ava';
import of from './of';

test('should create array from arguments', t => {
const actual = of('foo', 2, null, {});

t.deepEqual(actual, ['foo', 2, null, {}]);
});
3 changes: 2 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module.exports = {
"Array.prototype.from": "./src/Array.prototype.from/index.js",
"Array.prototype.filter": "./src/Array.prototype.filter/index.js",
"Array.prototype.forEach": "./src/Array.prototype.forEach/index.js",
"Array.prototype.includes": "./src/Array.prototype.includes/index.js"
"Array.prototype.includes": "./src/Array.prototype.includes/index.js",
"Array.of": "./src/Array.of/index.js"
},
output: {
filename: "[name].js"
Expand Down

0 comments on commit e9d3e61

Please sign in to comment.