Socket
Socket
Sign inDemoInstall

my-easy-fp

Package Overview
Dependencies
0
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.18.2 to 0.19.0

8

dist/cjs/index.d.ts

@@ -109,7 +109,7 @@ /**

/**
* Same behavior of Array.prototype.at but at function result will be undefined throw exception.
* Same behavior of Array.prototype.find but at function result will be undefined throw exception.
*
* @param values array arguments
* @param index array index arguments
* @returns element of array at the index order
* @param predicate predicate function
* @returns find result
*/

@@ -143,3 +143,3 @@ declare function findOrThrow<T>(values: T[], predicate: (value: T, index: number, obj: T[]) => unknown): T;

declare function isEmpty<T>(value?: T | undefined | null): value is undefined | null;
declare function isError(err?: unknown): Error | undefined;
declare function isError(err: unknown, defaultValue: Error): Error;
declare function isFalse(value: boolean): boolean;

@@ -146,0 +146,0 @@ /**

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

"use strict";function r(r){return null==r||(!("number"!=typeof r||!Number.isNaN(r))||("string"==typeof r&&""===r||(!!("object"==typeof r&&Array.isArray(r)&&r.length<1)||"object"==typeof r&&!(r instanceof Date)&&Object.keys(r).length<1)))}function t(r){return null===r}function n(r){return void 0===r}function e(r){return!t(r)}function o(r){return!n(r)}exports.atOrThrow=function(r,t){if(!Array.isArray(r)&&null==r)throw new Error(`Invalid Index: ${t}/ ${r}`);if(!Array.isArray(r))return r;if(r.length<=t)throw new Error(`Invalid Index: ${t}/ ${r.length}`);const n=r[t];if(null==n)throw new Error(`Invalid Index: ${t}/ ${r.length}`);return n},exports.atOrUndefined=function(r,t){if(!Array.isArray(r)&&null==r)return;if(!Array.isArray(r))return r;if(r.length<=t)return;const n=r[t];return null!=n?n:void 0},exports.chunk=function(r,t){return Array.from({length:Math.ceil(r.length/t)},((n,e)=>r.slice(e*t,e*t+t)))},exports.findOrThrow=function(r,t){const n=r.find(t);if(null==n)throw new Error("findOrThrow got undefined result");return n},exports.first=function(r){return Array.isArray(r)?function(r){const[t]=r;return t}(r):r},exports.getRandomRange=function(r,t){return Math.random()*(t-r)+r},exports.getRandomRangeInt=function(r,t){const n=Math.ceil(r),e=Math.floor(t);return Math.floor(Math.random()*(e-n))+r},exports.invert=function(r){return!r},exports.isComplexEmpty=r,exports.isEmpty=function(r){return n(r)||t(r)},exports.isError=function(r){return r instanceof Error||null!=r&&"object"==typeof r&&"message"in r&&"stack"in r?r:void 0},exports.isFalse=function(r){return!r},exports.isNotComplexEmpty=function(t){return!r(t)},exports.isNotEmpty=function(r){return o(r)&&e(r)},exports.isNotNull=e,exports.isNotUndefined=o,exports.isNull=t,exports.isTrue=function(r){return r},exports.isUndefined=n,exports.last=function(r){return r[r.length-1]},exports.populate=function(r,t){const n=null==t?0:1;return new Array(r).fill(0).map(((r,t)=>t+n))},exports.settify=function(r){return Array.from(new Set(r))},exports.sleep=async function(r=1e3){return new Promise((t=>{setTimeout((()=>t(void 0)),r)}))},exports.toArray=function(r){return Array.isArray(r)?r:[r]},exports.typedkey=function(r){return Object.keys(r)};
"use strict";function r(r){return null==r||(!("number"!=typeof r||!Number.isNaN(r))||("string"==typeof r&&""===r||(!!("object"==typeof r&&Array.isArray(r)&&r.length<1)||"object"==typeof r&&!(r instanceof Date)&&Object.keys(r).length<1)))}function n(r){return null===r}function t(r){return void 0===r}function e(r){return!n(r)}function o(r){return!t(r)}exports.atOrThrow=function(r,n){if(!Array.isArray(r)&&null==r)throw new Error(`Invalid Index: ${n}/ ${r}`);if(!Array.isArray(r))return r;if(r.length<=n)throw new Error(`Invalid Index: ${n}/ ${r.length}`);const t=r[n];if(null==t)throw new Error(`Invalid Index: ${n}/ ${r.length}`);return t},exports.atOrUndefined=function(r,n){if(!Array.isArray(r)&&null==r)return;if(!Array.isArray(r))return r;if(r.length<=n)return;const t=r[n];return null!=t?t:void 0},exports.chunk=function(r,n){return Array.from({length:Math.ceil(r.length/n)},((t,e)=>r.slice(e*n,e*n+n)))},exports.findOrThrow=function(r,n){const t=r.find(n);if(null==t)throw new Error("findOrThrow got undefined result");return t},exports.first=function(r){return Array.isArray(r)?function(r){const[n]=r;return n}(r):r},exports.getRandomRange=function(r,n){return Math.random()*(n-r)+r},exports.getRandomRangeInt=function(r,n){const t=Math.ceil(r),e=Math.floor(n);return Math.floor(Math.random()*(e-t))+r},exports.invert=function(r){return!r},exports.isComplexEmpty=r,exports.isEmpty=function(r){return t(r)||n(r)},exports.isError=function(r,n){return r instanceof Error||null!=r&&"object"==typeof r&&"message"in r&&"stack"in r?r:null!=n?n:void 0},exports.isFalse=function(r){return!r},exports.isNotComplexEmpty=function(n){return!r(n)},exports.isNotEmpty=function(r){return o(r)&&e(r)},exports.isNotNull=e,exports.isNotUndefined=o,exports.isNull=n,exports.isTrue=function(r){return r},exports.isUndefined=t,exports.last=function(r){return r[r.length-1]},exports.populate=function(r,n){const t=null==n?0:1;return new Array(r).fill(0).map(((r,n)=>n+t))},exports.settify=function(r){return Array.from(new Set(r))},exports.sleep=async function(r=1e3){return new Promise((n=>{setTimeout((()=>n(void 0)),r)}))},exports.toArray=function(r){return Array.isArray(r)?r:[r]},exports.typedkey=function(r){return Object.keys(r)};
//# sourceMappingURL=index.js.map

@@ -109,7 +109,7 @@ /**

/**
* Same behavior of Array.prototype.at but at function result will be undefined throw exception.
* Same behavior of Array.prototype.find but at function result will be undefined throw exception.
*
* @param values array arguments
* @param index array index arguments
* @returns element of array at the index order
* @param predicate predicate function
* @returns find result
*/

@@ -143,3 +143,3 @@ declare function findOrThrow<T>(values: T[], predicate: (value: T, index: number, obj: T[]) => unknown): T;

declare function isEmpty<T>(value?: T | undefined | null): value is undefined | null;
declare function isError(err?: unknown): Error | undefined;
declare function isError(err: unknown, defaultValue: Error): Error;
declare function isFalse(value: boolean): boolean;

@@ -146,0 +146,0 @@ /**

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

function n(n,r){if(!Array.isArray(n)&&null==n)throw new Error(`Invalid Index: ${r}/ ${n}`);if(!Array.isArray(n))return n;if(n.length<=r)throw new Error(`Invalid Index: ${r}/ ${n.length}`);const t=n[r];if(null==t)throw new Error(`Invalid Index: ${r}/ ${n.length}`);return t}function r(n,r){if(!Array.isArray(n)&&null==n)return;if(!Array.isArray(n))return n;if(n.length<=r)return;const t=n[r];return null!=t?t:void 0}function t(n,r){return Array.from({length:Math.ceil(n.length/r)},((t,e)=>n.slice(e*r,e*r+r)))}function e(n,r){const t=n.find(r);if(null==t)throw new Error("findOrThrow got undefined result");return t}function u(n){return Array.isArray(n)?function(n){const[r]=n;return r}(n):n}function o(n,r){return Math.random()*(r-n)+n}function i(n,r){const t=Math.ceil(n),e=Math.floor(r);return Math.floor(Math.random()*(e-t))+n}function f(n){return!n}function c(n){return null==n||(!("number"!=typeof n||!Number.isNaN(n))||("string"==typeof n&&""===n||(!!("object"==typeof n&&Array.isArray(n)&&n.length<1)||"object"==typeof n&&!(n instanceof Date)&&Object.keys(n).length<1)))}function l(n){return null===n}function a(n){return void 0===n}function s(n){return a(n)||l(n)}function y(n){return n instanceof Error||null!=n&&"object"==typeof n&&"message"in n&&"stack"in n?n:void 0}function h(n){return!n}function A(n){return!c(n)}function d(n){return!l(n)}function g(n){return!a(n)}function w(n){return g(n)&&d(n)}function m(n){return n}function b(n){return n[n.length-1]}function p(n,r){const t=null==r?0:1;return new Array(n).fill(0).map(((n,r)=>r+t))}function v(n){return Array.from(new Set(n))}async function I(n=1e3){return new Promise((r=>{setTimeout((()=>r(void 0)),n)}))}function M(n){return Array.isArray(n)?n:[n]}function $(n){return Object.keys(n)}export{n as atOrThrow,r as atOrUndefined,t as chunk,e as findOrThrow,u as first,o as getRandomRange,i as getRandomRangeInt,f as invert,c as isComplexEmpty,s as isEmpty,y as isError,h as isFalse,A as isNotComplexEmpty,w as isNotEmpty,d as isNotNull,g as isNotUndefined,l as isNull,m as isTrue,a as isUndefined,b as last,p as populate,v as settify,I as sleep,M as toArray,$ as typedkey};
function n(n,r){if(!Array.isArray(n)&&null==n)throw new Error(`Invalid Index: ${r}/ ${n}`);if(!Array.isArray(n))return n;if(n.length<=r)throw new Error(`Invalid Index: ${r}/ ${n.length}`);const t=n[r];if(null==t)throw new Error(`Invalid Index: ${r}/ ${n.length}`);return t}function r(n,r){if(!Array.isArray(n)&&null==n)return;if(!Array.isArray(n))return n;if(n.length<=r)return;const t=n[r];return null!=t?t:void 0}function t(n,r){return Array.from({length:Math.ceil(n.length/r)},((t,e)=>n.slice(e*r,e*r+r)))}function e(n,r){const t=n.find(r);if(null==t)throw new Error("findOrThrow got undefined result");return t}function u(n){return Array.isArray(n)?function(n){const[r]=n;return r}(n):n}function o(n,r){return Math.random()*(r-n)+n}function i(n,r){const t=Math.ceil(n),e=Math.floor(r);return Math.floor(Math.random()*(e-t))+n}function f(n){return!n}function c(n){return null==n||(!("number"!=typeof n||!Number.isNaN(n))||("string"==typeof n&&""===n||(!!("object"==typeof n&&Array.isArray(n)&&n.length<1)||"object"==typeof n&&!(n instanceof Date)&&Object.keys(n).length<1)))}function l(n){return null===n}function a(n){return void 0===n}function s(n){return a(n)||l(n)}function y(n,r){return n instanceof Error||null!=n&&"object"==typeof n&&"message"in n&&"stack"in n?n:null!=r?r:void 0}function h(n){return!n}function A(n){return!c(n)}function d(n){return!l(n)}function g(n){return!a(n)}function w(n){return g(n)&&d(n)}function m(n){return n}function b(n){return n[n.length-1]}function p(n,r){const t=null==r?0:1;return new Array(n).fill(0).map(((n,r)=>r+t))}function v(n){return Array.from(new Set(n))}async function I(n=1e3){return new Promise((r=>{setTimeout((()=>r(void 0)),n)}))}function M(n){return Array.isArray(n)?n:[n]}function $(n){return Object.keys(n)}export{n as atOrThrow,r as atOrUndefined,t as chunk,e as findOrThrow,u as first,o as getRandomRange,i as getRandomRangeInt,f as invert,c as isComplexEmpty,s as isEmpty,y as isError,h as isFalse,A as isNotComplexEmpty,w as isNotEmpty,d as isNotNull,g as isNotUndefined,l as isNull,m as isTrue,a as isUndefined,b as last,p as populate,v as settify,I as sleep,M as toArray,$ as typedkey};
//# sourceMappingURL=index.js.map
{
"name": "my-easy-fp",
"version": "0.18.2",
"version": "0.19.0",
"description": "Simple functional programming utility & Misc programming tool",

@@ -61,3 +61,3 @@ "scripts": {

"rollup": "^3.7.5",
"rollup-plugin-ts": "^3.0.2",
"rollup-plugin-ts": "^3.1.1",
"ts-jest": "^29.0.3",

@@ -64,0 +64,0 @@ "ts-node": "^10.9.1",

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc