New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

funclab

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

funclab - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

2

dist/index.esm.js

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

function r(r){return r.charAt(0).toUpperCase()+r.slice(1)}function e(r){return r.split("").reverse().join("")}function t(r){return("number"==typeof r||"string"==typeof r)&&(!(!r&&0!==r&&"0"!==r)&&(r=r.toString().trim(),!isNaN(r)&&isFinite(r)&&(r.match(/\./g)||[]).length<=1))}function n(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"YYYY-MM-DD HH:mm:ss",t=new Date(r);if(isNaN(t))throw new Error("Invalid date format. Please use a valid date string.");var n=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),l=String(t.getHours()%12||12).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0"),f=String(t.getMilliseconds()).padStart(3,"0"),s=t.getHours()>=12?"PM":"AM";return e.replace("YYYY",n).replace("MM",a).replace("DD",i).replace("HH",o).replace("hh",l).replace("mm",u).replace("ss",c).replace("SSS",f).replace("A",s)}function a(r,e){var t=new Date(n(r,"YYYY-MM-DD")),a=new Date(n(e,"YYYY-MM-DD"));if(isNaN(t)||isNaN(a))throw new Error("Invalid date format. Please use a valid date string.");return Math.abs(a-t)/864e5}function i(r,e){return Math.floor(Math.random()*(e-r+1))+r}function o(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=Number(r);return isNaN(t)?"Invalid number":t.toFixed(e)}function l(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function u(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=h(r))||e){t&&(r=t);var n=0,a=function(){};return{s:a,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,l=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return o=r.done,r},e:function(r){l=!0,i=r},f:function(){try{o||null==t.return||t.return()}finally{if(l)throw i}}}}function c(r,e,t){return(e=function(r){var e=function(r,e){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==typeof e?e:e+""}(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function f(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function s(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?f(Object(t),!0).forEach((function(e){c(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}function d(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,a,i,o,l=[],u=!0,c=!1;try{if(i=(t=t.call(r)).next,0===e);else for(;!(u=(n=i.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(r){c=!0,a=r}finally{try{if(!u&&null!=t.return&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw a}}return l}}(r,e)||h(r,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(r){return function(r){if(Array.isArray(r))return l(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||h(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(r){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},y(r)}function h(r,e){if(r){if("string"==typeof r)return l(r,e);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?l(r,e):void 0}}function v(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=r;if(!t(i))return"Invalid number";var o=Math.pow(10,e),l=d((Math.round(i*o)/o).toFixed(e).split("."),2),u=l[0],c=l[1],f=n?u.replace(/\B(?=(\d{3})+(?!\d))/g,","):u,s=a&&c?c.replace(/\B(?=(\d{3})+(?!\d))/g,","):c;return void 0!==s?"".concat(f,".").concat(s):f}function g(r){var e,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(null==r)return r;if(r instanceof Date)return new Date(r);if(r instanceof RegExp)return new RegExp(r);if(r instanceof Map){var n=new Map;return r.forEach((function(r,e){n.set(e,g(r,t))})),n}if(r instanceof Set){var a=new Set;return r.forEach((function(r){a.add(g(r,t))})),a}if("object"!==y(r))return r;if(t.has(r))return t.get(r);for(var i in e=Array.isArray(r)?[]:{},t.set(r,e),r)r.hasOwnProperty(i)&&(e[i]=g(r[i],t));return e}function b(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=s({childrenKeyMapping:{children:"children"},extraFields:["parentId","path","level"],extraFieldsMappings:{},nodeKey:"id"},arguments.length>2?arguments[2]:void 0),n=t.childrenKeyMapping,a=t.extraFields,i=t.extraFieldsMappings,o=t.nodeKey;if("object"!==y(r)||null===r)throw new TypeError("The 'tree' parameter should be an object or array representing the tree structure.");if("object"!==y(e)||null===e||Array.isArray(e))throw new TypeError("The 'fieldMappings' parameter should be an object mapping original field names to new field names.");if("object"!==y(n)||Array.isArray(n)||1!==Object.keys(n).length)throw new TypeError("The 'childrenKeyMapping' parameter should be an object with a single key-value pair for original and target child keys.");if(!Array.isArray(a)||!a.every((function(r){return"string"==typeof r})))throw new TypeError("The 'extraFields' parameter should be an array of strings representing extraFieldsal properties to add.");if("object"!==y(i)||Array.isArray(i))throw new TypeError("The 'extraFieldsMappings' parameter should be an object mapping extraFieldsal property names to new property names.");var l=d(Object.entries(n)[0],2),u=l[0],c=l[1],f=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,d=s({},g(r));if(null!=a&&a.includes("level")){var y=(null==i?void 0:i.level)||"level";d[y]=t}var h=[].concat(p(n),[d[o]]);if(null!=a&&a.includes("path")){var v=(null==i?void 0:i.path)||"path";d[v]=h}if(null!=a&&a.includes("parentId")){var b=(null==i?void 0:i.parentId)||"parentId";d[b]=l}return d[c]=Array.isArray(r[u])&&r[u].length?r[u].map((function(r){return f(r,t+1,h,d[o])})):[],u!==c&&delete d[u],d=Object.keys(e).reduce((function(t,n){return void 0!==r[n]&&(t[e[n]]=g(r[n]),delete t[n]),t}),d)};return(Array.isArray(r)?r:[r]).map((function(r){return f(r)}))}function m(r,e){function t(r,n){if(r.id===e)return[].concat(p(n),[e]);var a;if(null!==(a=r.children)&&void 0!==a&&a.length){var i,o=u(r.children);try{for(o.s();!(i=o.n()).done;){var l=t(i.value,[].concat(p(n),[r.id]));if(l)return l}}catch(r){o.e(r)}finally{o.f()}}return null}var n,a=u(r);try{for(a.s();!(n=a.n()).done;){var i=t(n.value,[]);if(i)return i}}catch(r){a.e(r)}finally{a.f()}return null}function w(r,e){function t(r,n){if(r.id===e)return[].concat(p(n),[r]);var a;if(null!==(a=r.children)&&void 0!==a&&a.length){var i,o=u(r.children);try{for(o.s();!(i=o.n()).done;){var l=t(i.value,[].concat(p(n),[r]));if(l)return l}}catch(r){o.e(r)}finally{o.f()}}return null}var n,a=u(r);try{for(a.s();!(n=a.n()).done;){var i=t(n.value,[]);if(i)return i}}catch(r){a.e(r)}finally{a.f()}return null}var S=function(r){for(var e=s(s({},{dash:!1,upperCase:!1,length:32}),r),t=e.dash,n=e.upperCase,a=e.length,i="",o=1;o<=a;o++)i+=Math.floor(16*Math.random()).toString(16),t&&[8,12,16,20].includes(o)&&(i+="-");return n?i.toUpperCase():i};export{r as capitalize,g as cloneDeep,a as daysBetweenDates,m as findParentIds,w as findParentNodes,v as formatCurrency,n as formatDate,b as formatTree,S as guid,t as isNumeric,i as randomInteger,e as reverseString,o as roundTo};
function e(e){return e.charAt(0).toUpperCase()+e.slice(1)}function r(e){return e.split("").reverse().join("")}function t(e){return("number"==typeof e||"string"==typeof e)&&(!(!e&&0!==e&&"0"!==e)&&(e=e.toString().trim(),!isNaN(e)&&isFinite(e)&&(e.match(/\./g)||[]).length<=1))}function n(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"YYYY-MM-DD HH:mm:ss";if(e){var t=new Date(e);if(isNaN(t))throw new Error("Invalid date format. Please use a valid date string.");var n=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),l=String(t.getHours()%12||12).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0"),f=String(t.getMilliseconds()).padStart(3,"0"),s=t.getHours()>=12?"PM":"AM";return r.replace("YYYY",n).replace("MM",a).replace("DD",o).replace("HH",i).replace("hh",l).replace("mm",u).replace("ss",c).replace("SSS",f).replace("A",s)}}function a(e,r){var t=new Date(n(e,"YYYY-MM-DD")),a=new Date(n(r,"YYYY-MM-DD"));if(isNaN(t)||isNaN(a))throw new Error("Invalid date format. Please use a valid date string.");return Math.abs(a-t)/864e5}function o(e,r){return Math.floor(Math.random()*(r-e+1))+e}function i(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=Number(e);return isNaN(t)?"Invalid number":t.toFixed(r)}function l(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function u(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=v(e))||r){t&&(e=t);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(l)throw o}}}}function c(e,r,t){return(r=function(e){var r=function(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function f(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?f(Object(t),!0).forEach((function(r){c(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function d(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,a,o,i,l=[],u=!0,c=!1;try{if(o=(t=t.call(e)).next,0===r);else for(;!(u=(n=o.call(t)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(c)throw a}}return l}}(e,r)||v(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function v(e,r){if(e){if("string"==typeof e)return l(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?l(e,r):void 0}}function h(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=e;if(!t(o))return"Invalid number";var i=Math.pow(10,r),l=d((Math.round(o*i)/i).toFixed(r).split("."),2),u=l[0],c=l[1],f=n?u.replace(/\B(?=(\d{3})+(?!\d))/g,","):u,s=a&&c?c.replace(/\B(?=(\d{3})+(?!\d))/g,","):c;return void 0!==s?"".concat(f,".").concat(s):f}function g(e){var r,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(null==e)return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(e instanceof Map){var n=new Map;return e.forEach((function(e,r){n.set(r,g(e,t))})),n}if(e instanceof Set){var a=new Set;return e.forEach((function(e){a.add(g(e,t))})),a}if("object"!==y(e))return e;if(t.has(e))return t.get(e);for(var o in r=Array.isArray(e)?[]:{},t.set(e,r),e)e.hasOwnProperty(o)&&(r[o]=g(e[o],t));return r}function b(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=s({childrenKeyMapping:{children:"children"},extraFields:["parentId","keyPath","nodePath","level"],extraFieldsMappings:{},nodeKey:"id"},arguments.length>2?arguments[2]:void 0),n=t.childrenKeyMapping,a=t.extraFields,o=t.extraFieldsMappings,i=t.nodeKey;if("object"!==y(e)||null===e)throw new TypeError("The 'tree' parameter should be an object or array representing the tree structure.");if("object"!==y(r)||null===r||Array.isArray(r))throw new TypeError("The 'fieldMappings' parameter should be an object mapping original field names to new field names.");if("object"!==y(n)||Array.isArray(n)||1!==Object.keys(n).length)throw new TypeError("The 'childrenKeyMapping' parameter should be an object with a single key-value pair for original and target child keys.");if(!Array.isArray(a)||!a.every((function(e){return"string"==typeof e})))throw new TypeError("The 'extraFields' parameter should be an array of strings representing extraFieldsal properties to add.");if("object"!==y(o)||Array.isArray(o))throw new TypeError("The 'extraFieldsMappings' parameter should be an object mapping extraFieldsal property names to new property names.");var l=d(Object.entries(n)[0],2),u=l[0],c=l[1],f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,d=s({},g(e));if(null!=a&&a.includes("level")){var y=(null==o?void 0:o.level)||"level";d[y]=t}var v=[].concat(p(n),[d]),h=[].concat(p(n.map((function(e){return e[i]}))),[d[i]]);if(null!=a&&a.includes("keyPath")){var b=(null==o?void 0:o.path)||"keyPath";d[b]=h}if(null!=a&&a.includes("nodePath")){var m=(null==o?void 0:o.path)||"nodePath";d[m]=g(v)}if(null!=a&&a.includes("parentId")){var w=(null==o?void 0:o.parentId)||"parentId";d[w]=l}return d[c]=Array.isArray(e[u])&&e[u].length?e[u].map((function(e){return f(e,t+1,v,d[i])})):[],u!==c&&delete d[u],d=Object.keys(r).reduce((function(t,n){return void 0!==e[n]&&(t[r[n]]=g(e[n]),delete t[n]),t}),d)};return(Array.isArray(e)?e:[e]).map((function(e){return f(e)}))}function m(e,r){function t(e,n){if(e.id===r)return[].concat(p(n),[r]);var a;if(null!==(a=e.children)&&void 0!==a&&a.length){var o,i=u(e.children);try{for(i.s();!(o=i.n()).done;){var l=t(o.value,[].concat(p(n),[e.id]));if(l)return l}}catch(e){i.e(e)}finally{i.f()}}return null}var n,a=u(e);try{for(a.s();!(n=a.n()).done;){var o=t(n.value,[]);if(o)return o}}catch(e){a.e(e)}finally{a.f()}return null}function w(e,r,t){var n=s({label:"label",value:"value"},t);function a(e,t){if(e[n.value]===r)return[].concat(p(t),[e]);var o;if(null!==(o=e.children)&&void 0!==o&&o.length){var i,l=u(e.children);try{for(l.s();!(i=l.n()).done;){var c=a(i.value,[].concat(p(t),[e]));if(c)return c}}catch(e){l.e(e)}finally{l.f()}}return null}var o,i=u(g(e));try{for(i.s();!(o=i.n()).done;){var l=a(o.value,[]);if(l)return l}}catch(e){i.e(e)}finally{i.f()}return null}var S=function(e){for(var r=s(s({},{dash:!1,upperCase:!1,length:32}),e),t=r.dash,n=r.upperCase,a=r.length,o="",i=1;i<=a;i++)o+=Math.floor(16*Math.random()).toString(16),t&&[8,12,16,20].includes(i)&&(o+="-");return n?o.toUpperCase():o};function j(e){e=JSON.stringify(e),navigator.clipboard?navigator.clipboard.writeText(e).then((function(){console.log("Text copied to clipboard")})).catch((function(e){console.error("Could not copy text: ",e)})):function(e){var r=document.createElement("textarea");r.value=e,r.style.top="0",r.style.left="0",r.style.position="fixed",document.body.appendChild(r),r.focus(),r.select();try{var t=document.execCommand("copy")?"successful":"unsuccessful";console.log("Fallback: Copying text command was "+t)}catch(e){console.error("Fallback: Oops, unable to copy",e)}document.body.removeChild(r)}(e)}export{e as capitalize,g as cloneDeep,j as copyTextToClipboard,a as daysBetweenDates,m as findParentIds,w as findParentNodes,h as formatCurrency,n as formatDate,b as formatTree,S as guid,t as isNumeric,o as randomInteger,r as reverseString,i as roundTo};
{
"name": "funclab",
"version": "0.0.15",
"version": "0.0.16",
"main": "dist/index.cjs",

@@ -5,0 +5,0 @@ "module": "dist/index.esm.js",

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