$
This commit is contained in:
20
node_modules/fromentries/LICENSE
generated
vendored
Normal file
20
node_modules/fromentries/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Feross Aboukhadijeh
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
70
node_modules/fromentries/README.md
generated
vendored
Normal file
70
node_modules/fromentries/README.md
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
# fromentries [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
|
||||
|
||||
[travis-image]: https://img.shields.io/travis/feross/fromentries/master.svg
|
||||
[travis-url]: https://travis-ci.org/feross/fromentries
|
||||
[npm-image]: https://img.shields.io/npm/v/fromentries.svg
|
||||
[npm-url]: https://npmjs.org/package/fromentries
|
||||
[downloads-image]: https://img.shields.io/npm/dm/fromentries.svg
|
||||
[downloads-url]: https://npmjs.org/package/fromentries
|
||||
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
|
||||
[standard-url]: https://standardjs.com
|
||||
|
||||
### Object.fromEntries() ponyfill (in 6 lines)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install fromentries
|
||||
```
|
||||
|
||||
## Why this package?
|
||||
|
||||
Existing polyfill packages (like
|
||||
[`object.fromentries`](https://github.com/es-shims/Object.fromEntries))
|
||||
pull in a bunch of dependencies and **adds over 8
|
||||
KB** to the browser bundle size. This allows them to work in ES3 environments
|
||||
like IE6, but it's also overkill; almost no one supports IE6 anymore.
|
||||
|
||||
I'd rather not ship tons of extra code to website visitors. A polyfill for this
|
||||
feature can be implemented in a few short lines of code using modern language
|
||||
features. That's what `fromentries` (this package) does.
|
||||
|
||||
This means that `fromentries` only works in evergreen browsers like:
|
||||
|
||||
- Chrome
|
||||
- Firefox
|
||||
- Edge
|
||||
- Safari
|
||||
- Opera
|
||||
|
||||
It does not work in browsers like IE11 and older (unless you transpile it first).
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const fromEntries = require('fromentries')
|
||||
|
||||
const map = new Map([ [ 'a', 1 ], [ 'b', 2 ], [ 'c', 3 ] ])
|
||||
const obj = fromEntries(map)
|
||||
constole.log(obj) // { a: 1, b: 2, c: 3 }
|
||||
|
||||
const searchParams = new URLSearchParams('foo=bar&baz=qux')
|
||||
const obj2 = fromEntries(searchParams)
|
||||
console.log(obj2) // { foo: 'bar', 'baz': 'qux' }
|
||||
```
|
||||
|
||||
## What is a ponyfill?
|
||||
|
||||
> A *ponyfill* is almost the same as a polyfill, but not quite. Instead of
|
||||
> patching functionality for older browsers, a ponyfill provides that
|
||||
> functionality as a standalone module you can use.
|
||||
|
||||
Read more at [PonyFoo](https://ponyfoo.com/articles/polyfills-or-ponyfills).
|
||||
|
||||
## See also
|
||||
|
||||
- [TC39 proposal for Object.fromEntries](https://github.com/tc39/proposal-object-from-entries)
|
||||
|
||||
## License
|
||||
|
||||
MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).
|
6
node_modules/fromentries/index.js
generated
vendored
Normal file
6
node_modules/fromentries/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
module.exports = function fromEntries (iterable) {
|
||||
return [...iterable].reduce((obj, [key, val]) => {
|
||||
obj[key] = val
|
||||
return obj
|
||||
}, {})
|
||||
}
|
43
node_modules/fromentries/package.json
generated
vendored
Normal file
43
node_modules/fromentries/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "fromentries",
|
||||
"description": "Object.fromEntries() ponyfill (in 6 lines)",
|
||||
"version": "1.2.0",
|
||||
"author": {
|
||||
"name": "Feross Aboukhadijeh",
|
||||
"email": "feross@feross.org",
|
||||
"url": "https://feross.org"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/feross/fromentries/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"standard": "*",
|
||||
"tape": "^4.9.1"
|
||||
},
|
||||
"homepage": "https://github.com/feross/fromentries",
|
||||
"keywords": [
|
||||
"Object.fromEntries",
|
||||
"Object.entries",
|
||||
"Object.values",
|
||||
"Object.keys",
|
||||
"entries",
|
||||
"values",
|
||||
"fromEntries",
|
||||
"ES7",
|
||||
"ES8",
|
||||
"shim",
|
||||
"object",
|
||||
"keys",
|
||||
"polyfill",
|
||||
"ponyfill"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/feross/fromentries.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tape test/**/*.js"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user