Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

p-props

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-props - npm Package Compare versions

Comparing version 5.0.0 to 6.0.0

31

index.d.ts

@@ -1,5 +0,3 @@

import {Options} from 'p-map';
import {type Options} from 'p-map';
export type PromiseResult<Value> = Value extends PromiseLike<infer Result> ? Result : Value;
export type Mapper<ValueType, KeyType, MappedValueType> = (

@@ -44,21 +42,28 @@ value: ValueType,

*/
export default function pProps<
KeyType,
ValueType,
MappedValueType = PromiseResult<ValueType>
export default function pProps< // This overload exists to get more accurate results when the mapper is not defined.
InputType extends Record<PropertyKey, unknown>,
>(
map: ReadonlyMap<KeyType, ValueType>,
mapper?: Mapper<PromiseResult<ValueType>, KeyType, MappedValueType>,
map: InputType,
mapper?: undefined,
options?: Options
): Promise<Map<KeyType, MappedValueType>>;
): Promise<{[key in keyof InputType]: Awaited<InputType[key]>}>;
export default function pProps<
InputType extends Record<string, any>,
InputType extends Record<string, unknown>,
ValueType extends InputType[keyof InputType],
MappedValueType = PromiseResult<ValueType>
MappedValueType = Awaited<ValueType>,
>(
map: InputType,
mapper?: Mapper<PromiseResult<ValueType>, keyof InputType, MappedValueType>,
mapper?: Mapper<Awaited<ValueType>, keyof InputType, MappedValueType>,
options?: Options
): Promise<{[key in keyof InputType]: MappedValueType}>;
export default function pProps<
KeyType,
ValueType,
MappedValueType = Awaited<ValueType>,
>(
map: ReadonlyMap<KeyType, ValueType>,
mapper?: Mapper<Awaited<ValueType>, KeyType, MappedValueType>,
options?: Options
): Promise<Map<KeyType, MappedValueType>>;
export {Options} from 'p-map';

@@ -5,3 +5,3 @@ import pMap from 'p-map';

const isMap = input instanceof Map;
const entries = isMap ? [...input.entries()] : Object.entries(input);
const entries = isMap ? [...input] : Object.entries(input);
const values = await pMap(entries, async ([key, value]) => mapper(await value, key), options);

@@ -8,0 +8,0 @@ const mappedEntries = entries.map(([key], index) => [key, values[index]]);

{
"name": "p-props",
"version": "5.0.0",
"version": "6.0.0",
"description": "Like `Promise.all()` but for `Map` and `Object`",

@@ -14,5 +14,8 @@ "license": "MIT",

"type": "module",
"exports": "./index.js",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"engines": {
"node": ">=12.20"
"node": ">=18"
},

@@ -43,10 +46,10 @@ "scripts": {

"dependencies": {
"p-map": "^5.0.0"
"p-map": "^6.0.0"
},
"devDependencies": {
"ava": "^3.15.0",
"delay": "^5.0.0",
"tsd": "^0.17.0",
"xo": "^0.40.2"
"ava": "^5.3.1",
"delay": "^6.0.0",
"tsd": "^0.29.0",
"xo": "^0.56.0"
}
}

@@ -9,5 +9,5 @@ # p-props

```sh
npm install p-props
```
$ npm install p-props
```

@@ -14,0 +14,0 @@ ## Usage

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc