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

@xylabs/promise

Package Overview
Dependencies
Maintainers
7
Versions
215
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/promise - npm Package Compare versions

Comparing version 2.11.0 to 2.11.1

dist/fulfilled.js

48

dist/index.js
'use strict';
/**
* For use with Promise.allSettled to filter only successful results
* @param val
* @returns
*/
const fulfilled = (val) => {
return val.status === 'fulfilled';
};
var fulfilled = require('./fulfilled.js');
var fulfilledValues = require('./fulfilledValues.js');
var rejected = require('./rejected.js');
/**
* For use with Promise.allSettled to reduce to only successful result values
* @example <caption>Casting the initialValue provided to reduce</caption>
* const resolved = Promise.resolve('resolved')
* const rejected = Promise.reject('rejected')
* const settled = await Promise.allSettled([resolved, rejected])
* const results = settled.reduce(fulfilledValues, [] as string[])
* // results === [ 'resolved' ]
* @example <caption>Providing type parameter to reduce and initialValue type can be inferred</caption>
* const resolved = Promise.resolve('resolved')
* const rejected = Promise.reject('rejected')
* const settled = await Promise.allSettled([resolved, rejected])
* const results = settled.reduce<string[]>(fulfilledValues, [])
* // results === [ 'resolved' ]
* @param previousValue
* @param currentValue
* @returns
*/
const fulfilledValues = (previousValue, currentValue) => {
if (currentValue.status === 'fulfilled')
previousValue.push(currentValue.value);
return previousValue;
};
/**
* For use with Promise.allSettled to filter only rejected results
* @param val
* @returns
*/
const rejected = (val) => {
return val.status === 'rejected';
};
exports.fulfilled = fulfilled;
exports.fulfilledValues = fulfilledValues;
exports.rejected = rejected;
exports.fulfilled = fulfilled.fulfilled;
exports.fulfilledValues = fulfilledValues.fulfilledValues;
exports.rejected = rejected.rejected;
//# sourceMappingURL=index.js.map

@@ -51,4 +51,4 @@ {

"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^3.0.0-rc.15",
"@xylabs/tsconfig": "^3.0.0-rc.15"
"@xylabs/ts-scripts-yarn3": "^3.0.0-rc.16",
"@xylabs/tsconfig": "^3.0.0-rc.16"
},

@@ -63,3 +63,3 @@ "publishConfig": {

"sideEffects": false,
"version": "2.11.0"
"version": "2.11.1"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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