fairmont-reactive
Advanced tools
Comparing version 1.0.0-beta-20 to 1.0.0-beta-21
// Generated by CoffeeScript 1.9.3 | ||
(function() { | ||
var Method, async, asyncIterator, binary, compact, compose, curry, either, events, filter, has, identity, isAsyncIterable, isAsyncIterator, isAsyncIteratorFunction, isDefined, isFunction, isGenerator, isIterable, isIterator, isIteratorFunction, isPromise, isSource, iterator, iteratorFunction, lines, map, negate, partition, project, property, query, ref, ref1, reject, repeat, select, split, stream, take, takeN, where, | ||
var Method, W, async, asyncIterator, binary, compact, compose, curry, either, events, filter, has, identity, isAsyncIterable, isAsyncIterator, isAsyncIteratorFunction, isDefined, isFunction, isGenerator, isIterable, isIterator, isIteratorFunction, isPromise, isSource, iterator, iteratorFunction, lines, map, negate, partition, project, property, pull, query, ref, ref1, reject, repeat, select, split, stream, take, takeN, where, | ||
slice = [].slice; | ||
W = require("when"); | ||
ref = require("fairmont-core"), identity = ref.identity, curry = ref.curry, compose = ref.compose, binary = ref.binary, negate = ref.negate; | ||
@@ -92,2 +94,60 @@ | ||
Method.define(iteratorFunction, isPromise, function(p) { | ||
var _p; | ||
_p = p.then(function(x) { | ||
return iteratorFunction(x); | ||
}); | ||
return asyncIterator(function() { | ||
return _p.then(function(i) { | ||
return i(); | ||
}); | ||
}); | ||
}); | ||
pull = Method.create(); | ||
Method.define(pull, isDefined, function(x) { | ||
return pull(iteratorFunction(x)); | ||
}); | ||
Method.define(pull, isIteratorFunction, function(i) { | ||
return iterator(function() { | ||
var done, ref2, value; | ||
ref2 = i(), done = ref2.done, value = ref2.value; | ||
if (done) { | ||
return W({ | ||
done: done | ||
}); | ||
} else { | ||
return value.then(function(value) { | ||
return { | ||
done: done, | ||
value: value | ||
}; | ||
}); | ||
} | ||
}); | ||
}); | ||
Method.define(pull, isAsyncIteratorFunction, function(i) { | ||
return asyncIterator(function() { | ||
return i().then(function(arg) { | ||
var done, value; | ||
done = arg.done, value = arg.value; | ||
if (done) { | ||
return W({ | ||
done: done | ||
}); | ||
} else { | ||
return value.then(function(value) { | ||
return { | ||
done: done, | ||
value: value | ||
}; | ||
}); | ||
} | ||
}); | ||
}); | ||
}); | ||
repeat = function(x) { | ||
@@ -108,6 +168,2 @@ return iterator(function() { | ||
Method.define(map, Function, isPromise, async(function*(f, p) { | ||
return map(f, (yield p)); | ||
})); | ||
Method.define(map, Function, isIteratorFunction, function(f, i) { | ||
@@ -131,16 +187,18 @@ return iterator(function() { | ||
Method.define(map, Function, isAsyncIteratorFunction, function(f, i) { | ||
return asyncIterator(async(function*() { | ||
var done, ref2, value; | ||
ref2 = (yield i()), done = ref2.done, value = ref2.value; | ||
if (!done) { | ||
value = f(value); | ||
if (isPromise(value)) { | ||
value = (yield value); | ||
return asyncIterator(function() { | ||
return i().then(function(arg) { | ||
var done, value; | ||
done = arg.done, value = arg.value; | ||
if (done) { | ||
return { | ||
done: done | ||
}; | ||
} else { | ||
return { | ||
done: done, | ||
value: f(value) | ||
}; | ||
} | ||
} | ||
return { | ||
done: done, | ||
value: value | ||
}; | ||
})); | ||
}); | ||
}); | ||
}); | ||
@@ -173,15 +231,11 @@ | ||
Method.define(select, Function, isAsyncIteratorFunction, function(f, i) { | ||
return asyncIterator(async(function*() { | ||
var done, ref2, value; | ||
while (true) { | ||
ref2 = (yield i()), done = ref2.done, value = ref2.value; | ||
if (done || (f(value))) { | ||
break; | ||
} | ||
} | ||
return { | ||
done: done, | ||
value: value | ||
}; | ||
})); | ||
var p; | ||
p = (function(arg) { | ||
var done, value; | ||
done = arg.done, value = arg.value; | ||
return done || (f(value)); | ||
}); | ||
return asyncIterator(function() { | ||
return W.iterate(i, p, (function() {}), i()); | ||
}); | ||
}); | ||
@@ -325,2 +379,8 @@ | ||
name = map.name, end = map.end, error = map.error; | ||
if (end == null) { | ||
end = "end"; | ||
} | ||
if (error == null) { | ||
error = "error"; | ||
} | ||
done = false; | ||
@@ -478,2 +538,3 @@ pending = []; | ||
iteratorFunction: iteratorFunction, | ||
pull: pull, | ||
repeat: repeat, | ||
@@ -480,0 +541,0 @@ map: map, |
{ | ||
"name": "fairmont-reactive", | ||
"version": "1.0.0-beta-20", | ||
"version": "1.0.0-beta-21", | ||
"description": "Functional reactive programming in JavaScript and CoffeeScript.", | ||
@@ -29,2 +29,3 @@ "files": [ | ||
"amen": "^1.0.0-alpha-03", | ||
"fairmont": "^1.0.0-beta-19", | ||
"json": "^9.0.3" | ||
@@ -31,0 +32,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
46606
789
3