Socket
Socket
Sign inDemoInstall

rambda

Package Overview
Dependencies
Maintainers
1
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rambda - npm Package Compare versions

Comparing version 6.0.1 to 6.1.0

src/once.js

89

dist/rambda.esm.js

@@ -402,25 +402,17 @@ function F() {

function map(fn, list) {
if (arguments.length === 1) return _list => map(fn, _list);
function mapArray(fn, list, isIndexed = false) {
let index = 0;
const willReturn = Array(list.length);
if (list === undefined) {
return [];
while (index < list.length) {
willReturn[index] = isIndexed ? fn(list[index], index) : fn(list[index]);
index++;
}
if (_isArray(list)) {
let index = 0;
const len = list.length;
const willReturn = Array(len);
while (index < len) {
willReturn[index] = fn(list[index]);
index++;
}
return willReturn;
}
return willReturn;
}
function mapObject(fn, obj) {
let index = 0;
const keys = _keys(list);
const keys = _keys(obj);

@@ -432,3 +424,3 @@ const len = keys.length;

const key = keys[index];
willReturn[key] = fn(list[key], key, list);
willReturn[key] = fn(obj[key], key, obj);
index++;

@@ -439,2 +431,8 @@ }

}
function map(fn, list) {
if (arguments.length === 1) return _list => map(fn, _list);
if (list === undefined) return [];
if (_isArray(list)) return mapArray(fn, list);
return mapObject(fn, list);
}

@@ -727,11 +725,3 @@ function max(x, y) {

}
function filter(predicate, list) {
if (arguments.length === 1) return _list => filter(predicate, _list);
if (!list) return [];
if (!_isArray(list)) {
return filterObject(predicate, list);
}
function filterArray(predicate, list, indexed = false) {
let index = 0;

@@ -742,6 +732,6 @@ const len = list.length;

while (index < len) {
const value = list[index];
const predicateResult = indexed ? predicate(list[index], index) : predicate(list[index]);
if (predicate(value)) {
willReturn.push(value);
if (predicateResult) {
willReturn.push(list[index]);
}

@@ -754,3 +744,12 @@

}
function filter(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => filter(predicate, _iterable);
}
if (!iterable) return [];
if (_isArray(iterable)) return filterArray(predicate, iterable);
return filterObject(predicate, iterable);
}
function find(predicate, list) {

@@ -1361,2 +1360,28 @@ if (arguments.length === 1) return _list => find(predicate, _list);

function onceFn(fn, context) {
let result;
return function () {
if (fn) {
result = fn.apply(context || this, arguments);
fn = null;
}
return result;
};
}
function once(fn, context) {
if (arguments.length === 1) {
const wrap = onceFn(fn, context);
return curry(wrap);
}
return onceFn(fn, context);
}
function or(a, b) {
if (arguments.length === 1) return _b => or(a, _b);
return a || b;
}
const Identity = x => ({

@@ -1895,2 +1920,2 @@ x,

export { F, T, add, adjust, all, allPass, always, and, any, anyPass, append, applySpec, assoc, assocPath, both, chain, clamp, clone, complement, compose, concat, cond, converge, curry, curryN, dec, defaultTo, difference, dissoc, divide, drop, dropLast, either, endsWith, equals, filter, find, findIndex, findLast, findLastIndex, flatten, flip, forEach, fromPairs, groupBy, groupWith, has, hasPath, head, identical, identity, ifElse, inc, includes, indexBy, indexOf, init, intersection, intersperse, is, isEmpty, isNil, join, keys, last, lastIndexOf, length, lens, lensIndex, lensPath, lensProp, map, match, mathMod, max, maxBy, maxByFn, mean, median, merge, mergeAll, mergeDeepRight, mergeLeft, min, minBy, minByFn, modulo, move, multiply, negate, none, not, nth, of, omit, over, partial, partition, path, pathEq, pathOr, paths, pick, pickAll, pipe, pluck, prepend, product, prop, propEq, propIs, propOr, range, reduce, reject, repeat, replace, reverse, set, slice, sort, sortBy, split, splitEvery, startsWith, subtract, sum, symmetricDifference, tail, take, takeLast, takeWhile, tap, test, times, toLower, toPairs, toString, toUpper, transpose, trim, tryCatch, type, union, uniq, uniqWith, unless, update, values, view, when, where, whereEq, without, xor, zip, zipObj };
export { F, T, add, adjust, all, allPass, always, and, any, anyPass, append, applySpec, assoc, assocPath, both, chain, clamp, clone, complement, compose, concat, cond, converge, curry, curryN, dec, defaultTo, difference, dissoc, divide, drop, dropLast, either, endsWith, equals, filter, filterArray, filterObject, find, findIndex, findLast, findLastIndex, flatten, flip, forEach, fromPairs, groupBy, groupWith, has, hasPath, head, identical, identity, ifElse, inc, includes, indexBy, indexOf, init, intersection, intersperse, is, isEmpty, isNil, join, keys, last, lastIndexOf, length, lens, lensIndex, lensPath, lensProp, map, mapArray, mapObject, match, mathMod, max, maxBy, maxByFn, mean, median, merge, mergeAll, mergeDeepRight, mergeLeft, min, minBy, minByFn, modulo, move, multiply, negate, none, not, nth, of, omit, once, or, over, partial, partition, path, pathEq, pathOr, paths, pick, pickAll, pipe, pluck, prepend, product, prop, propEq, propIs, propOr, range, reduce, reject, repeat, replace, reverse, set, slice, sort, sortBy, split, splitEvery, startsWith, subtract, sum, symmetricDifference, tail, take, takeLast, takeWhile, tap, test, times, toLower, toPairs, toString, toUpper, transpose, trim, tryCatch, type, union, uniq, uniqWith, unless, update, values, view, when, where, whereEq, without, xor, zip, zipObj };

@@ -406,25 +406,17 @@ 'use strict';

function map(fn, list) {
if (arguments.length === 1) return _list => map(fn, _list);
function mapArray(fn, list, isIndexed = false) {
let index = 0;
const willReturn = Array(list.length);
if (list === undefined) {
return [];
while (index < list.length) {
willReturn[index] = isIndexed ? fn(list[index], index) : fn(list[index]);
index++;
}
if (_isArray(list)) {
let index = 0;
const len = list.length;
const willReturn = Array(len);
while (index < len) {
willReturn[index] = fn(list[index]);
index++;
}
return willReturn;
}
return willReturn;
}
function mapObject(fn, obj) {
let index = 0;
const keys = _keys(list);
const keys = _keys(obj);

@@ -436,3 +428,3 @@ const len = keys.length;

const key = keys[index];
willReturn[key] = fn(list[key], key, list);
willReturn[key] = fn(obj[key], key, obj);
index++;

@@ -443,2 +435,8 @@ }

}
function map(fn, list) {
if (arguments.length === 1) return _list => map(fn, _list);
if (list === undefined) return [];
if (_isArray(list)) return mapArray(fn, list);
return mapObject(fn, list);
}

@@ -731,11 +729,3 @@ function max(x, y) {

}
function filter(predicate, list) {
if (arguments.length === 1) return _list => filter(predicate, _list);
if (!list) return [];
if (!_isArray(list)) {
return filterObject(predicate, list);
}
function filterArray(predicate, list, indexed = false) {
let index = 0;

@@ -746,6 +736,6 @@ const len = list.length;

while (index < len) {
const value = list[index];
const predicateResult = indexed ? predicate(list[index], index) : predicate(list[index]);
if (predicate(value)) {
willReturn.push(value);
if (predicateResult) {
willReturn.push(list[index]);
}

@@ -758,3 +748,12 @@

}
function filter(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => filter(predicate, _iterable);
}
if (!iterable) return [];
if (_isArray(iterable)) return filterArray(predicate, iterable);
return filterObject(predicate, iterable);
}
function find(predicate, list) {

@@ -1365,2 +1364,28 @@ if (arguments.length === 1) return _list => find(predicate, _list);

function onceFn(fn, context) {
let result;
return function () {
if (fn) {
result = fn.apply(context || this, arguments);
fn = null;
}
return result;
};
}
function once(fn, context) {
if (arguments.length === 1) {
const wrap = onceFn(fn, context);
return curry(wrap);
}
return onceFn(fn, context);
}
function or(a, b) {
if (arguments.length === 1) return _b => or(a, _b);
return a || b;
}
const Identity = x => ({

@@ -1935,2 +1960,4 @@ x,

exports.filter = filter;
exports.filterArray = filterArray;
exports.filterObject = filterObject;
exports.find = find;

@@ -1972,2 +1999,4 @@ exports.findIndex = findIndex;

exports.map = map;
exports.mapArray = mapArray;
exports.mapObject = mapObject;
exports.match = match;

@@ -1996,2 +2025,4 @@ exports.mathMod = mathMod;

exports.omit = omit;
exports.once = once;
exports.or = or;
exports.over = over;

@@ -1998,0 +2029,0 @@ exports.partial = partial;

@@ -408,25 +408,17 @@ (function (global, factory) {

function map(fn, list) {
if (arguments.length === 1) return _list => map(fn, _list);
function mapArray(fn, list, isIndexed = false) {
let index = 0;
const willReturn = Array(list.length);
if (list === undefined) {
return [];
while (index < list.length) {
willReturn[index] = isIndexed ? fn(list[index], index) : fn(list[index]);
index++;
}
if (_isArray(list)) {
let index = 0;
const len = list.length;
const willReturn = Array(len);
while (index < len) {
willReturn[index] = fn(list[index]);
index++;
}
return willReturn;
}
return willReturn;
}
function mapObject(fn, obj) {
let index = 0;
const keys = _keys(list);
const keys = _keys(obj);

@@ -438,3 +430,3 @@ const len = keys.length;

const key = keys[index];
willReturn[key] = fn(list[key], key, list);
willReturn[key] = fn(obj[key], key, obj);
index++;

@@ -445,2 +437,8 @@ }

}
function map(fn, list) {
if (arguments.length === 1) return _list => map(fn, _list);
if (list === undefined) return [];
if (_isArray(list)) return mapArray(fn, list);
return mapObject(fn, list);
}

@@ -733,11 +731,3 @@ function max(x, y) {

}
function filter(predicate, list) {
if (arguments.length === 1) return _list => filter(predicate, _list);
if (!list) return [];
if (!_isArray(list)) {
return filterObject(predicate, list);
}
function filterArray(predicate, list, indexed = false) {
let index = 0;

@@ -748,6 +738,6 @@ const len = list.length;

while (index < len) {
const value = list[index];
const predicateResult = indexed ? predicate(list[index], index) : predicate(list[index]);
if (predicate(value)) {
willReturn.push(value);
if (predicateResult) {
willReturn.push(list[index]);
}

@@ -760,3 +750,12 @@

}
function filter(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => filter(predicate, _iterable);
}
if (!iterable) return [];
if (_isArray(iterable)) return filterArray(predicate, iterable);
return filterObject(predicate, iterable);
}
function find(predicate, list) {

@@ -1367,2 +1366,28 @@ if (arguments.length === 1) return _list => find(predicate, _list);

function onceFn(fn, context) {
let result;
return function () {
if (fn) {
result = fn.apply(context || this, arguments);
fn = null;
}
return result;
};
}
function once(fn, context) {
if (arguments.length === 1) {
const wrap = onceFn(fn, context);
return curry(wrap);
}
return onceFn(fn, context);
}
function or(a, b) {
if (arguments.length === 1) return _b => or(a, _b);
return a || b;
}
const Identity = x => ({

@@ -1937,2 +1962,4 @@ x,

exports.filter = filter;
exports.filterArray = filterArray;
exports.filterObject = filterObject;
exports.find = find;

@@ -1974,2 +2001,4 @@ exports.findIndex = findIndex;

exports.map = map;
exports.mapArray = mapArray;
exports.mapObject = mapObject;
exports.match = match;

@@ -1998,2 +2027,4 @@ exports.mathMod = mathMod;

exports.omit = omit;
exports.once = once;
exports.or = or;
exports.over = over;

@@ -2000,0 +2031,0 @@ exports.partial = partial;

@@ -6,6 +6,9 @@ import { F as FunctionToolbelt, O as ObjectToolbelt, L as ListToolbelt } from "./_ts-toolbelt/src/ts-toolbelt";

type FilterFunctionArray<T> = (x: T) => boolean;
type FilterPredicateIndexed<T> = (x: T, i: number) => boolean;
type FilterFunctionObject<T> = (x: T, prop: string, inputObj: Dictionary<T>) => boolean;
type MapFunctionObject<T, U> = (x: T, prop: string, inputObj: Dictionary<T>) => U;
type MapFunctionArray<T, U> = (x: T) => U;
type MapFunctionArrayIndexed<T, U> = (x: T, i: number) => U;
type MapIterator<T> = (x: T) => U;
type MapIndexedIterator<T, U> = (x: T, i: number) => U;

@@ -164,8 +167,14 @@ type SimplePredicate<T> = (x: T) => boolean;

/**
* Returns `true` if both arguments are `true`. Otherwise, it returns `false`.
* Logical AND
*/
export function and<T extends { and?: ((...a: any[]) => any); } | number | boolean | string | null>(x: T, y: any): boolean;
export function and<T extends { and?: ((...a: any[]) => any); } | number | boolean | string | null>(x: T): (y: any) => boolean;
export function and<T, U>(x: T, y: U): T | U;
export function and<T>(x: T): <U>(y: U) => T | U;
/**
* Logical OR
*/
export function or<T, U>(a: T, b: U): T | U;
export function or<T>(a: T): <U>(b: U) => T | U;
/**
* It returns `true`, if at least one member of `list` returns true, when passed to a `predicate` function.

@@ -688,12 +697,12 @@ */

/**
* It returns the result of looping through `list` with `fn`.
* It returns the result of looping through `iterable` with `fn`.
*
* It works with both array and object.
*/
export function map<T, U>(fn: MapFunctionObject<T, U>, list: Dictionary<T>): Dictionary<U>;
export function map<T, U>(fn: MapIterator<T, U>, list: T[]): U[];
export function map<T, U>(fn: MapIterator<T, U>): (list: T[]) => U[];
export function map<T, U, S>(fn: MapFunctionObject<T, U>): (list: Dictionary<T>) => Dictionary<U>;
export function map<T>(fn: MapIterator<T, T>): (list: T[]) => T[];
export function map<T>(fn: MapIterator<T, T>, list: T[]): T[];
export function map<T, U>(fn: MapFunctionObject<T, U>, iterable: Dictionary<T>): Dictionary<U>;
export function map<T, U>(fn: MapIterator<T, U>, iterable: T[]): U[];
export function map<T, U>(fn: MapIterator<T, U>): (iterable: T[]) => U[];
export function map<T, U, S>(fn: MapFunctionObject<T, U>): (iterable: Dictionary<T>) => Dictionary<U>;
export function map<T>(fn: MapIterator<T, T>): (iterable: T[]) => T[];
export function map<T>(fn: MapIterator<T, T>, iterable: T[]): T[];

@@ -817,2 +826,7 @@ /**

/**
* It returns a function, which invokes only once `fn` function.
*/
export function once<T extends (...args: any[]) => any>(func: T): T;
/**
* It returns a partial copy of an `obj` without `propsToOmit` properties.

@@ -819,0 +833,0 @@ */

{
"name": "rambda",
"scripts": {
"new": "node scripts/add-new-method/add-new-method.js",
"test": "jest source --bail=true",

@@ -21,3 +22,3 @@ "cover:spec": "jest source --coverage --no-cache -w 1",

"main": "./dist/rambda.js",
"version": "6.0.1",
"version": "6.1.0",
"dependencies": {},

@@ -24,0 +25,0 @@ "devDependencies": {

import { _isArray } from './_internals/_isArray'
function filterObject(fn, obj){
export function filterObject(fn, obj){
const willReturn = {}

@@ -17,11 +17,5 @@

export function filter(predicate, list){
if (arguments.length === 1) return _list => filter(predicate, _list)
if (!list) return []
if (!_isArray(list)){
return filterObject(predicate, list)
}
export function filterArray(
predicate, list, indexed = false
){
let index = 0

@@ -32,6 +26,7 @@ const len = list.length

while (index < len){
const value = list[ index ]
if (predicate(value)){
willReturn.push(value)
const predicateResult = indexed ?
predicate(list[ index ], index) :
predicate(list[ index ])
if (predicateResult){
willReturn.push(list[ index ])
}

@@ -44,1 +39,11 @@

}
export function filter(predicate, iterable){
if (arguments.length === 1){
return _iterable => filter(predicate, _iterable)
}
if (!iterable) return []
if (_isArray(iterable)) return filterArray(predicate, iterable)
return filterObject(predicate, iterable)
}
import { _isArray } from './_internals/_isArray'
import { _keys } from './_internals/_keys'
export function map(fn, list){
if (arguments.length === 1) return _list => map(fn, _list)
export function mapArray(
fn, list, isIndexed = false
){
let index = 0
const willReturn = Array(list.length)
if (list === undefined){
return []
while (index < list.length){
willReturn[ index ] = isIndexed ? fn(list[ index ], index) : fn(list[ index ])
index++
}
if (_isArray(list)){
let index = 0
const len = list.length
const willReturn = Array(len)
return willReturn
}
while (index < len){
willReturn[ index ] = fn(
list[ index ]
)
index++
}
return willReturn
}
export function mapObject(fn, obj){
let index = 0
const keys = _keys(list)
const keys = _keys(obj)
const len = keys.length

@@ -33,3 +28,3 @@ const willReturn = {}

willReturn[ key ] = fn(
list[ key ], key, list
obj[ key ], key, obj
)

@@ -41,1 +36,9 @@ index++

}
export function map(fn, list){
if (arguments.length === 1) return _list => map(fn, _list)
if (list === undefined) return []
if (_isArray(list)) return mapArray(fn, list)
return mapObject(fn, list)
}

Sorry, the diff of this file is too big to display

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