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.5 to 0.0.7

57

fx.js

@@ -0,1 +1,2 @@

// FxJS 0.0.7
export const

@@ -20,4 +21,10 @@ identity = a => a,

is_function = isFunction;
is_function = isFunction,
isArray = Array.isArray,
is_array = isArray,
isUndefined = a => a === undefined;
export const

@@ -56,3 +63,3 @@ hasIter = coll => !!(coll && coll[Symbol.iterator]),

var iter = collIter(coll);
return go1(take(1, iter), head => [head, iter]);
return go1(take(1, iter), ([head]) => [head, iter]);
};

@@ -95,4 +102,6 @@

set2 = curry((obj, kv) => (set(kv, obj), kv));
set2 = curry((obj, kv) => (set(kv, obj), kv)),
set3 = curry((obj, [k, v]) => (obj[k] = v, obj));
export const

@@ -102,5 +111,9 @@ last = arr => arr[arr.length-1];

export const
reduce = curry((f, coll, acc) => {
var iter = collIter(coll);
acc = acc === undefined ? iter.next().value : acc;
reduce = curry(function(f, acc, coll) {
if (arguments.length == 2) {
var iter = collIter(acc);
acc = iter.next().value;
} else {
iter = collIter(coll);
}
return function recur() {

@@ -120,9 +133,10 @@ let cur;

pipe = (f, ...fs) => (...as) => reduce(call2, fs, f(...as)),
pipe = (f, ...fs) => (...as) => reduce(call2, f(...as), fs),
tap = (f, ...fs) => (a, ...as) => go(reduce(call2, fs, f(a, ...as)), _ => a),
tap = (f, ...fs) => (a, ...as) => go(reduce(call2, f(a, ...as), fs), _ => a),
each = curry((f, coll) => go(reduce((_, a) => f(a), coll, null), _ => coll));
each = curry((f, coll) => go(reduce((_, a) => f(a), null, coll), _ => coll));
export const take = curry(function(limit, coll) {
if (limit === 0) return [];
var res = [], iter = collIter(coll);

@@ -182,3 +196,3 @@ return function recur() {

countBy = curry((f, coll) =>
reduce((counts, a) => incSel(counts, f(a)), coll, {})),
reduce((counts, a) => incSel(counts, f(a)), {}, coll)),

@@ -188,3 +202,3 @@ count_by = countBy,

groupBy = curry((f, coll) =>
reduce((group, a) => pushSel(group, f(a), a), coll, {})),
reduce((group, a) => pushSel(group, f(a), a), {}, coll)),

@@ -194,3 +208,3 @@ group_by = groupBy,

indexBy = curry((f, coll) =>
reduce((indexed, a) => set([f(a), a], indexed), coll, {})),
reduce((indexed, a) => set([f(a), a], indexed), {}, coll)),

@@ -217,8 +231,19 @@ index_by = indexBy;

export const
object = coll => reduce((obj, [k, v]) => (obj[k] = v, obj), coll, {}),
object = coll => reduce((obj, [k, v]) => (obj[k] = v, obj), {}, coll),
entryMap = curry((f, [k, a]) => go1(f(a), b => [k, b])),
eMap = entryMap;
eMap = entryMap,
entries = pipe(L.entries, takeAll);
const baseExtend = set => (obj, ...objs) => reduce(reduce(set), obj, L.map(entries, objs));
export const
has = curry((k, obj) => obj.hasOwnProperty(k)),
extend = baseExtend(set3),
defaults = baseExtend(tap((obj, kv) => has(kv[0], obj) || set3(obj, kv)));
export const C = {};

@@ -228,5 +253,5 @@

C.reduce = (f, coll, acc) => reduce(f, [...coll], acc);
C.reduce = (f, coll, acc) => reduce(f, acc, [...coll]);
C.take = curry((limit, coll) => new Promise(function(resolve) {
C.take = curry((limit, coll) => limit === 0 ? [] : new Promise(function(resolve) {
var res = [];

@@ -233,0 +258,0 @@ var i = -1, j = -1, resolved;

{
"name": "fxjs2",
"version": "0.0.5",
"version": "0.0.7",
"description": "Functional Extensions for Javascript",

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

@@ -41,3 +41,3 @@ ## FxJS - Functional Extensions for Javascript

reduce(add, [1, 2, 3], 10);
reduce(add, 10, [1, 2, 3]);
// 16

@@ -44,0 +44,0 @@

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