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

@vexip-ui/utils

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vexip-ui/utils - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

187

dist/index.d.ts

@@ -23,2 +23,4 @@ export declare function addDays(date: Dateable, amount: number): Date;

export declare type AnyCase<S> = string extends S ? string : S extends `${infer F1}${infer F2}${infer R}` ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${AnyCase<R>}` : S extends `${infer F}${infer R}` ? `${Uppercase<F> | Lowercase<F>}${AnyCase<R>}` : '';
export declare interface BITree {

@@ -45,2 +47,6 @@ add(index: number, num: number): void;

export declare const COLOR_NAMES: Readonly<Set<"aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "burntsienna" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen">>;
export declare type ColorName = keyof typeof NAMED_COLORS;
export declare interface ColorObject {

@@ -180,2 +186,4 @@ rgb: RGBColor;

export declare function escapeHtml(string: unknown): string;
export declare interface EventEmitter {

@@ -218,2 +226,9 @@ on: (type: EventType, handler: EventHandler) => void;

/**
* 根据传入的 Byte 数值,将其格式化成指定单位的大小
* @param byte - 需要计算的 Byte 数值
* @param unit - 格式化的单位
*/
export declare function formatByteSize(byte: number, unit?: SizeUnitWithAuto): number;
export declare function getChineseWeek(date: Date): string;

@@ -396,3 +411,153 @@

export declare const NAMES: Readonly<Record<string, string>>;
export declare const NAMED_COLORS: Readonly<{
aliceblue: string;
antiquewhite: string;
aqua: string;
aquamarine: string;
azure: string;
beige: string;
bisque: string;
black: string;
blanchedalmond: string;
blue: string;
blueviolet: string;
brown: string;
burlywood: string;
burntsienna: string;
cadetblue: string;
chartreuse: string;
chocolate: string;
coral: string;
cornflowerblue: string;
cornsilk: string;
crimson: string;
cyan: string;
darkblue: string;
darkcyan: string;
darkgoldenrod: string;
darkgray: string;
darkgreen: string;
darkgrey: string;
darkkhaki: string;
darkmagenta: string;
darkolivegreen: string;
darkorange: string;
darkorchid: string;
darkred: string;
darksalmon: string;
darkseagreen: string;
darkslateblue: string;
darkslategray: string;
darkslategrey: string;
darkturquoise: string;
darkviolet: string;
deeppink: string;
deepskyblue: string;
dimgray: string;
dimgrey: string;
dodgerblue: string;
firebrick: string;
floralwhite: string;
forestgreen: string;
fuchsia: string;
gainsboro: string;
ghostwhite: string;
gold: string;
goldenrod: string;
gray: string;
green: string;
greenyellow: string;
grey: string;
honeydew: string;
hotpink: string;
indianred: string;
indigo: string;
ivory: string;
khaki: string;
lavender: string;
lavenderblush: string;
lawngreen: string;
lemonchiffon: string;
lightblue: string;
lightcoral: string;
lightcyan: string;
lightgoldenrodyellow: string;
lightgray: string;
lightgreen: string;
lightgrey: string;
lightpink: string;
lightsalmon: string;
lightseagreen: string;
lightskyblue: string;
lightslategray: string;
lightslategrey: string;
lightsteelblue: string;
lightyellow: string;
lime: string;
limegreen: string;
linen: string;
magenta: string;
maroon: string;
mediumaquamarine: string;
mediumblue: string;
mediumorchid: string;
mediumpurple: string;
mediumseagreen: string;
mediumslateblue: string;
mediumspringgreen: string;
mediumturquoise: string;
mediumvioletred: string;
midnightblue: string;
mintcream: string;
mistyrose: string;
moccasin: string;
navajowhite: string;
navy: string;
oldlace: string;
olive: string;
olivedrab: string;
orange: string;
orangered: string;
orchid: string;
palegoldenrod: string;
palegreen: string;
paleturquoise: string;
palevioletred: string;
papayawhip: string;
peachpuff: string;
peru: string;
pink: string;
plum: string;
powderblue: string;
purple: string;
rebeccapurple: string;
red: string;
rosybrown: string;
royalblue: string;
saddlebrown: string;
salmon: string;
sandybrown: string;
seagreen: string;
seashell: string;
sienna: string;
silver: string;
skyblue: string;
slateblue: string;
slategray: string;
slategrey: string;
snow: string;
springgreen: string;
steelblue: string;
tan: string;
teal: string;
thistle: string;
tomato: string;
turquoise: string;
violet: string;
wheat: string;
white: string;
whitesmoke: string;
yellow: string;
yellowgreen: string;
}>;

@@ -519,2 +684,6 @@ /**

export declare type SizeUnit = Exclude<SizeUnitWithAuto, AnyCase<'AUTO'>>;
export declare type SizeUnitWithAuto = AnyCase<'B' | 'KB' | 'MB' | 'GB' | 'TB' | 'AUTO'>;
/**

@@ -575,4 +744,14 @@ * 根据依赖的属性逐层排序

/**
* 将命名转换为驼峰命名
* @param value - 需要转换的命名
*/
export declare function toCamelCase(value: string): string;
/**
* 将命名转换为全大写命名Capital
* @param value - 需要转换的命名
*/
export declare function toCapitalCase(value: string): string;
export declare function toDate(any: Dateable, strict?: boolean): Date;

@@ -587,2 +766,6 @@

/**
* 将命名转换为短横线命名
* @param value - 需要转换的命名
*/
export declare function toKebabCase(value: string): string;

@@ -596,4 +779,2 @@

export declare function toPascalCase(value: string): string;
export declare interface TransferNode extends Node {

@@ -600,0 +781,0 @@ __transferNode?: Node;

@@ -47,3 +47,3 @@ var __defProp = Object.defineProperty;

const HEX_REG_8 = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
const NAMES = Object.freeze({
const NAMED_COLORS = Object.freeze({
aliceblue: "f0f8ff",

@@ -199,8 +199,12 @@ antiquewhite: "faebd7",

});
const COLOR_NAMES = Object.freeze(new Set(Object.keys(NAMED_COLORS)));
function isColor(value) {
value = value.trim().toLowerCase();
if (value === "transparent" || NAMES[value]) {
value = String(value).trim().toLowerCase();
if (!value) {
return false;
}
if (value === "transparent" || NAMED_COLORS[value]) {
return true;
}
return value === "transparent" || value in NAMES || RGB_REG.test(value) || RGBA_REG.test(value) || HSL_REG.test(value) || HSLA_REG.test(value) || HSV_REG.test(value) || HSVA_REG.test(value) || HEX_REG_3.test(value) || HEX_REG_4.test(value) || HEX_REG_6.test(value) || HEX_REG_8.test(value);
return value === "transparent" || COLOR_NAMES.has(value) || RGB_REG.test(value) || RGBA_REG.test(value) || HSL_REG.test(value) || HSLA_REG.test(value) || HSV_REG.test(value) || HSVA_REG.test(value) || HEX_REG_3.test(value) || HEX_REG_4.test(value) || HEX_REG_6.test(value) || HEX_REG_8.test(value);
}

@@ -213,4 +217,4 @@ function parseStringColor(color) {

let named = false;
if (NAMES[color]) {
color = NAMES[color];
if (NAMED_COLORS[color]) {
color = NAMED_COLORS[color];
named = true;

@@ -794,2 +798,38 @@ }

}
const SIZE_UNIT_WITH_AUTO = Object.freeze(["B", "KB", "MB", "GB", "TB", "AUTO"]);
function formatByteSize(byte, unit = "AUTO") {
let upperUnit = unit.toUpperCase();
upperUnit = SIZE_UNIT_WITH_AUTO.includes(upperUnit) ? upperUnit : "AUTO";
let power;
switch (upperUnit) {
case "AUTO":
power = 0;
break;
case "KB":
power = 1;
break;
case "MB":
power = 2;
break;
case "GB":
power = 3;
break;
case "TB":
power = 4;
break;
default:
return byte;
}
let targetSize;
if (!power) {
for (targetSize = byte; targetSize > 1024; ++power) {
if (power > 4)
break;
targetSize = targetSize / 1024;
}
} else {
targetSize = byte / 1024 ** power;
}
return targetSize;
}
const SECOND_ON_MILLS = 1e3;

@@ -1270,2 +1310,41 @@ const MINUTE_ON_SECONDS = 60;

}
const escapeRE = /["'&<>]/;
function escapeHtml(string) {
const str = "" + string;
const match = escapeRE.exec(str);
if (!match) {
return str;
}
let html = "";
let escaped;
let index;
let lastIndex = 0;
for (index = match.index; index < str.length; index++) {
switch (str.charCodeAt(index)) {
case 34:
escaped = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
break;
default:
continue;
}
if (lastIndex !== index) {
html += str.substring(lastIndex, index);
}
lastIndex = index + 1;
html += escaped;
}
return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
}
function createEventEmitter() {

@@ -1616,9 +1695,9 @@ const handlerMap = /* @__PURE__ */ new Map();

}
function toPascalCase(value) {
function toCapitalCase(value) {
return value.charAt(0).toUpperCase() + value.slice(1).replace(/-(\w)/g, (_, char) => char ? char.toUpperCase() : "");
}
function toCamelCase(value) {
const pascalName = toPascalCase(value);
return pascalName.charAt(0).toLowerCase() + pascalName.slice(1);
const capitalName = toCapitalCase(value);
return capitalName.charAt(0).toLowerCase() + capitalName.slice(1);
}
export { CLICK_TYPE, CompareAscResult, CompareDescResult, DAY_ON_HOURS, DAY_ON_MILLIS, DAY_ON_MINUTES, DAY_ON_SECONDS, HEX_REG_3, HEX_REG_4, HEX_REG_6, HEX_REG_8, HOUR_ON_MILLS, HOUR_ON_MINUTES, HOUR_ON_SECONDS, HSLA_REG, HSL_REG, HSVA_REG, HSV_REG, MINUTE_ON_MILLS, MINUTE_ON_SECONDS, NAMES, QUARTER_ON_MONTHS, RGBA_REG, RGB_REG, SECOND_ON_MILLS, USE_TOUCH, WEEK_ON_DAYS, WEEK_ON_HOURS, WEEK_ON_MILLIS, WEEK_ON_MINUTES, WEEK_ON_SECONDS, YEAR_ON_MONTHS, YEAR_ON_QUARTERS, addDays, addHalfDays, addHours, addMilliseconds, addMinutes, addMonths, addQuarters, addSeconds, addWeeks, addYears, adjustAlpha, boundRange, compareAsc, compareDesc, createBITree, createEvent, createEventEmitter, debounce, debounceFrame, debounceMinor, deepClone, destroyObject, differenceDays, differenceFullDays, differenceFullHours, differenceFullMinutes, differenceFullMonths, differenceFullQuarters, differenceFullSeconds, differenceFullWeeks, differenceFullYears, differenceHours, differenceMilliseconds, differenceMinutes, differenceMonths, differenceQuarters, differenceSeconds, differenceWeeks, differenceYears, disconnect, dispatchEvent, doubleDigits, endOfDay, flatTree, format, getChineseWeek, getLastSunday, getObservers, getQuarter, getType, groupByProps, has, hslToHsv, hslToRgb, hsvToHsl, hsvToRgb, is, isArray, isBigInt, isBoolean, isColor, isDate, isDefined, isEmpty, isFalse, isFunction, isLeepYear, isMap, isNaN, isNull, isNumber, isObject, isPromise, isRegExp, isSet, isString, isSymbol, isTrue, mergeObjects, mixColor, multipleFixed, nextFrameOnce, nextTickOnce, noop, normalizeAlpha, normalizeHsl, normalizeHsv, normalizeRgb, observe, parseColor, parseColorToRgba, parseStringColor, randomString, range, rangeDate, rangeMonth, removeArrayItem, rgbToHex, rgbToHsl, rgbToHsv, rgbaToHex, round, segmentNumber, sortByProps, startOfDay, startOfHour, startOfMinute, startOfMonth, startOfQuarter, startOfSecond, startOfWeek, startOfYear, throttle, toCamelCase, toDate, toFixed, toKebabCase, toNumber, toPascalCase, transformListToMap, transformTree };
export { CLICK_TYPE, COLOR_NAMES, CompareAscResult, CompareDescResult, DAY_ON_HOURS, DAY_ON_MILLIS, DAY_ON_MINUTES, DAY_ON_SECONDS, HEX_REG_3, HEX_REG_4, HEX_REG_6, HEX_REG_8, HOUR_ON_MILLS, HOUR_ON_MINUTES, HOUR_ON_SECONDS, HSLA_REG, HSL_REG, HSVA_REG, HSV_REG, MINUTE_ON_MILLS, MINUTE_ON_SECONDS, NAMED_COLORS, QUARTER_ON_MONTHS, RGBA_REG, RGB_REG, SECOND_ON_MILLS, USE_TOUCH, WEEK_ON_DAYS, WEEK_ON_HOURS, WEEK_ON_MILLIS, WEEK_ON_MINUTES, WEEK_ON_SECONDS, YEAR_ON_MONTHS, YEAR_ON_QUARTERS, addDays, addHalfDays, addHours, addMilliseconds, addMinutes, addMonths, addQuarters, addSeconds, addWeeks, addYears, adjustAlpha, boundRange, compareAsc, compareDesc, createBITree, createEvent, createEventEmitter, debounce, debounceFrame, debounceMinor, deepClone, destroyObject, differenceDays, differenceFullDays, differenceFullHours, differenceFullMinutes, differenceFullMonths, differenceFullQuarters, differenceFullSeconds, differenceFullWeeks, differenceFullYears, differenceHours, differenceMilliseconds, differenceMinutes, differenceMonths, differenceQuarters, differenceSeconds, differenceWeeks, differenceYears, disconnect, dispatchEvent, doubleDigits, endOfDay, escapeHtml, flatTree, format, formatByteSize, getChineseWeek, getLastSunday, getObservers, getQuarter, getType, groupByProps, has, hslToHsv, hslToRgb, hsvToHsl, hsvToRgb, is, isArray, isBigInt, isBoolean, isColor, isDate, isDefined, isEmpty, isFalse, isFunction, isLeepYear, isMap, isNaN, isNull, isNumber, isObject, isPromise, isRegExp, isSet, isString, isSymbol, isTrue, mergeObjects, mixColor, multipleFixed, nextFrameOnce, nextTickOnce, noop, normalizeAlpha, normalizeHsl, normalizeHsv, normalizeRgb, observe, parseColor, parseColorToRgba, parseStringColor, randomString, range, rangeDate, rangeMonth, removeArrayItem, rgbToHex, rgbToHsl, rgbToHsv, rgbaToHex, round, segmentNumber, sortByProps, startOfDay, startOfHour, startOfMinute, startOfMonth, startOfQuarter, startOfSecond, startOfWeek, startOfYear, throttle, toCamelCase, toCapitalCase, toDate, toFixed, toKebabCase, toNumber, transformListToMap, transformTree };

2

package.json
{
"name": "@vexip-ui/utils",
"version": "1.1.0",
"version": "1.2.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": "qmhc",

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