mdn-polyfills
Advanced tools
Comparing version 1.0.0 to 2.0.0
{ | ||
"name": "mdn-polyfills", | ||
"version": "1.0.0", | ||
"description": "MDN polyfills - Array.from, Array.find, Object.assign, ...", | ||
"version": "2.0.0", | ||
"description": "MDN polyfills", | ||
"scripts": { | ||
"transpile": "babel ./src --out-dir ./dist", | ||
"prepublish": "npm run transpile && ./node_modules/.bin/webpack" | ||
"prepublish": "webpack", | ||
"test": "ava" | ||
}, | ||
@@ -14,8 +14,10 @@ "repository": { | ||
"keywords": [ | ||
"Array.from", | ||
"Array.find", | ||
"Object.assign" | ||
"from", | ||
"find", | ||
"forEach", | ||
"filter", | ||
"assign" | ||
], | ||
"author": "", | ||
"license": "ISC", | ||
"license": "MIT", | ||
"bugs": { | ||
@@ -26,2 +28,3 @@ "url": "https://github.com/msn0/mdn-polyfills/issues" | ||
"devDependencies": { | ||
"ava": "^0.16.0", | ||
"babel-cli": "^6.10.1", | ||
@@ -31,3 +34,18 @@ "babel-loader": "^6.2.4", | ||
"webpack": "^1.13.1" | ||
}, | ||
"ava": { | ||
"files": [ | ||
"src/**/spec.js" | ||
], | ||
"source": [ | ||
"src/**/*.js" | ||
], | ||
"concurrency": 5, | ||
"failFast": true, | ||
"powerAssert": true, | ||
"require": [ | ||
"babel-register" | ||
], | ||
"babel": "inherit" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# Polyfills copied from MDN | ||
# Polyfills copied from MDN [![Build Status](https://travis-ci.org/msn0/mdn-polyfills.svg?branch=master)](http://travis-ci.org/msn0/mdn-polyfills) | ||
> [MDN](https://developer.mozilla.org) polyfills. Ready to be placed via ES6 imports. | ||
> [MDN](https://developer.mozilla.org) polyfills. Ready to be used as ES6 modules. | ||
@@ -8,3 +8,3 @@ # Installation | ||
``` | ||
npm i mdn-polyfills | ||
npm i mdn-polyfills --save | ||
``` | ||
@@ -17,15 +17,31 @@ | ||
```js | ||
import 'mdn-polyfills/dist/Object.assign'; | ||
import 'mdn-polyfills/Object.assign'; | ||
``` | ||
## [Array.find](https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/Array/find#Polyfill) | ||
## [Array.prototype.find](https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/Array/find#Polyfill) | ||
```js | ||
import 'mdn-polyfills/dist/Array.find'; | ||
import 'mdn-polyfills/Array.prototype.find'; | ||
``` | ||
## [Array.from](https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/Array/from#Polyfill) | ||
## [Array.prototype.from](https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/Array/from#Polyfill) | ||
```js | ||
import 'mdn-polyfills/dist/Array.from'; | ||
import 'mdn-polyfills/Array.prototype.from'; | ||
``` | ||
## [Array.prototype.forEach](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill) | ||
```js | ||
import 'mdn-polyfills/Array.prototype.forEach'; | ||
``` | ||
## [Array.prototype.filter](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/filter#Polyfill) | ||
```js | ||
import 'mdn-polyfills/Array.prototype.filter'; | ||
``` | ||
# License | ||
MIT |
export default function assign(target) { | ||
if (target == null) { | ||
if (target === undefined || target === null) { | ||
throw new TypeError('Cannot convert undefined or null to object'); | ||
} | ||
target = Object(target); | ||
let output = Object(target); | ||
for (let index = 1; index < arguments.length; index++) { | ||
let source = arguments[index]; | ||
if (source != null) { | ||
for (let key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
if (source !== undefined && source !== null) { | ||
for (let nextKey in source) { | ||
if (source.hasOwnProperty(nextKey)) { | ||
output[nextKey] = source[nextKey]; | ||
} | ||
@@ -17,3 +17,3 @@ } | ||
} | ||
return target; | ||
return output; | ||
} |
const webpack = require('webpack'); | ||
const path = require('path'); | ||
@@ -7,23 +6,20 @@ module.exports = { | ||
"Object.assign": "./src/Object.assign/index.js", | ||
"Array.find": "./src/Array.find/index.js", | ||
"Array.from": "./src/Array.from/index.js" | ||
"Array.prototype.find": "./src/Array.prototype.find/index.js", | ||
"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" | ||
}, | ||
output: { | ||
path: path.join(__dirname, "dist"), | ||
filename: "[name]/index.js" | ||
filename: "[name].js" | ||
}, | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin({minimize: true}) | ||
new webpack.optimize.UglifyJsPlugin() | ||
], | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
loader: 'babel' | ||
} | ||
] | ||
loaders: [{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
loader: 'babel' | ||
}] | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
281
46
15320
5
25
1