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

@sayari/toolkit

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sayari/toolkit - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.parcel-cache/1ba6b0788801943b

25

dist/index.d.ts

@@ -10,3 +10,7 @@ export type SetItem<S> = S extends Set<infer I> ? I : never;

export const toggleSetItem: <I>(set: Set<I>, subject: I) => Set<I>;
export const noop: () => void;
export const diffSets: <I>(previous: Set<I>, current: Set<I>) => {
removed: Set<I>;
added: Set<I>;
};
export const noop: (..._: unknown[]) => void;
export const neverEver: (never: never) => never;

@@ -16,3 +20,8 @@ export const shallowEquals: <T extends unknown[]>(a: T, b: T) => boolean;

export const parseIntOr: (str: string, defaultValue: number) => number;
export const spacer: (...strings: string[]) => string;
export const entries: <T extends object, K extends keyof T>(obj: T) => [K, T[K]][];
export const lengthOf: <T extends object>(obj: T) => number;
export type StringCase = 'camel' | 'pascal' | 'snake' | 'kebab' | 'sentence';
export type NumberPrecision = 'ORDER_OF_MAGNITUDE' | 'INTEGER' | 'TENTHS' | 'HUNDREDTHS';
export const NUMBER_PRECISION: Record<NumberPrecision, NumberPrecision>;
export const spacer: (xs: readonly any[]) => string;
export const capitalize: (str: string) => string;

@@ -22,6 +31,14 @@ export const toSnakeCase: (string: string) => string;

export const prettifyKebobCase: (string: string) => string;
export const toTitleCase: (string: string, type: 'camel' | 'pascal' | 'snake' | 'kebab' | 'sentence') => string;
export const toTitleCase: (string: string, type: StringCase) => string;
export const pluralize: (text: string, count?: number) => string;
export const toVerboseDate: (string: string) => string;
export const formatNumber: (num: number, precision: 'ORDER_OF_MAGNITUDE' | 'INTEGER' | 'TENTHS' | 'HUNDREDTHS') => string;
export const formatDate: (date: string, offByOne?: boolean) => string;
export const formatDateTime: (date?: string) => string;
export const cleanNumber: (str: string) => string;
export const formatNumber: (num: number, precision: NumberPrecision) => string;
export const elapsedTime: (date: string) => string;
export const percentFormat: (percentage: number, precision?: NumberPrecision) => string;
export const formatDateOfBirth: (year: string, month: string, day: string) => string;
export const formatCurrency: (value: number, currency?: string) => string;
//# sourceMappingURL=index.d.ts.map

299

dist/index.js

@@ -0,15 +1,18 @@

import {join as $hgUW1$join, endsWith as $hgUW1$endsWith, nth as $hgUW1$nth, dropLast as $hgUW1$dropLast, any as $hgUW1$any} from "ramda";
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
var $673df0a4c41caf76$exports = {};
var $d22891ddd7b3e9bf$exports = {};
$parcel$export($673df0a4c41caf76$exports, "copySet", () => $673df0a4c41caf76$export$5b9949278a0db558);
$parcel$export($673df0a4c41caf76$exports, "filterSet", () => $673df0a4c41caf76$export$112b6c7b45dc12e6);
$parcel$export($673df0a4c41caf76$exports, "reduceSet", () => $673df0a4c41caf76$export$28ba15588aeedc93);
$parcel$export($673df0a4c41caf76$exports, "mapSet", () => $673df0a4c41caf76$export$1cce47ed56b31503);
$parcel$export($673df0a4c41caf76$exports, "concatSet", () => $673df0a4c41caf76$export$3cf57ff8f45bac5b);
$parcel$export($673df0a4c41caf76$exports, "pushSet", () => $673df0a4c41caf76$export$f669f2c67d2126ef);
$parcel$export($673df0a4c41caf76$exports, "compareSets", () => $673df0a4c41caf76$export$4064e0b84ffc3f78);
$parcel$export($673df0a4c41caf76$exports, "toggleSetItem", () => $673df0a4c41caf76$export$d0a32a1a1883d38d);
const $673df0a4c41caf76$export$5b9949278a0db558 = (set)=>{
$parcel$export($d22891ddd7b3e9bf$exports, "copySet", () => $d22891ddd7b3e9bf$export$5b9949278a0db558);
$parcel$export($d22891ddd7b3e9bf$exports, "filterSet", () => $d22891ddd7b3e9bf$export$112b6c7b45dc12e6);
$parcel$export($d22891ddd7b3e9bf$exports, "reduceSet", () => $d22891ddd7b3e9bf$export$28ba15588aeedc93);
$parcel$export($d22891ddd7b3e9bf$exports, "mapSet", () => $d22891ddd7b3e9bf$export$1cce47ed56b31503);
$parcel$export($d22891ddd7b3e9bf$exports, "concatSet", () => $d22891ddd7b3e9bf$export$3cf57ff8f45bac5b);
$parcel$export($d22891ddd7b3e9bf$exports, "pushSet", () => $d22891ddd7b3e9bf$export$f669f2c67d2126ef);
$parcel$export($d22891ddd7b3e9bf$exports, "compareSets", () => $d22891ddd7b3e9bf$export$4064e0b84ffc3f78);
$parcel$export($d22891ddd7b3e9bf$exports, "toggleSetItem", () => $d22891ddd7b3e9bf$export$d0a32a1a1883d38d);
$parcel$export($d22891ddd7b3e9bf$exports, "diffSets", () => $d22891ddd7b3e9bf$export$9b8d7c93f2b1f99e);
const $d22891ddd7b3e9bf$export$5b9949278a0db558 = (set)=>{
const newSet = new Set();

@@ -21,3 +24,3 @@ set.forEach((item)=>{

};
const $673df0a4c41caf76$export$112b6c7b45dc12e6 = (callback, set)=>{
const $d22891ddd7b3e9bf$export$112b6c7b45dc12e6 = (callback, set)=>{
const newSet = new Set();

@@ -29,3 +32,3 @@ set.forEach((item)=>{

};
const $673df0a4c41caf76$export$28ba15588aeedc93 = (callback, set, initial)=>{
const $d22891ddd7b3e9bf$export$28ba15588aeedc93 = (callback, set, initial)=>{
let accu = initial;

@@ -37,3 +40,3 @@ set.forEach((item)=>{

};
const $673df0a4c41caf76$export$1cce47ed56b31503 = (callback, set)=>{
const $d22891ddd7b3e9bf$export$1cce47ed56b31503 = (callback, set)=>{
const newSet = new Set();

@@ -45,3 +48,3 @@ set.forEach((item)=>{

};
const $673df0a4c41caf76$export$3cf57ff8f45bac5b = (a, b)=>{
const $d22891ddd7b3e9bf$export$3cf57ff8f45bac5b = (a, b)=>{
const newSet = new Set();

@@ -56,3 +59,3 @@ a.forEach((item)=>{

};
const $673df0a4c41caf76$export$f669f2c67d2126ef = (set, ...items)=>{
const $d22891ddd7b3e9bf$export$f669f2c67d2126ef = (set, ...items)=>{
const newSet = new Set();

@@ -67,3 +70,3 @@ set.forEach((item)=>{

};
const $673df0a4c41caf76$export$4064e0b84ffc3f78 = (a, b)=>{
const $d22891ddd7b3e9bf$export$4064e0b84ffc3f78 = (a, b)=>{
if (a.size !== b.size) return false;

@@ -75,3 +78,3 @@ for (const item of a){

};
const $673df0a4c41caf76$export$d0a32a1a1883d38d = (set, subject)=>{
const $d22891ddd7b3e9bf$export$d0a32a1a1883d38d = (set, subject)=>{
const newSet = new Set();

@@ -89,18 +92,32 @@ if (set.has(subject)) set.forEach((item)=>{

};
const $d22891ddd7b3e9bf$export$9b8d7c93f2b1f99e = (previous, current)=>{
const removed = new Set();
previous.forEach((item)=>{
if (!current.has(item)) removed.add(item);
});
const added = new Set();
current.forEach((item)=>{
if (!previous.has(item)) added.add(item);
});
return {
removed: removed,
added: added
};
};
var $c20fc822c5dba76c$exports = {};
var $ee723407fc634988$exports = {};
$parcel$export($c20fc822c5dba76c$exports, "noop", () => $c20fc822c5dba76c$export$8793edee2d425525);
$parcel$export($c20fc822c5dba76c$exports, "neverEver", () => $c20fc822c5dba76c$export$abd73f9fca476ab2);
$parcel$export($c20fc822c5dba76c$exports, "shallowEquals", () => $c20fc822c5dba76c$export$fa1c2bbf4100b8bc);
$parcel$export($c20fc822c5dba76c$exports, "boundNumber", () => $c20fc822c5dba76c$export$7f96be4eb326f60f);
$parcel$export($c20fc822c5dba76c$exports, "parseIntOr", () => $c20fc822c5dba76c$export$93685871ce2769b1);
$parcel$export($c20fc822c5dba76c$exports, "spacer", () => $c20fc822c5dba76c$export$8cc075c801fd6817);
const $c20fc822c5dba76c$export$8793edee2d425525 = ()=>{
$parcel$export($ee723407fc634988$exports, "noop", () => $ee723407fc634988$export$8793edee2d425525);
$parcel$export($ee723407fc634988$exports, "neverEver", () => $ee723407fc634988$export$abd73f9fca476ab2);
$parcel$export($ee723407fc634988$exports, "shallowEquals", () => $ee723407fc634988$export$fa1c2bbf4100b8bc);
$parcel$export($ee723407fc634988$exports, "boundNumber", () => $ee723407fc634988$export$7f96be4eb326f60f);
$parcel$export($ee723407fc634988$exports, "parseIntOr", () => $ee723407fc634988$export$93685871ce2769b1);
$parcel$export($ee723407fc634988$exports, "entries", () => $ee723407fc634988$export$3e9f948b41964866);
$parcel$export($ee723407fc634988$exports, "lengthOf", () => $ee723407fc634988$export$db8278eef58dd758);
const $ee723407fc634988$export$8793edee2d425525 = (..._)=>{
return;
};
const $c20fc822c5dba76c$export$abd73f9fca476ab2 = (never)=>never
;
const $c20fc822c5dba76c$export$fa1c2bbf4100b8bc = (a, b)=>{
const $ee723407fc634988$export$abd73f9fca476ab2 = (never)=>never;
const $ee723407fc634988$export$fa1c2bbf4100b8bc = (a, b)=>{
if (a === b) return true;

@@ -113,61 +130,93 @@ else if (a.length !== b.length) return false;

};
const $c20fc822c5dba76c$export$7f96be4eb326f60f = (lower, upper, number)=>{
const $ee723407fc634988$export$7f96be4eb326f60f = (lower, upper, number)=>{
return Math.max(Math.min(number, upper), lower);
};
const $c20fc822c5dba76c$export$93685871ce2769b1 = (str, defaultValue)=>{
const $ee723407fc634988$export$93685871ce2769b1 = (str, defaultValue)=>{
const int = parseInt(str, 10);
return isNaN(int) ? defaultValue : int;
};
const $c20fc822c5dba76c$export$8cc075c801fd6817 = (...strings)=>strings.join(' ')
;
const $ee723407fc634988$export$3e9f948b41964866 = (obj)=>Object.entries(obj);
const $ee723407fc634988$export$db8278eef58dd758 = (obj)=>Object.keys(obj).length;
var $246404e9692aaaef$exports = {};
var $6ecefecc474e620e$exports = {};
$parcel$export($246404e9692aaaef$exports, "capitalize", () => $246404e9692aaaef$export$9a00dee1beb8f576);
$parcel$export($246404e9692aaaef$exports, "toSnakeCase", () => $246404e9692aaaef$export$cc8b315fc368b20a);
$parcel$export($246404e9692aaaef$exports, "prettifySnakeCase", () => $246404e9692aaaef$export$448b8ade1ec5975e);
$parcel$export($246404e9692aaaef$exports, "prettifyKebobCase", () => $246404e9692aaaef$export$1821b95d63a5985b);
$parcel$export($246404e9692aaaef$exports, "toTitleCase", () => $246404e9692aaaef$export$f06f8b3003f18927);
$parcel$export($246404e9692aaaef$exports, "toVerboseDate", () => $246404e9692aaaef$export$de31d497921ecb1e);
$parcel$export($246404e9692aaaef$exports, "formatNumber", () => $246404e9692aaaef$export$f5dd818bff069720);
$parcel$export($6ecefecc474e620e$exports, "NUMBER_PRECISION", () => $6ecefecc474e620e$export$336713da367f794e);
$parcel$export($6ecefecc474e620e$exports, "spacer", () => $6ecefecc474e620e$export$8cc075c801fd6817);
$parcel$export($6ecefecc474e620e$exports, "capitalize", () => $6ecefecc474e620e$export$9a00dee1beb8f576);
$parcel$export($6ecefecc474e620e$exports, "toSnakeCase", () => $6ecefecc474e620e$export$cc8b315fc368b20a);
$parcel$export($6ecefecc474e620e$exports, "prettifySnakeCase", () => $6ecefecc474e620e$export$448b8ade1ec5975e);
$parcel$export($6ecefecc474e620e$exports, "prettifyKebobCase", () => $6ecefecc474e620e$export$1821b95d63a5985b);
$parcel$export($6ecefecc474e620e$exports, "toTitleCase", () => $6ecefecc474e620e$export$f06f8b3003f18927);
$parcel$export($6ecefecc474e620e$exports, "pluralize", () => $6ecefecc474e620e$export$cefb40c9962541b5);
$parcel$export($6ecefecc474e620e$exports, "toVerboseDate", () => $6ecefecc474e620e$export$de31d497921ecb1e);
$parcel$export($6ecefecc474e620e$exports, "formatDate", () => $6ecefecc474e620e$export$3ae94a2503e890a1);
$parcel$export($6ecefecc474e620e$exports, "formatDateTime", () => $6ecefecc474e620e$export$8b492ed8828f789c);
$parcel$export($6ecefecc474e620e$exports, "cleanNumber", () => $6ecefecc474e620e$export$69058ec9e4f904af);
$parcel$export($6ecefecc474e620e$exports, "formatNumber", () => $6ecefecc474e620e$export$f5dd818bff069720);
$parcel$export($6ecefecc474e620e$exports, "elapsedTime", () => $6ecefecc474e620e$export$1ea91570c695dfb2);
$parcel$export($6ecefecc474e620e$exports, "percentFormat", () => $6ecefecc474e620e$export$82fb8ba313c9dbb0);
$parcel$export($6ecefecc474e620e$exports, "formatDateOfBirth", () => $6ecefecc474e620e$export$db8f6c9690135465);
$parcel$export($6ecefecc474e620e$exports, "formatCurrency", () => $6ecefecc474e620e$export$3dc27271f5d5c629);
const $246404e9692aaaef$export$9a00dee1beb8f576 = (str)=>str.replace(/^./, (first)=>first.toUpperCase()
)
;
const $246404e9692aaaef$export$cc8b315fc368b20a = (string)=>string.toLowerCase().replace(/[\s|\/]/g, '_')
;
const $246404e9692aaaef$export$448b8ade1ec5975e = (string)=>$c20fc822c5dba76c$export$8cc075c801fd6817(...string.split('_').map($246404e9692aaaef$export$9a00dee1beb8f576))
;
const $246404e9692aaaef$export$1821b95d63a5985b = (string)=>$c20fc822c5dba76c$export$8cc075c801fd6817(...string.split('-').map($246404e9692aaaef$export$9a00dee1beb8f576))
;
const $246404e9692aaaef$export$f06f8b3003f18927 = (string, type)=>{
const $6ecefecc474e620e$export$336713da367f794e = {
ORDER_OF_MAGNITUDE: "ORDER_OF_MAGNITUDE",
INTEGER: "INTEGER",
TENTHS: "TENTHS",
HUNDREDTHS: "HUNDREDTHS"
};
const $6ecefecc474e620e$export$8cc075c801fd6817 = (0, $hgUW1$join)(" ");
const $6ecefecc474e620e$export$9a00dee1beb8f576 = (str)=>str.replace(/^./, (first)=>first.toUpperCase());
const $6ecefecc474e620e$export$cc8b315fc368b20a = (string)=>string.toLowerCase().replace(/[\s|\/]/g, "_");
const $6ecefecc474e620e$export$448b8ade1ec5975e = (string)=>$6ecefecc474e620e$export$8cc075c801fd6817(string.split("_").map($6ecefecc474e620e$export$9a00dee1beb8f576));
const $6ecefecc474e620e$export$1821b95d63a5985b = (string)=>$6ecefecc474e620e$export$8cc075c801fd6817(string.split("-").map($6ecefecc474e620e$export$9a00dee1beb8f576));
const $6ecefecc474e620e$export$f06f8b3003f18927 = (string, type)=>{
switch(type){
case 'snake':
return $c20fc822c5dba76c$export$8cc075c801fd6817(...string.split('_').map($246404e9692aaaef$export$9a00dee1beb8f576));
case 'kebab':
return $c20fc822c5dba76c$export$8cc075c801fd6817(...string.split('-').map($246404e9692aaaef$export$9a00dee1beb8f576));
case 'pascal':
return string.replace(/([A-Z])/g, ' $1').trim();
case 'camel':
return $246404e9692aaaef$export$9a00dee1beb8f576(string.replace(/([A-Z])/g, ' $1'));
case 'sentence':
return $c20fc822c5dba76c$export$8cc075c801fd6817(...string.toLowerCase().split(' ').map($246404e9692aaaef$export$9a00dee1beb8f576));
case "snake":
return $6ecefecc474e620e$export$8cc075c801fd6817(string.split("_").map($6ecefecc474e620e$export$9a00dee1beb8f576));
case "kebab":
return $6ecefecc474e620e$export$8cc075c801fd6817(string.split("-").map($6ecefecc474e620e$export$9a00dee1beb8f576));
case "pascal":
return string.replace(/([A-Z])/g, " $1").trim();
case "camel":
return $6ecefecc474e620e$export$9a00dee1beb8f576(string.replace(/([A-Z])/g, " $1"));
case "sentence":
return $6ecefecc474e620e$export$8cc075c801fd6817(string.toLowerCase().split(" ").map($6ecefecc474e620e$export$9a00dee1beb8f576));
}
};
const $246404e9692aaaef$export$de31d497921ecb1e = (string)=>{
const $6ecefecc474e620e$var$vowels = new Set([
"a",
"e",
"i",
"o",
"u"
]);
const $6ecefecc474e620e$export$cefb40c9962541b5 = (text, count = Infinity)=>{
if (count === 1) return text;
else if ((0, $hgUW1$endsWith)("y", text) && !$6ecefecc474e620e$var$vowels.has((0, $hgUW1$nth)(-2, text))) return (0, $hgUW1$dropLast)(1, text).concat("ies");
else if ((0, $hgUW1$any)((suffix)=>(0, $hgUW1$endsWith)(suffix, text), [
"s",
"ss",
"sh",
"ch",
"x",
"z"
])) return text.concat("es");
else return text.concat("s");
};
const $6ecefecc474e620e$export$de31d497921ecb1e = (string)=>{
const date = new Date(`${string}T00:00`);
switch(string.split('-').length){
switch(string.split("-").length){
case 1:
return String(date.getFullYear());
case 2:
return String(date.toLocaleString('default', {
month: 'long',
year: 'numeric'
return String(date.toLocaleString("default", {
month: "long",
year: "numeric"
}));
case 3:
return String(date.toLocaleString('default', {
month: 'long',
year: 'numeric',
day: 'numeric'
return String(date.toLocaleString("default", {
month: "long",
year: "numeric",
day: "numeric"
}));

@@ -178,24 +227,96 @@ default:

};
const $246404e9692aaaef$export$f5dd818bff069720 = (num, precision)=>{
let str = num.toString();
if (precision === 'ORDER_OF_MAGNITUDE') {
if (num > 1000000) str = `${(num / 1000000).toFixed(1)}`;
else if (num > 1000) str = `${(num / 1000).toFixed(1)}`;
return str.replace(/(^-?\d+\.\d*[1-9])(0+$)|(\.0+$)/, '$1') // remove trailing 0s
.replace(/\B(?=(\d{3})+(?!\d))/g, ',') // and add commas when appropriate
.concat(num > 1000000 ? 'M' : num > 1000 ? 'K' : '');
} else if (precision === 'INTEGER') {
if (num < 1) str = '< 1';
else str = num.toFixed(0);
} else if (precision === 'TENTHS') {
if (num * 10 < 1) str = '< 0.1';
else str = num.toFixed(1);
} else if (precision === 'HUNDREDTHS') {
if (num * 100 < 1) str = '< 0.01';
else str = num.toFixed(2);
const $6ecefecc474e620e$export$3ae94a2503e890a1 = (date, offByOne)=>{
if (!date) return "";
try {
const dt = new Date(offByOne ? `${date}T00:00` : date);
const year = dt.getFullYear();
const month = `${dt.getMonth() + 1}`.padStart(2, "0");
const day = `${dt.getDate()}`.padStart(2, "0");
return `${year}-${month}-${day}`;
} catch (error) {
// eslint-disable-next-line no-console
console.error("Date format error :", error);
return "";
}
return str.replace(/(^-?\d+\.\d*[1-9])(0+$)|(\.0+$)/, '$1') // remove trailing 0s
.replace(/\B(?=(\d{3})+(?!\d))/g, ',') // and add commas when appropriate
};
const $6ecefecc474e620e$var$isToday = (dt)=>{
const today = new Date();
return dt.getDate() === today.getDate() && dt.getMonth() === today.getMonth() && dt.getFullYear() === today.getFullYear();
};
const $6ecefecc474e620e$export$8b492ed8828f789c = (date)=>{
if (date === undefined) return "";
try {
const dt = new Date(date ?? "");
const year = dt.getFullYear();
const month = `${dt.getMonth() + 1}`.padStart(2, "0");
const day = `${dt.getDate()}`.padStart(2, "0");
const hour = `${dt.getHours() % 12 || 12}`;
const min = `${dt.getMinutes()}`.padStart(2, "0");
const mid = dt.getHours() >= 12 ? "PM" : "AM";
const dateString = `${year}-${month}-${day}`;
const time = `${hour}:${min} ${mid}`;
return $6ecefecc474e620e$var$isToday(dt) ? `Today at ${time}` : `${dateString} at ${time}`;
} catch (error) {
// eslint-disable-next-line no-console
console.error("Date format error :", error);
return "";
}
};
const $6ecefecc474e620e$export$69058ec9e4f904af = (str)=>{
return str.replace(/(^-?\d+\.\d*[1-9])(0+$)|(\.0+$)/, "$1") // remove trailing 0s
.replace(/\B(?=(\d{3})+(?!\d))/g, ",") // and add commas when appropriate
;
};
const $6ecefecc474e620e$export$f5dd818bff069720 = (num, precision)=>{
const str = num.toString();
switch(precision){
case "ORDER_OF_MAGNITUDE":
if (num > 1000000) return `${$6ecefecc474e620e$export$69058ec9e4f904af(`${(num / 1000000).toFixed(1)}`)}M`;
else if (num > 1000) return `${$6ecefecc474e620e$export$69058ec9e4f904af(`${(num / 1000).toFixed(1)}`)}K`;
else return $6ecefecc474e620e$export$69058ec9e4f904af(str);
case "INTEGER":
return $6ecefecc474e620e$export$69058ec9e4f904af(num < 1 ? "< 1" : num.toFixed(0));
case "TENTHS":
return $6ecefecc474e620e$export$69058ec9e4f904af(num * 10 < 1 ? "< 0.1" : num.toFixed(1));
case "HUNDREDTHS":
return $6ecefecc474e620e$export$69058ec9e4f904af(num * 100 < 1 ? "< 0.01" : num.toFixed(2));
}
};
const $6ecefecc474e620e$export$1ea91570c695dfb2 = (date)=>{
const now = new Date();
const then = new Date(date);
const elapsed = now.getTime() - then.getTime();
const seconds = Math.floor(elapsed / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
if (seconds < 60) return `${seconds} ${$6ecefecc474e620e$export$cefb40c9962541b5("second", seconds)} ago`;
else if (minutes < 60) return `${minutes} ${$6ecefecc474e620e$export$cefb40c9962541b5("minute", minutes)} ago`;
else if (hours < 24) return `${hours} ${$6ecefecc474e620e$export$cefb40c9962541b5("hour", hours)} ago`;
else if (days < 30) return `${days} ${$6ecefecc474e620e$export$cefb40c9962541b5("day", days)} ago`;
else return $6ecefecc474e620e$export$3ae94a2503e890a1(date);
};
const $6ecefecc474e620e$export$82fb8ba313c9dbb0 = (percentage, precision = $6ecefecc474e620e$export$336713da367f794e.HUNDREDTHS)=>`${$6ecefecc474e620e$export$f5dd818bff069720(percentage, precision)}%`;
const $6ecefecc474e620e$export$db8f6c9690135465 = (year, month, day)=>{
return [
year,
month ? `0${month}`.slice(-2) : month,
day ? `0${day}`.slice(-2) : day
].filter((v)=>!!v).join("-");
};
const $6ecefecc474e620e$var$CURRENCY_LOOKUP = {
USD: "$",
CNY: "\xa5",
EUR: "€",
INR: "₹",
RUB: "₽",
VES: "Bs."
};
const $6ecefecc474e620e$export$3dc27271f5d5c629 = (value, currency)=>{
const amount = Math.abs(value).toLocaleString();
const prefix = value < 0 ? "-" : "";
if (currency === undefined) return `${prefix}${amount}`;
else if ($6ecefecc474e620e$var$CURRENCY_LOOKUP[currency]) return `${prefix}${$6ecefecc474e620e$var$CURRENCY_LOOKUP[currency]}${amount}`;
return `${prefix}${amount} ${currency}`;
};

@@ -205,3 +326,3 @@

export {$673df0a4c41caf76$export$5b9949278a0db558 as copySet, $673df0a4c41caf76$export$112b6c7b45dc12e6 as filterSet, $673df0a4c41caf76$export$28ba15588aeedc93 as reduceSet, $673df0a4c41caf76$export$1cce47ed56b31503 as mapSet, $673df0a4c41caf76$export$3cf57ff8f45bac5b as concatSet, $673df0a4c41caf76$export$f669f2c67d2126ef as pushSet, $673df0a4c41caf76$export$4064e0b84ffc3f78 as compareSets, $673df0a4c41caf76$export$d0a32a1a1883d38d as toggleSetItem, $c20fc822c5dba76c$export$8793edee2d425525 as noop, $c20fc822c5dba76c$export$abd73f9fca476ab2 as neverEver, $c20fc822c5dba76c$export$fa1c2bbf4100b8bc as shallowEquals, $c20fc822c5dba76c$export$7f96be4eb326f60f as boundNumber, $c20fc822c5dba76c$export$93685871ce2769b1 as parseIntOr, $c20fc822c5dba76c$export$8cc075c801fd6817 as spacer, $246404e9692aaaef$export$9a00dee1beb8f576 as capitalize, $246404e9692aaaef$export$cc8b315fc368b20a as toSnakeCase, $246404e9692aaaef$export$448b8ade1ec5975e as prettifySnakeCase, $246404e9692aaaef$export$1821b95d63a5985b as prettifyKebobCase, $246404e9692aaaef$export$f06f8b3003f18927 as toTitleCase, $246404e9692aaaef$export$de31d497921ecb1e as toVerboseDate, $246404e9692aaaef$export$f5dd818bff069720 as formatNumber};
export {$d22891ddd7b3e9bf$export$5b9949278a0db558 as copySet, $d22891ddd7b3e9bf$export$112b6c7b45dc12e6 as filterSet, $d22891ddd7b3e9bf$export$28ba15588aeedc93 as reduceSet, $d22891ddd7b3e9bf$export$1cce47ed56b31503 as mapSet, $d22891ddd7b3e9bf$export$3cf57ff8f45bac5b as concatSet, $d22891ddd7b3e9bf$export$f669f2c67d2126ef as pushSet, $d22891ddd7b3e9bf$export$4064e0b84ffc3f78 as compareSets, $d22891ddd7b3e9bf$export$d0a32a1a1883d38d as toggleSetItem, $d22891ddd7b3e9bf$export$9b8d7c93f2b1f99e as diffSets, $ee723407fc634988$export$8793edee2d425525 as noop, $ee723407fc634988$export$abd73f9fca476ab2 as neverEver, $ee723407fc634988$export$fa1c2bbf4100b8bc as shallowEquals, $ee723407fc634988$export$7f96be4eb326f60f as boundNumber, $ee723407fc634988$export$93685871ce2769b1 as parseIntOr, $ee723407fc634988$export$3e9f948b41964866 as entries, $ee723407fc634988$export$db8278eef58dd758 as lengthOf, $6ecefecc474e620e$export$336713da367f794e as NUMBER_PRECISION, $6ecefecc474e620e$export$8cc075c801fd6817 as spacer, $6ecefecc474e620e$export$9a00dee1beb8f576 as capitalize, $6ecefecc474e620e$export$cc8b315fc368b20a as toSnakeCase, $6ecefecc474e620e$export$448b8ade1ec5975e as prettifySnakeCase, $6ecefecc474e620e$export$1821b95d63a5985b as prettifyKebobCase, $6ecefecc474e620e$export$f06f8b3003f18927 as toTitleCase, $6ecefecc474e620e$export$cefb40c9962541b5 as pluralize, $6ecefecc474e620e$export$de31d497921ecb1e as toVerboseDate, $6ecefecc474e620e$export$3ae94a2503e890a1 as formatDate, $6ecefecc474e620e$export$8b492ed8828f789c as formatDateTime, $6ecefecc474e620e$export$69058ec9e4f904af as cleanNumber, $6ecefecc474e620e$export$f5dd818bff069720 as formatNumber, $6ecefecc474e620e$export$1ea91570c695dfb2 as elapsedTime, $6ecefecc474e620e$export$82fb8ba313c9dbb0 as percentFormat, $6ecefecc474e620e$export$db8f6c9690135465 as formatDateOfBirth, $6ecefecc474e620e$export$3dc27271f5d5c629 as formatCurrency};
//# sourceMappingURL=index.js.map
{
"name": "@sayari/toolkit",
"version": "0.0.1",
"version": "0.0.2",
"description": "a collection of utility functions for Sayari Graph",

@@ -10,3 +10,4 @@ "source": "src/index.ts",

"scripts": {
"test": "jest",
"test": "vitest run",
"test:watch": "vitest --reporter verbose",
"lint": "eslint \"src/**/**.{ts,tsx}\"",

@@ -29,15 +30,20 @@ "validate": "npm run lint && npm run test",

},
"peerDependencies": {
"ramda": "^0.29.0"
},
"devDependencies": {
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@parcel/packager-ts": "^2.9.3",
"@parcel/transformer-typescript-types": "^2.9.3",
"@types/ramda": "^0.29.3",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.5.1",
"parcel": "^2.4.1",
"prettier": "^2.6.2",
"ts-jest": "^27.1.4",
"typescript": "^4.6.3"
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"parcel": "^2.9.3",
"prettier": "^3.0.3",
"ramda": "^0.29.0",
"typescript": "^5.2.2",
"vitest": "^0.34.3"
}
}
}

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