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

helper-fns

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

helper-fns - npm Package Compare versions

Comparing version 2.5.25 to 2.5.26

5

dist/index.d.ts

@@ -72,3 +72,3 @@ declare const assert: (condition: boolean, message: string) => asserts condition;

declare const normalizeEmail: (email: string) => string;
declare const slugify: (str: string, options: ISlugifyOptions) => string;
declare const slugify: (str: string, options?: ISlugifyOptions) => string;
declare const clearUndefined: <T extends Record<string, any>>(obj: T) => T;

@@ -79,3 +79,2 @@ declare const slash: (str: string) => string;

declare const stringifyQueryParams: (params?: any) => string;
declare const generateRandomString: (length?: number) => string;
declare const template: (str: any, mix: Record<string, any>) => any;

@@ -96,2 +95,2 @@ declare function randomString(options: IRandomStringOptions): string;

export { assert, autoParseValues, capitalize, capitalizeEveryWord, clearUndefined, clone, common, composeAsync, debounce, decrypt, difference, drop, dropRight, dropWhile, encrypt, ensurePrefix, enumToString, fixedDecimal, flattenDeep, formatDuration, generateRandomString, groupBy, intersection, invertObj, isBoolean, isDate, isDef, isEmpty, isFunction, isNotEmpty, isNumber, isObject, isSameDate, isString, lowerFirst, noop, normalizeEmail, objectArrayToArray, omit, orderBy, orderedToken, pick, pipe, pluck, randomHex, randomNumber, randomString, readFile, removeEmpty, renameKeys, resolverArgs, shuffle, slash, slugify, strAfter, strBefore, stringifyQueryParams, sumOfAnArray, template, throttle, timeTaken, toString, unescapeHTML, union, unique };
export { assert, autoParseValues, capitalize, capitalizeEveryWord, clearUndefined, clone, common, composeAsync, debounce, decrypt, difference, drop, dropRight, dropWhile, encrypt, ensurePrefix, enumToString, fixedDecimal, flattenDeep, formatDuration, groupBy, intersection, invertObj, isBoolean, isDate, isDef, isEmpty, isFunction, isNotEmpty, isNumber, isObject, isSameDate, isString, lowerFirst, noop, normalizeEmail, objectArrayToArray, omit, orderBy, orderedToken, pick, pipe, pluck, randomHex, randomNumber, randomString, readFile, removeEmpty, renameKeys, resolverArgs, shuffle, slash, slugify, strAfter, strBefore, stringifyQueryParams, sumOfAnArray, template, throttle, timeTaken, toString, unescapeHTML, union, unique };

2

dist/index.js

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

var d=(t,e)=>{if(!t)throw new Error(e)},u=t=>Object.prototype.toString.call(t),h=()=>{};import p from"crypto";import g from"fs";var f=/\./g,m=t=>[Object,Array].includes((t||{}).constructor)&&!Object.entries(t||{}).length,k=t=>Object.entries(t).reduce((e,[n,r])=>r===null?e:{...e,[n]:r},{}),O=(t,e)=>{let n={};return e.forEach(r=>{n[r]=t[r]}),n},S=(...t)=>JSON.stringify(t),A=(t,e=0)=>t.reduce((n,r)=>n+r,e),R=t=>[...new Set(t)],E=(t,e)=>{let n={...t};return e.forEach(r=>delete n[r]),n},M=(t,e,n)=>{[...t].sort((r,o)=>e.reduce((s,i,l)=>{if(s===0){let[c,a]=n&&n[l]==="desc"?[o[i],r[i]]:[r[i],o[i]];s=c>a?1:c<a?-1:0}return s},0))},I=(...t)=>e=>t.reduce((n,r)=>r(n),e),N=(t,e)=>t.map(n=>n[e]),D=(t,e)=>{Object.keys(e).reduce((n,r)=>({...n,[t[r]||r]:e[r]}),{})},j=(t,e)=>t.map(n=>n[e]),K=(t,e=2)=>{let n=new RegExp(`^-?\\d+(?:.\\d{0,${e||-1}})?`);return parseFloat(t.toString().match(n)[0])},F=t=>!!JSON.parse(t)===JSON.parse(t)?JSON.parse(t.toLowerCase()):isNaN(Number(t))?t:parseFloat(t),C=t=>t.flat(1/0),x=(t,e)=>t.filter(n=>!e.includes(n)),L=(t,e)=>t.filter(n=>e.includes(n)),v=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"",P=t=>{let e;return function(){let n=this,r=arguments,o=function(){e=null,t.immediate||t.func.apply(n,r)},s=t.immediate&&!e;clearTimeout(e),e=setTimeout(o,t.wait),s&&t.func.apply(n,r)}},B=t=>{console.time("timeTaken");let e=t();return console.timeEnd("timeTaken"),e},z=t=>t.replace(/&amp;|&lt;|&gt;|&#39;|&quot;/g,e=>({"&amp;":"&","&lt;":"<","&gt;":">","&#39;":"'","&quot;":'"'})[e]||e),$=(t,e)=>{let n=null,r=null,o=void 0,s=()=>{t.apply(o,r),n=null};return function(){n||(r=arguments,n=setTimeout(s,e))}},J=t=>{t<0&&(t=-t);let e={day:Math.floor(t/864e5),hour:Math.floor(t/36e5)%24,minute:Math.floor(t/6e4)%60,second:Math.floor(t/1e3)%60,millisecond:Math.floor(t)%1e3};return Object.entries(e).filter(n=>n[1]!==0).map(([n,r])=>`${r} ${n}${r!==1?"s":""}`).join(", ")},U=t=>t.replace(/\b[a-z]/g,e=>e.toUpperCase()),q=t=>t?t.charAt(0).toLowerCase()+t.slice(1):"",V=(t,e,n=!0)=>n?Array.from([...t,...e]):Array.from(new Set([...t,...e])),W=t=>new Date(t)instanceof Date,_=(t,e=1)=>t.slice(0,-e),G=t=>{let e=Buffer.from(t.config.key,"hex"),n=Buffer.from(t.config.iv,"hex"),r=p.createCipheriv("aes-256-cbc",e,n),o=r.update(t.text,"utf8","base64");return o+=r.final("base64"),o},H=t=>Object.keys(t).map(e=>t[e]).filter(e=>typeof e=="string"),X=t=>{let e=Buffer.from(t.config.key,"hex"),n=Buffer.from(t.config.iv,"hex"),r=p.createDecipheriv("aes-256-cbc",e,n);return r.update(t.text,"base64","utf8")+r.final("utf8")},Y=t=>new Promise((e,n)=>{g.readFile(t,{encoding:"utf-8"},(r,o)=>{r?n(r):e(o)})}),y=(t=1,e=9)=>{let n=Math.ceil(Math.min(t,e)),r=Math.floor(Math.max(t,e));return Math.floor(n+Math.random()*(r-n+1))},Q=t=>[...Array(t)].map(()=>Math.floor(Math.random()*16).toString(16)).join(""),Z=(t,e="X")=>{for(;t.includes(e);)t=t.replace(e,String(y()));return t},tt=(t,e)=>t.split(e)[1],et=(t,e)=>t.split(e)[0],nt=t=>!m(t),rt=t=>{let e=new t.constructor;return Object.assign(e,t),e},ot=(t,e)=>t.reduce((n,r)=>(n[r[e]]||(n[r[e]]=[]),n[r[e]].push(r),n),{}),st=t=>{let e=t.length;for(;e>0;){let n=Math.floor(Math.random()*e--),r=t[e];t[e]=t[n],t[n]=r}return t},it=t=>{let[e,n]=t.split("@"),[r]=e.split("+");r=r.replace(f,"");let o=`${r.toLowerCase()}@${n.toLowerCase()}`;return Number(o),o},ct=(t,e)=>{e={lowercase:!0,separator:"-",trim:!0,...e};let n=t.toString().normalize("NFD").replace(/[\u0300-\u036F]/g,"");return e.lowercase&&n.toLowerCase(),e.trim&&n.trim(),n.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e.separator)},at=t=>(Object.keys(t).forEach(e=>t[e]===void 0?delete t[e]:{}),t),ut=t=>t.replace(/\\/g,"/"),pt=(t,e)=>e.startsWith(t)?e:t+e,lt=t=>{let e={};for(let n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e},gt=(t={})=>new URLSearchParams(t).toString(),ft=(t=6)=>Math.random().toString(20).slice(2,t+2),mt=(t,e)=>{let n=/{{(.*?)}}/g;return t.replace(n,(r,o,s)=>{for(r=0,s=e,o=o.trim().split(".");s&&r<o.length;)s=s[o[r++]];return s??""})};function xt(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n="0123456789",r="!@#$%^&*_-+=",o=e;t.numbers&&(o+=n),t.symbols&&(o+=r);let s="";for(let i=0;i<t.length;i++)s+=o.charAt(Math.floor(Math.random()*o.length));return s}var yt=(...t)=>e=>t.reduceRight((n,r)=>n.then(r),Promise.resolve(e)),dt=(t,e)=>x(t,e),ht=(t,e)=>t.toISOString()===e.toISOString(),wt=(t,e)=>{for(;t.length>0&&!e(t[0]);)t=t.slice(1);return t},bt=(t,e=1)=>t.slice(e);var Ot=t=>typeof t<"u",St=t=>typeof t=="boolean",At=t=>typeof t=="function",Rt=t=>typeof t=="number",Et=t=>typeof t=="string",Mt=t=>u(t)==="[object Object]";export{d as assert,F as autoParseValues,v as capitalize,U as capitalizeEveryWord,at as clearUndefined,rt as clone,L as common,yt as composeAsync,P as debounce,X as decrypt,x as difference,bt as drop,_ as dropRight,wt as dropWhile,G as encrypt,pt as ensurePrefix,H as enumToString,K as fixedDecimal,C as flattenDeep,J as formatDuration,ft as generateRandomString,ot as groupBy,dt as intersection,lt as invertObj,St as isBoolean,W as isDate,Ot as isDef,m as isEmpty,At as isFunction,nt as isNotEmpty,Rt as isNumber,Mt as isObject,ht as isSameDate,Et as isString,q as lowerFirst,h as noop,it as normalizeEmail,j as objectArrayToArray,E as omit,M as orderBy,Z as orderedToken,O as pick,I as pipe,N as pluck,Q as randomHex,y as randomNumber,xt as randomString,Y as readFile,k as removeEmpty,D as renameKeys,S as resolverArgs,st as shuffle,ut as slash,ct as slugify,tt as strAfter,et as strBefore,gt as stringifyQueryParams,A as sumOfAnArray,mt as template,$ as throttle,B as timeTaken,u as toString,z as unescapeHTML,V as union,R as unique};
var y=Object.defineProperty,d=Object.defineProperties;var h=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var f=(t,e,n)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,c=(t,e)=>{for(var n in e||(e={}))w.call(e,n)&&f(t,n,e[n]);if(l)for(var n of l(e))b.call(e,n)&&f(t,n,e[n]);return t},a=(t,e)=>d(t,h(e));var R=(t,e)=>{if(!t)throw new Error(e)},g=t=>Object.prototype.toString.call(t),M=()=>{};import m from"crypto";import T from"fs";var k=/\./g,O=t=>[Object,Array].includes((t||{}).constructor)&&!Object.entries(t||{}).length,j=t=>Object.entries(t).reduce((e,[n,r])=>r===null?e:a(c({},e),{[n]:r}),{}),K=(t,e)=>{let n={};return e.forEach(r=>{n[r]=t[r]}),n},F=(...t)=>JSON.stringify(t),C=(t,e=0)=>t.reduce((n,r)=>n+r,e),L=t=>[...new Set(t)],v=(t,e)=>{let n=c({},t);return e.forEach(r=>delete n[r]),n},P=(t,e,n)=>{[...t].sort((r,o)=>e.reduce((s,i,x)=>{if(s===0){let[u,p]=n&&n[x]==="desc"?[o[i],r[i]]:[r[i],o[i]];s=u>p?1:u<p?-1:0}return s},0))},B=(...t)=>e=>t.reduce((n,r)=>r(n),e),z=(t,e)=>t.map(n=>n[e]),$=(t,e)=>{Object.keys(e).reduce((n,r)=>a(c({},n),{[t[r]||r]:e[r]}),{})},J=(t,e)=>t.map(n=>n[e]),U=(t,e=2)=>{let n=new RegExp(`^-?\\d+(?:.\\d{0,${e||-1}})?`);return parseFloat(t.toString().match(n)[0])},q=t=>!!JSON.parse(t)===JSON.parse(t)?JSON.parse(t.toLowerCase()):isNaN(Number(t))?t:parseFloat(t),V=t=>t.flat(1/0),S=(t,e)=>t.filter(n=>!e.includes(n)),W=(t,e)=>t.filter(n=>e.includes(n)),_=t=>t?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():"",G=t=>{let e;return function(){let n=this,r=arguments,o=function(){e=null,t.immediate||t.func.apply(n,r)},s=t.immediate&&!e;clearTimeout(e),e=setTimeout(o,t.wait),s&&t.func.apply(n,r)}},H=t=>{console.time("timeTaken");let e=t();return console.timeEnd("timeTaken"),e},X=t=>t.replace(/&amp;|&lt;|&gt;|&#39;|&quot;/g,e=>({"&amp;":"&","&lt;":"<","&gt;":">","&#39;":"'","&quot;":'"'})[e]||e),Y=(t,e)=>{let n=null,r=null,o=void 0,s=()=>{t.apply(o,r),n=null};return function(){n||(r=arguments,n=setTimeout(s,e))}},Q=t=>{t<0&&(t=-t);let e={day:Math.floor(t/864e5),hour:Math.floor(t/36e5)%24,minute:Math.floor(t/6e4)%60,second:Math.floor(t/1e3)%60,millisecond:Math.floor(t)%1e3};return Object.entries(e).filter(n=>n[1]!==0).map(([n,r])=>`${r} ${n}${r!==1?"s":""}`).join(", ")},Z=t=>t.replace(/\b[a-z]/g,e=>e.toUpperCase()),tt=t=>t?t.charAt(0).toLowerCase()+t.slice(1):"",et=(t,e,n=!0)=>n?Array.from([...t,...e]):Array.from(new Set([...t,...e])),nt=t=>new Date(t)instanceof Date,rt=(t,e=1)=>t.slice(0,-e),ot=t=>{let e=Buffer.from(t.config.key,"hex"),n=Buffer.from(t.config.iv,"hex"),r=m.createCipheriv("aes-256-cbc",e,n),o=r.update(t.text,"utf8","base64");return o+=r.final("base64"),o},st=t=>Object.keys(t).map(e=>t[e]).filter(e=>typeof e=="string"),it=t=>{let e=Buffer.from(t.config.key,"hex"),n=Buffer.from(t.config.iv,"hex"),r=m.createDecipheriv("aes-256-cbc",e,n);return r.update(t.text,"base64","utf8")+r.final("utf8")},ct=t=>new Promise((e,n)=>{T.readFile(t,{encoding:"utf-8"},(r,o)=>{r?n(r):e(o)})}),A=(t=1,e=9)=>{let n=Math.ceil(Math.min(t,e)),r=Math.floor(Math.max(t,e));return Math.floor(n+Math.random()*(r-n+1))},at=t=>[...Array(t)].map(()=>Math.floor(Math.random()*16).toString(16)).join(""),ut=(t,e="X")=>{for(;t.includes(e);)t=t.replace(e,String(A()));return t},pt=(t,e)=>t.split(e)[1],lt=(t,e)=>t.split(e)[0],ft=t=>!O(t),gt=t=>{let e=new t.constructor;return Object.assign(e,t),e},mt=(t,e)=>t.reduce((n,r)=>(n[r[e]]||(n[r[e]]=[]),n[r[e]].push(r),n),{}),xt=t=>{let e=t.length;for(;e>0;){let n=Math.floor(Math.random()*e--),r=t[e];t[e]=t[n],t[n]=r}return t},yt=t=>{let[e,n]=t.split("@"),[r]=e.split("+");r=r.replace(k,"");let o=`${r.toLowerCase()}@${n.toLowerCase()}`;return Number(o),o},dt=(t,e)=>{e=c({lowercase:!0,separator:"-",trim:!0},e);let n=t.toString().normalize("NFD").replace(/[\u0300-\u036F]/g,"");return e.lowercase&&n.toLowerCase(),e.trim&&n.trim(),n.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,e.separator)},ht=t=>(Object.keys(t).forEach(e=>t[e]===void 0?delete t[e]:{}),t),wt=t=>t.replace(/\\/g,"/"),bt=(t,e)=>e.startsWith(t)?e:t+e,Tt=t=>{let e={};for(let n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e},kt=(t={})=>new URLSearchParams(t).toString(),Ot=(t,e)=>{let n=/{{(.*?)}}/g;return t.replace(n,(r,o,s)=>{for(r=0,s=e,o=o.trim().split(".");s&&r<o.length;)s=s[o[r++]];return s!=null?s:""})};function St(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n="0123456789",r="!@#$%^&*_-+=",o=e;t.numbers&&(o+=n),t.symbols&&(o+=r);let s="";for(let i=0;i<t.length;i++)s+=o.charAt(Math.floor(Math.random()*o.length));return s}var At=(...t)=>e=>t.reduceRight((n,r)=>n.then(r),Promise.resolve(e)),Et=(t,e)=>S(t,e),Rt=(t,e)=>t.toISOString()===e.toISOString(),Mt=(t,e)=>{for(;t.length>0&&!e(t[0]);)t=t.slice(1);return t},It=(t,e=1)=>t.slice(e);var Kt=t=>typeof t!="undefined",Ft=t=>typeof t=="boolean",Ct=t=>typeof t=="function",Lt=t=>typeof t=="number",vt=t=>typeof t=="string",Pt=t=>g(t)==="[object Object]";export{R as assert,q as autoParseValues,_ as capitalize,Z as capitalizeEveryWord,ht as clearUndefined,gt as clone,W as common,At as composeAsync,G as debounce,it as decrypt,S as difference,It as drop,rt as dropRight,Mt as dropWhile,ot as encrypt,bt as ensurePrefix,st as enumToString,U as fixedDecimal,V as flattenDeep,Q as formatDuration,mt as groupBy,Et as intersection,Tt as invertObj,Ft as isBoolean,nt as isDate,Kt as isDef,O as isEmpty,Ct as isFunction,ft as isNotEmpty,Lt as isNumber,Pt as isObject,Rt as isSameDate,vt as isString,tt as lowerFirst,M as noop,yt as normalizeEmail,J as objectArrayToArray,v as omit,P as orderBy,ut as orderedToken,K as pick,B as pipe,z as pluck,at as randomHex,A as randomNumber,St as randomString,ct as readFile,j as removeEmpty,$ as renameKeys,F as resolverArgs,xt as shuffle,wt as slash,dt as slugify,pt as strAfter,lt as strBefore,kt as stringifyQueryParams,C as sumOfAnArray,Ot as template,Y as throttle,H as timeTaken,g as toString,X as unescapeHTML,et as union,L as unique};
{
"name": "helper-fns",
"type": "module",
"version": "2.5.25",
"version": "2.5.26",
"packageManager": "pnpm@7.2.1",

@@ -6,0 +6,0 @@ "description": "Some common utilities functions for everyday backend usage with zero dependencies",

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