Comparing version 1.0.0 to 1.1.0
20
index.js
'use strict'; | ||
const map = input => new Promise((resolve, reject) => { | ||
Promise.all(input.values()).then(values => { | ||
const map = input => { | ||
return Promise.all(input.values()).then(values => { | ||
const ret = new Map(); | ||
@@ -13,11 +13,11 @@ | ||
resolve(ret); | ||
}).catch(reject); | ||
}); | ||
return ret; | ||
}); | ||
}; | ||
const obj = input => new Promise((resolve, reject) => { | ||
const obj = input => { | ||
// TODO: use `Object.entries()` when targeting Node.js 6 | ||
const keys = Object.keys(input); | ||
Promise.all(keys.map(key => input[key])).then(values => { | ||
return Promise.all(keys.map(key => input[key])).then(values => { | ||
const ret = {}; | ||
@@ -36,6 +36,6 @@ | ||
resolve(ret); | ||
}).catch(reject); | ||
}); | ||
return ret; | ||
}); | ||
}; | ||
module.exports = input => input instanceof Map ? map(input) : obj(input); |
{ | ||
"name": "p-props", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Like `Promise.all()` but for `Map` and `Object`", | ||
@@ -29,3 +29,2 @@ "license": "MIT", | ||
"properties", | ||
"props", | ||
"entries", | ||
@@ -42,8 +41,5 @@ "async", | ||
"ava": "*", | ||
"delay": "^1.3.1", | ||
"delay": "^2.0.0", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
} |
@@ -11,3 +11,3 @@ # p-props [![Build Status](https://travis-ci.org/sindresorhus/p-props.svg?branch=master)](https://travis-ci.org/sindresorhus/p-props) | ||
``` | ||
$ npm install --save p-props | ||
$ npm install p-props | ||
``` | ||
@@ -14,0 +14,0 @@ |
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
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
4219