Socket
Socket
Sign inDemoInstall

fxjs2

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fxjs2 - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

draft.js

38

fx.js

@@ -42,3 +42,3 @@ export const

export const
then = (f, a) => a instanceof Promise ? a.then(f) : f(a),
then = curry((f, a) => a instanceof Promise ? a.then(f) : f(a)),

@@ -68,5 +68,12 @@ call = (f, a) => f(a),

const iter = collIter(coll);
acc = acc === undefined ? iter.next().value : acc;
for (const a of iter) acc = then(acc => then(a => f(acc, a), a), acc);
return acc;
return then(function (cur) {
return function recur(acc) {
while ((cur = iter.next()) && !cur.done) {
if (cur instanceof Promise) return cur.then(cur => cur.done ? acc : then(recur, f(acc, cur.value)));
const a = cur.value;
acc = acc instanceof Promise ? acc.then(acc => f(acc, a)) : f(acc, a);
}
return acc;
} (acc === undefined ? cur.value : acc);
}, acc === undefined ? iter.next() : acc);
}),

@@ -83,5 +90,5 @@

export const
lmap = curry(function *(f, coll) {
for (const a of coll) yield f(a);
}),
lmap = curry((f, coll) => baseLazyLispF(function() {
return then(cur => cur.done ? cur : then(value => ({value}), f(cur.value)), this.iter.next());
}, coll)),

@@ -100,4 +107,11 @@ map = curry((f, coll) =>

export const
lfilter = curry((f, coll) => baseLazyLispF(function(cur = this.iter.next()) {
return cur.done ? cur : go(f(cur.value), b => b ? cur : this.next());
lfilter = curry((f, coll) => baseLazyLispF(function() {
var recur = (cur, b) => {
while (!cur.done) {
if (b = f(cur.value)) return then(b => b ? cur : this.next(), b);
if ((cur = this.iter.next()) instanceof Promise) return cur.then(recur);
}
return { done: true }
};
return then(recur, this.iter.next());
}, coll)),

@@ -130,3 +144,5 @@

export const all = coll => reduce(push3, coll, []);
export function all(coll) {
return reduce(push3, coll, []);
}

@@ -173,3 +189,3 @@ export const

function *range(limit) {
export function *range(limit) {
var i = -1;

@@ -176,0 +192,0 @@ while (++i < limit) yield i;

{
"name": "fxjs2",
"version": "0.0.3",
"version": "0.0.4",
"description": "Functional Extensions for Javascript",

@@ -5,0 +5,0 @@ "main": "index.js",

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