callbag-map-promise
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -6,2 +6,8 @@ import pipe from 'callbag-pipe' | ||
const transfer = (data)=>(type,d)=>{ | ||
if(type !== 0) return | ||
d(1,data) | ||
} | ||
export default fn=>source=>{ | ||
@@ -12,3 +18,3 @@ return pipe( | ||
d = fn(d) | ||
return d instanceof Promise ? fromPromise(d) : d | ||
return d instanceof Promise ? fromPromise(d) : transfer(d) | ||
}), | ||
@@ -15,0 +21,0 @@ flatten |
@@ -18,2 +18,9 @@ "use strict"; | ||
var transfer = function transfer(data) { | ||
return function (type, d) { | ||
if (type !== 0) return; | ||
d(1, data); | ||
}; | ||
}; | ||
var _default = function _default(fn) { | ||
@@ -23,3 +30,3 @@ return function (source) { | ||
d = fn(d); | ||
return d instanceof Promise ? (0, _callbagFromPromise.default)(d) : d; | ||
return d instanceof Promise ? (0, _callbagFromPromise.default)(d) : transfer(d); | ||
}), _callbagFlatten.default); | ||
@@ -26,0 +33,0 @@ }; |
{ | ||
"name": "callbag-map-promise", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "callbag map+fromPromise+flatten", | ||
"main": "./lib", | ||
"scripts": { | ||
"test": "ava", | ||
"test": "npm run build && ava", | ||
"build": "babel index.js --out-dir lib --presets @babel/preset-env --plugins @babel/plugin-proposal-pipeline-operator" | ||
@@ -9,0 +9,0 @@ }, |
@@ -39,2 +39,9 @@ import test from "ava" | ||
}) | ||
fromPromise(fetchUser("judicy")) | ||
|> mapPromise(user => 123) | ||
|> forEach(friends => { | ||
t.deepEqual(friends, 123) | ||
t.end() | ||
}) | ||
}) |
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
5795
82