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

@brandingbrand/standard-result

Package Overview
Dependencies
Maintainers
93
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brandingbrand/standard-result - npm Package Compare versions

Comparing version 11.28.0 to 11.29.0

src/extract.async.d.ts

9

CHANGELOG.md

@@ -5,2 +5,11 @@ # Changelog

# [11.29.0](https://github.com/brandingbrand/shipyard/compare/v11.28.0...v11.29.0) (2022-02-16)
### Features
* **shared-util-std-result:** add async combinators ([fb3b789](https://github.com/brandingbrand/shipyard/commit/fb3b7899755899a387b7453e7065ea6e472ea93c))
# [11.28.0](https://github.com/brandingbrand/shipyard/compare/v11.27.0...v11.28.0) (2022-02-15)

@@ -7,0 +16,0 @@

217

index-esm.js

@@ -125,2 +125,45 @@ import { makeBranding } from '@brandingbrand/standard-branded';

function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator$3(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
const extractAsync = (onOk, onFail)=>(function() {
var _ref = _asyncToGenerator$3(function*(input) {
const awaitedInput = yield input;
if (isOk(awaitedInput)) {
return onOk(awaitedInput.ok);
}
return onFail(awaitedInput.failure);
});
return function(input) {
return _ref.apply(this, arguments);
};
})()
;
function flatMapAll(...params) {

@@ -133,2 +176,58 @@ const handler = params.pop();

function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator$2(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
const flatMapAsync = (flatMapFn)=>(function() {
var _ref = _asyncToGenerator$2(function*(input) {
const awaitedInput = yield input;
if (isOk(awaitedInput)) {
return flatMapFn(awaitedInput.ok);
}
return awaitedInput;
});
return function(input) {
return _ref.apply(this, arguments);
};
})()
;
const flatMapFailureAsync = (flatMapFn)=>(function() {
var _ref = _asyncToGenerator$2(function*(input) {
const awaitedInput = yield input;
if (isFailure(awaitedInput)) {
return flatMapFn(awaitedInput.failure);
}
return awaitedInput;
});
return function(input) {
return _ref.apply(this, arguments);
};
})()
;
function fromPredicate(predicate, onFail) {

@@ -144,2 +243,60 @@ return (input)=>{

function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator$1(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
const mapOkAsync = (mapFn)=>(function() {
var _ref = _asyncToGenerator$1(function*(input) {
const awaitedInput = yield input;
if (isOk(awaitedInput)) {
const result = yield mapFn(awaitedInput.ok);
return ok(result);
}
return awaitedInput;
});
return function(input) {
return _ref.apply(this, arguments);
};
})()
;
const mapFailureAsync = (mapFn)=>(function() {
var _ref = _asyncToGenerator$1(function*(input) {
const awaitedInput = yield input;
if (isFailure(awaitedInput)) {
const result = yield mapFn(awaitedInput.failure);
return fail(result);
}
return awaitedInput;
});
return function(input) {
return _ref.apply(this, arguments);
};
})()
;
const tryCatch = (throwingFn)=>{

@@ -161,2 +318,60 @@ try {

export { adjoin, affixTo, applyParam, applyUnwrappedParams, build, extract, fail, flatMap, flatMapAll, flatMapAndAdjoin, flatMapFailure, fromPredicate, isFailure, isOk, mapFailure, mapOk, ok, tryCatch, withTryCatch };
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
const tryCatchAsync = function() {
var _ref = _asyncToGenerator(function*(throwingFn) {
try {
const result = yield throwingFn();
return ok(result);
} catch (e) {
return fail(e);
}
});
return function tryCatchAsync(throwingFn) {
return _ref.apply(this, arguments);
};
}();
const withTryCatchAsync = function() {
var _ref = _asyncToGenerator(function*(throwingFn) {
return _asyncToGenerator(function*(...params) {
try {
const result = yield throwingFn(...params);
return ok(result);
} catch (e) {
return fail(e);
}
});
});
return function withTryCatchAsync(throwingFn) {
return _ref.apply(this, arguments);
};
}();
export { adjoin, affixTo, applyParam, applyUnwrappedParams, build, extract, extractAsync, fail, flatMap, flatMapAll, flatMapAndAdjoin, flatMapAsync, flatMapFailure, flatMapFailureAsync, fromPredicate, isFailure, isOk, mapFailure, mapFailureAsync, mapOk, mapOkAsync, ok, tryCatch, tryCatchAsync, withTryCatch, withTryCatchAsync };

@@ -129,2 +129,45 @@ 'use strict';

function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator$3(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
const extractAsync = (onOk, onFail)=>(function() {
var _ref = _asyncToGenerator$3(function*(input) {
const awaitedInput = yield input;
if (isOk(awaitedInput)) {
return onOk(awaitedInput.ok);
}
return onFail(awaitedInput.failure);
});
return function(input) {
return _ref.apply(this, arguments);
};
})()
;
function flatMapAll(...params) {

@@ -137,2 +180,58 @@ const handler = params.pop();

function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator$2(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
const flatMapAsync = (flatMapFn)=>(function() {
var _ref = _asyncToGenerator$2(function*(input) {
const awaitedInput = yield input;
if (isOk(awaitedInput)) {
return flatMapFn(awaitedInput.ok);
}
return awaitedInput;
});
return function(input) {
return _ref.apply(this, arguments);
};
})()
;
const flatMapFailureAsync = (flatMapFn)=>(function() {
var _ref = _asyncToGenerator$2(function*(input) {
const awaitedInput = yield input;
if (isFailure(awaitedInput)) {
return flatMapFn(awaitedInput.failure);
}
return awaitedInput;
});
return function(input) {
return _ref.apply(this, arguments);
};
})()
;
function fromPredicate(predicate, onFail) {

@@ -148,2 +247,60 @@ return (input)=>{

function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator$1(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
const mapOkAsync = (mapFn)=>(function() {
var _ref = _asyncToGenerator$1(function*(input) {
const awaitedInput = yield input;
if (isOk(awaitedInput)) {
const result = yield mapFn(awaitedInput.ok);
return ok(result);
}
return awaitedInput;
});
return function(input) {
return _ref.apply(this, arguments);
};
})()
;
const mapFailureAsync = (mapFn)=>(function() {
var _ref = _asyncToGenerator$1(function*(input) {
const awaitedInput = yield input;
if (isFailure(awaitedInput)) {
const result = yield mapFn(awaitedInput.failure);
return fail(result);
}
return awaitedInput;
});
return function(input) {
return _ref.apply(this, arguments);
};
})()
;
const tryCatch = (throwingFn)=>{

@@ -165,2 +322,60 @@ try {

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
const tryCatchAsync = function() {
var _ref = _asyncToGenerator(function*(throwingFn) {
try {
const result = yield throwingFn();
return ok(result);
} catch (e) {
return fail(e);
}
});
return function tryCatchAsync(throwingFn) {
return _ref.apply(this, arguments);
};
}();
const withTryCatchAsync = function() {
var _ref = _asyncToGenerator(function*(throwingFn) {
return _asyncToGenerator(function*(...params) {
try {
const result = yield throwingFn(...params);
return ok(result);
} catch (e) {
return fail(e);
}
});
});
return function withTryCatchAsync(throwingFn) {
return _ref.apply(this, arguments);
};
}();
exports.adjoin = adjoin;

@@ -172,2 +387,3 @@ exports.affixTo = affixTo;

exports.extract = extract;
exports.extractAsync = extractAsync;
exports.fail = fail;

@@ -177,3 +393,5 @@ exports.flatMap = flatMap;

exports.flatMapAndAdjoin = flatMapAndAdjoin;
exports.flatMapAsync = flatMapAsync;
exports.flatMapFailure = flatMapFailure;
exports.flatMapFailureAsync = flatMapFailureAsync;
exports.fromPredicate = fromPredicate;

@@ -183,5 +401,9 @@ exports.isFailure = isFailure;

exports.mapFailure = mapFailure;
exports.mapFailureAsync = mapFailureAsync;
exports.mapOk = mapOk;
exports.mapOkAsync = mapOkAsync;
exports.ok = ok;
exports.tryCatch = tryCatch;
exports.tryCatchAsync = tryCatchAsync;
exports.withTryCatch = withTryCatch;
exports.withTryCatchAsync = withTryCatchAsync;

8

package.json
{
"name": "@brandingbrand/standard-result",
"version": "11.28.0",
"version": "11.29.0",
"license": "MIT",

@@ -9,7 +9,7 @@ "typings": "./src/index.d.ts",

"dependencies": {
"@brandingbrand/standard-compose": "11.28.0",
"@brandingbrand/types-utility": "11.28.0",
"@brandingbrand/standard-branded": "11.28.0"
"@brandingbrand/standard-compose": "11.29.0",
"@brandingbrand/types-utility": "11.29.0",
"@brandingbrand/standard-branded": "11.29.0"
},
"peerDependencies": {}
}
export * from './apply-param';
export * from './builder';
export * from './extract';
export * from './extract.async';
export * from './flat-map';
export * from './flat-map-all';
export * from './flat-map';
export * from './flat-map.async';
export * from './from-predicate';
export * from './map';
export * from './map.async';
export * from './result';
export * from './try-catch';
export * from './try-catch.async';
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