Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lil-fp

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lil-fp - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

dist/arr-61789cba.d.ts

2

dist/arr.d.ts

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

export { e as at, k as compact, j as concat, g as every, b as filter, c as filterMap, l as flat, d as forEach, f as from, i as has, h as head, m as map, n as next, p as prev, r as reduce, s as some, t as tail, u as uniq } from './arr-bf7e48d4.js';
export { e as at, k as compact, j as concat, g as every, b as filter, c as filterMap, l as flat, d as forEach, f as from, i as has, h as head, m as map, n as next, p as prev, r as reduce, s as some, t as tail, u as uniq } from './arr-61789cba.js';

@@ -40,4 +40,4 @@ "use strict";

module.exports = __toCommonJS(arr_exports);
var from = (v) => Array.from(v), filter = (f) => (arr) => arr.filter(f), map = (f) => (arr) => arr.map(f), reduce = (f, init) => (arr) => arr.reduce(f, init), filterMap = (f) => (arr) => arr.reduce((acc, v) => {
let x = f(v);
var from = (v) => Array.from(v), filter = (f) => (arr) => arr.filter(f), map = (f) => (arr) => arr.map(f), reduce = (f, init) => (arr) => arr.reduce(f, init), filterMap = (f) => (arr) => arr.reduce((acc, v, index, arr2) => {
let x = f(v, index, arr2);
return x === void 0 ? acc : [...acc, x];

@@ -44,0 +44,0 @@ }, []), forEach = (f) => (arr) => arr.forEach(f), next = (i, loop) => (arr) => arr[(i + 1) % (loop ? arr.length : arr.length - 1)], prev = (i, loop) => (arr) => arr[(i - 1 + (loop ? arr.length : 0)) % arr.length], head = (arr) => arr[0], tail = (arr) => arr[arr.length - 1], at = (i) => (arr) => arr.at(i), uniq = (arr) => [...new Set(arr)], some = (f) => (arr) => arr.some(f), every = (f) => (arr) => arr.every(f), has = (v) => (arr) => arr.includes(v), concat = (...others) => (v) => v.concat(...others), compact = (arr) => arr.filter((v) => v !== void 0), flat = (arr) => arr.flat();

@@ -26,5 +26,6 @@ declare function pipe<A, B>(value: A, fn1: (arg: A) => B): B;

declare const noop: () => undefined;
declare const identity: <T>(v: T) => T;
declare const memo: <T extends (...args: any[]) => any>(fn: T) => T;
declare const tryCatch: <T, U, K>(fn: (v: T) => U, onError?: ((err: unknown, v: T) => K) | undefined) => (v: T) => U | (K extends void ? undefined : K);
export { cast, flow, log, memo, noop, pipe, tap, tryCatch };
export { cast, flow, identity, log, memo, noop, pipe, tap, tryCatch };

@@ -22,2 +22,3 @@ "use strict";

flow: () => flow,
identity: () => identity,
log: () => log,

@@ -41,3 +42,3 @@ memo: () => memo,

var log = (label, fn) => (v) => (console.log(`${label}: `, fn?.(v) ?? v), v), cast = (v) => v, noop = () => {
}, memo = (fn) => {
}, identity = (v) => v, memo = (fn) => {
let cache = /* @__PURE__ */ Object.create(null);

@@ -56,2 +57,3 @@ return (arg) => (cache[arg] === void 0 && (cache[arg] = fn(arg)), cache[arg]);

flow,
identity,
log,

@@ -58,0 +60,0 @@ memo,

@@ -1,4 +0,4 @@

export { a as Arr } from './arr-bf7e48d4.js';
export { a as Arr } from './arr-61789cba.js';
export { b as Bool } from './bool-729d4744.js';
export { cast, flow, log, memo, noop, pipe, tap, tryCatch } from './func.js';
export { cast, flow, identity, log, memo, noop, pipe, tap, tryCatch } from './func.js';
export { isArr, isBool, isFunc, isNum, isObj, isStr } from './is.js';

@@ -5,0 +5,0 @@ export { match, orElse, otherwise, when } from './logic.js';

@@ -26,2 +26,3 @@ "use strict";

flow: () => flow,
identity: () => identity,
isArr: () => isArr,

@@ -68,4 +69,4 @@ isBool: () => isBool,

});
var from = (v) => Array.from(v), filter = (f) => (arr) => arr.filter(f), map = (f) => (arr) => arr.map(f), reduce = (f, init) => (arr) => arr.reduce(f, init), filterMap = (f) => (arr) => arr.reduce((acc, v) => {
let x = f(v);
var from = (v) => Array.from(v), filter = (f) => (arr) => arr.filter(f), map = (f) => (arr) => arr.map(f), reduce = (f, init) => (arr) => arr.reduce(f, init), filterMap = (f) => (arr) => arr.reduce((acc, v, index, arr2) => {
let x = f(v, index, arr2);
return x === void 0 ? acc : [...acc, x];

@@ -100,3 +101,3 @@ }, []), forEach = (f) => (arr) => arr.forEach(f), next = (i, loop) => (arr) => arr[(i + 1) % (loop ? arr.length : arr.length - 1)], prev = (i, loop) => (arr) => arr[(i - 1 + (loop ? arr.length : 0)) % arr.length], head = (arr) => arr[0], tail = (arr) => arr[arr.length - 1], at = (i) => (arr) => arr.at(i), uniq = (arr) => [...new Set(arr)], some = (f) => (arr) => arr.some(f), every = (f) => (arr) => arr.every(f), has = (v) => (arr) => arr.includes(v), concat = (...others) => (v) => v.concat(...others), compact = (arr) => arr.filter((v) => v !== void 0), flat = (arr) => arr.flat();

var log = (label, fn) => (v) => (console.log(`${label}: `, fn?.(v) ?? v), v), cast = (v) => v, noop = () => {
}, memo = (fn) => {
}, identity = (v) => v, memo = (fn) => {
let cache = /* @__PURE__ */ Object.create(null);

@@ -129,3 +130,6 @@ return (arg) => (cache[arg] === void 0 && (cache[arg] = fn(arg)), cache[arg]);

}
var otherwise = (fn) => (v) => when(() => !0, fn)(v), orElse = (u) => (v) => v ?? (typeof u == "function" ? u() : u);
var otherwise = (fn) => (v) => when(() => !0, fn)(v), orElse = (u) => (v) => (
// @ts-ignore
v ?? (typeof u == "function" ? u() : u)
);

@@ -255,2 +259,3 @@ // src/obj.ts

flow,
identity,
isArr,

@@ -257,0 +262,0 @@ isBool,

@@ -39,3 +39,6 @@ "use strict";

}
var otherwise = (fn) => (v) => when(() => !0, fn)(v), orElse = (u) => (v) => v ?? (typeof u == "function" ? u() : u);
var otherwise = (fn) => (v) => when(() => !0, fn)(v), orElse = (u) => (v) => (
// @ts-ignore
v ?? (typeof u == "function" ? u() : u)
);
// Annotate the CommonJS export names for ESM import in node:

@@ -42,0 +45,0 @@ 0 && (module.exports = {

{
"name": "lil-fp",
"version": "1.4.1",
"version": "1.4.2",
"description": "Functional programming utilities for TypeScript",

@@ -96,7 +96,7 @@ "main": "dist/index.js",

"devDependencies": {
"@changesets/cli": "^2.26.0",
"@changesets/cli": "^2.26.1",
"@mobily/ts-belt": "^3.13.1",
"prettier": "^2.8.3",
"tsup": "^6.5.0",
"typescript": "^4.9.4"
"prettier": "^2.8.7",
"tsup": "^6.7.0",
"typescript": "^5.0.4"
},

@@ -103,0 +103,0 @@ "scripts": {

@@ -6,3 +6,3 @@ export const from = <T>(

export const filter =
<T>(f: (v: T) => boolean) =>
<T>(f: (v: T, index: number, array: T[]) => boolean) =>
(arr: T[]): T[] =>

@@ -12,3 +12,3 @@ arr.filter(f)

export const map =
<T, U>(f: (v: T) => U) =>
<T, U>(f: (v: T, index: number, array: T[]) => U) =>
(arr: T[]): U[] =>

@@ -18,3 +18,3 @@ arr.map(f)

export const reduce =
<T, U>(f: (acc: U, v: T) => U, init: U) =>
<T, U>(f: (acc: U, v: T, index: number, array: T[]) => U, init: U) =>
(arr: T[]): U =>

@@ -24,6 +24,6 @@ arr.reduce(f, init)

export const filterMap =
<T, U>(f: (v: T) => U | undefined) =>
<T, U>(f: (v: T, index: number, array: T[]) => U | undefined) =>
(arr: T[]): U[] =>
arr.reduce((acc, v) => {
const x = f(v)
arr.reduce((acc, v, index, arr) => {
const x = f(v, index, arr)
return x === undefined ? acc : [...acc, x]

@@ -33,3 +33,3 @@ }, [] as U[])

export const forEach =
<T>(f: (v: T) => void) =>
<T>(f: (v: T, index: number, array: T[]) => void) =>
(arr: T[]): void =>

@@ -60,3 +60,3 @@ arr.forEach(f)

export const some =
<T>(f: (v: T) => boolean) =>
<T>(f: (v: T, index: number, array: T[]) => boolean) =>
(arr: T[]): boolean =>

@@ -66,3 +66,3 @@ arr.some(f)

export const every =
<T>(f: (v: T) => boolean) =>
<T>(f: (v: T, index: number, array: T[]) => boolean) =>
(arr: T[]): boolean =>

@@ -69,0 +69,0 @@ arr.every(f)

@@ -201,2 +201,4 @@ export function pipe<A, B>(value: A, fn1: (arg: A) => B): B

export const identity = <T>(v: T) => v
export const memo = <T extends (...args: any[]) => any>(fn: T): T => {

@@ -203,0 +205,0 @@ const cache = Object.create(null)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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