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

aidly

Package Overview
Dependencies
Maintainers
0
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aidly - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

dist/color.d.ts

177

dist/aidly.cjs.js

@@ -216,3 +216,3 @@ 'use strict';

if (!isMergeableObject(val)) return val;
return merge$1(isArray(val) ? [] : {}, val, set);
return merge(isArray(val) ? [] : {}, val, set);
};

@@ -263,3 +263,3 @@ const mergeArray = (target, source, set) => {

} else {
res[key] = merge$1(target[key], source[key], set);
res[key] = merge(target[key], source[key], set);
}

@@ -276,3 +276,3 @@ } else {

// This should not be a structure with circular references
const merge$1 = (target, source, filterSet) => {
const merge = (target, source, filterSet) => {
const sourceIsArray = isArray(source);

@@ -551,3 +551,3 @@ const targetIsArray = isArray(target);

};
const merge = (target, source) => {
const mg = (target, source) => {
if (!source) return target;

@@ -584,3 +584,3 @@ if (typeof source !== 'object') {

if (isObject(targetItem) && isObject(item)) {
target[i] = merge(targetItem, item);
target[i] = mg(targetItem, item);
} else {

@@ -597,3 +597,3 @@ target.push(item);

const value = source[key];
acc[key] = hasOwn(acc, key) ? merge(acc[key], value) : value;
acc[key] = hasOwn(acc, key) ? mg(acc[key], value) : value;
return acc;

@@ -692,3 +692,3 @@ }, mergeTarget);

const newObj = parseKeys(keys[i], tempObj[keys[i]], options);
obj = merge(obj, newObj);
obj = mg(obj, newObj);
}

@@ -719,2 +719,151 @@ return options.allowSparse ? obj : compact(obj);

// https://github.com/Qix-/color-convert/blob/master/conversions.js
const rgbToHsl = (rgb) => {
let h;
let s;
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const a = rgb[3];
const min = Math.min(r, g, b);
const max = Math.max(r, g, b);
const delta = max - min;
if (max === min) {
h = 0;
} else if (r === max) {
h = (g - b) / delta;
} else if (g === max) {
h = 2 + (b - r) / delta;
} else if (b === max) {
h = 4 + (r - g) / delta;
}
h = Math.min(h * 60, 360);
if (h < 0) h += 360;
const l = (min + max) / 2;
if (max === min) {
s = 0;
} else if (l <= 0.5) {
s = delta / (max + min);
} else {
s = delta / (2 - max - min);
}
const hsl = [h, s * 100, l * 100];
if (typeof a === 'number') hsl.push(a);
return hsl;
};
const rgbToHex = (rgb) => {
const string = (
((Math.round(rgb[0]) & 0xff) << 16) +
((Math.round(rgb[1]) & 0xff) << 8) +
(Math.round(rgb[2]) & 0xff)
)
.toString(16)
.toUpperCase();
let hex = '000000'.substring(string.length) + string;
if (typeof rgb[3] === 'number') {
hex += Math.round(rgb[3] * 0xff).toString(16);
}
return hex;
};
/**
* Not supported on `alpha`
*/
const rgbToAnsi256 = (rgb) => {
const r = rgb[0];
const g = rgb[1];
const b = rgb[2];
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r >> 4 === g >> 4 && g >> 4 === b >> 4) {
if (r < 8) return 16;
if (r > 248) return 231;
return Math.round(((r - 8) / 247) * 24) + 232;
}
return (
16 +
36 * Math.round((r / 255) * 5) +
6 * Math.round((g / 255) * 5) +
Math.round((b / 255) * 5)
);
};
const hslToRgb = (hsl) => {
const h = hsl[0] / 360;
const s = hsl[1] / 100;
const l = hsl[2] / 100;
const a = hsl[3];
let t2;
let t3;
let val;
if (s === 0) {
val = l * 255;
return [val, val, val];
}
if (l < 0.5) {
t2 = l * (1 + s);
} else {
t2 = l + s - l * s;
}
const t1 = 2 * l - t2;
const rgb = [0, 0, 0];
for (let i = 0; i < 3; i++) {
t3 = h + (1 / 3) * -(i - 1);
if (t3 < 0) t3++;
if (t3 > 1) t3--;
if (6 * t3 < 1) {
val = t1 + (t2 - t1) * 6 * t3;
} else if (2 * t3 < 1) {
val = t2;
} else if (3 * t3 < 2) {
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
} else {
val = t1;
}
rgb[i] = val * 255;
}
if (typeof a === 'number') rgb.push(a);
return rgb;
};
const hexToRgb = (hex) => {
const match = hex.match(/[a-f0-9]{8}|[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!match) return [0, 0, 0];
let colorString = match[0];
if (match[0].length === 3) {
colorString = colorString
.split('')
.map((char) => char + char)
.join('');
}
let a;
if (colorString.length === 8) {
a = Number(BigInt('0x' + colorString[6] + colorString[7])) / 0xff;
colorString = colorString.slice(0, 6);
}
const integer = Number(BigInt('0x' + colorString));
const rgb = [(integer >> 16) & 0xff, (integer >> 8) & 0xff, integer & 0xff];
if (a) rgb.push(a);
return rgb;
};
const ansi256ToRgb = (val) => {
if (val >= 232) {
const c = (val - 232) * 10 + 8;
return [c, c, c];
}
val -= 16;
let rem;
const r = (Math.floor(val / 36) / 5) * 255;
const g = (Math.floor((rem = val % 36) / 6) / 5) * 255;
const b = ((rem % 6) / 5) * 255;
return [r, g, b];
};
function randomColor(type) {
const r = random(255);
const g = random(255);
const b = random(255);
const color = [r, g, b];
if (type === 'hex') return rgbToHex(color);
if (type === 'hsl') return rgbToHsl(color);
if (type === 'ansi256') return rgbToAnsi256(color);
return color;
}
const noop = () => {};

@@ -818,3 +967,3 @@ const objectToString = Object.prototype.toString;

if (max < min) min = [max, (max = min)][0];
return Number(
const n = Number(
(Math.random() * (max - min) + min).toFixed(

@@ -824,2 +973,5 @@ Math.max(decimalPlaces(min), decimalPlaces(max)),

);
if (n > max) return max;
if (n < min) return min;
return n;
};

@@ -984,2 +1136,3 @@ const once = (fn) => {

exports.Queue = smallQueue.Queue;
exports.ansi256ToRgb = ansi256ToRgb;
exports.assert = assert;

@@ -995,2 +1148,4 @@ exports.capitalize = capitalize;

exports.hasOwn = hasOwn;
exports.hexToRgb = hexToRgb;
exports.hslToRgb = hslToRgb;
exports.idleCallback = idleCallback;

@@ -1020,3 +1175,3 @@ exports.isAbsolute = isAbsolute;

exports.map = map;
exports.merge = merge$1;
exports.merge = merge;
exports.noop = noop;

@@ -1031,3 +1186,7 @@ exports.now = now;

exports.random = random;
exports.randomColor = randomColor;
exports.remove = remove;
exports.rgbToAnsi256 = rgbToAnsi256;
exports.rgbToHex = rgbToHex;
exports.rgbToHsl = rgbToHsl;
exports.root = root;

@@ -1034,0 +1193,0 @@ exports.slash = slash;

@@ -212,3 +212,3 @@ export { Queue } from 'small-queue';

if (!isMergeableObject(val)) return val;
return merge$1(isArray(val) ? [] : {}, val, set);
return merge(isArray(val) ? [] : {}, val, set);
};

@@ -259,3 +259,3 @@ const mergeArray = (target, source, set) => {

} else {
res[key] = merge$1(target[key], source[key], set);
res[key] = merge(target[key], source[key], set);
}

@@ -272,3 +272,3 @@ } else {

// This should not be a structure with circular references
const merge$1 = (target, source, filterSet) => {
const merge = (target, source, filterSet) => {
const sourceIsArray = isArray(source);

@@ -547,3 +547,3 @@ const targetIsArray = isArray(target);

};
const merge = (target, source) => {
const mg = (target, source) => {
if (!source) return target;

@@ -580,3 +580,3 @@ if (typeof source !== 'object') {

if (isObject(targetItem) && isObject(item)) {
target[i] = merge(targetItem, item);
target[i] = mg(targetItem, item);
} else {

@@ -593,3 +593,3 @@ target.push(item);

const value = source[key];
acc[key] = hasOwn(acc, key) ? merge(acc[key], value) : value;
acc[key] = hasOwn(acc, key) ? mg(acc[key], value) : value;
return acc;

@@ -688,3 +688,3 @@ }, mergeTarget);

const newObj = parseKeys(keys[i], tempObj[keys[i]], options);
obj = merge(obj, newObj);
obj = mg(obj, newObj);
}

@@ -715,2 +715,151 @@ return options.allowSparse ? obj : compact(obj);

// https://github.com/Qix-/color-convert/blob/master/conversions.js
const rgbToHsl = (rgb) => {
let h;
let s;
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const a = rgb[3];
const min = Math.min(r, g, b);
const max = Math.max(r, g, b);
const delta = max - min;
if (max === min) {
h = 0;
} else if (r === max) {
h = (g - b) / delta;
} else if (g === max) {
h = 2 + (b - r) / delta;
} else if (b === max) {
h = 4 + (r - g) / delta;
}
h = Math.min(h * 60, 360);
if (h < 0) h += 360;
const l = (min + max) / 2;
if (max === min) {
s = 0;
} else if (l <= 0.5) {
s = delta / (max + min);
} else {
s = delta / (2 - max - min);
}
const hsl = [h, s * 100, l * 100];
if (typeof a === 'number') hsl.push(a);
return hsl;
};
const rgbToHex = (rgb) => {
const string = (
((Math.round(rgb[0]) & 0xff) << 16) +
((Math.round(rgb[1]) & 0xff) << 8) +
(Math.round(rgb[2]) & 0xff)
)
.toString(16)
.toUpperCase();
let hex = '000000'.substring(string.length) + string;
if (typeof rgb[3] === 'number') {
hex += Math.round(rgb[3] * 0xff).toString(16);
}
return hex;
};
/**
* Not supported on `alpha`
*/
const rgbToAnsi256 = (rgb) => {
const r = rgb[0];
const g = rgb[1];
const b = rgb[2];
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r >> 4 === g >> 4 && g >> 4 === b >> 4) {
if (r < 8) return 16;
if (r > 248) return 231;
return Math.round(((r - 8) / 247) * 24) + 232;
}
return (
16 +
36 * Math.round((r / 255) * 5) +
6 * Math.round((g / 255) * 5) +
Math.round((b / 255) * 5)
);
};
const hslToRgb = (hsl) => {
const h = hsl[0] / 360;
const s = hsl[1] / 100;
const l = hsl[2] / 100;
const a = hsl[3];
let t2;
let t3;
let val;
if (s === 0) {
val = l * 255;
return [val, val, val];
}
if (l < 0.5) {
t2 = l * (1 + s);
} else {
t2 = l + s - l * s;
}
const t1 = 2 * l - t2;
const rgb = [0, 0, 0];
for (let i = 0; i < 3; i++) {
t3 = h + (1 / 3) * -(i - 1);
if (t3 < 0) t3++;
if (t3 > 1) t3--;
if (6 * t3 < 1) {
val = t1 + (t2 - t1) * 6 * t3;
} else if (2 * t3 < 1) {
val = t2;
} else if (3 * t3 < 2) {
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
} else {
val = t1;
}
rgb[i] = val * 255;
}
if (typeof a === 'number') rgb.push(a);
return rgb;
};
const hexToRgb = (hex) => {
const match = hex.match(/[a-f0-9]{8}|[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!match) return [0, 0, 0];
let colorString = match[0];
if (match[0].length === 3) {
colorString = colorString
.split('')
.map((char) => char + char)
.join('');
}
let a;
if (colorString.length === 8) {
a = Number(BigInt('0x' + colorString[6] + colorString[7])) / 0xff;
colorString = colorString.slice(0, 6);
}
const integer = Number(BigInt('0x' + colorString));
const rgb = [(integer >> 16) & 0xff, (integer >> 8) & 0xff, integer & 0xff];
if (a) rgb.push(a);
return rgb;
};
const ansi256ToRgb = (val) => {
if (val >= 232) {
const c = (val - 232) * 10 + 8;
return [c, c, c];
}
val -= 16;
let rem;
const r = (Math.floor(val / 36) / 5) * 255;
const g = (Math.floor((rem = val % 36) / 6) / 5) * 255;
const b = ((rem % 6) / 5) * 255;
return [r, g, b];
};
function randomColor(type) {
const r = random(255);
const g = random(255);
const b = random(255);
const color = [r, g, b];
if (type === 'hex') return rgbToHex(color);
if (type === 'hsl') return rgbToHsl(color);
if (type === 'ansi256') return rgbToAnsi256(color);
return color;
}
const noop = () => {};

@@ -814,3 +963,3 @@ const objectToString = Object.prototype.toString;

if (max < min) min = [max, (max = min)][0];
return Number(
const n = Number(
(Math.random() * (max - min) + min).toFixed(

@@ -820,2 +969,5 @@ Math.max(decimalPlaces(min), decimalPlaces(max)),

);
if (n > max) return max;
if (n < min) return min;
return n;
};

@@ -980,2 +1132,3 @@ const once = (fn) => {

export {
ansi256ToRgb,
assert,

@@ -991,2 +1144,4 @@ capitalize,

hasOwn,
hexToRgb,
hslToRgb,
idleCallback,

@@ -1016,3 +1171,3 @@ isAbsolute,

map,
merge$1 as merge,
merge,
noop,

@@ -1027,3 +1182,7 @@ now,

random,
randomColor,
remove,
rgbToAnsi256,
rgbToHex,
rgbToHsl,
root,

@@ -1030,0 +1189,0 @@ slash,

@@ -266,3 +266,3 @@ (function (global, factory) {

if (!isMergeableObject(val)) return val;
return merge$1(isArray(val) ? [] : {}, val, set);
return merge(isArray(val) ? [] : {}, val, set);
};

@@ -313,3 +313,3 @@ const mergeArray = (target, source, set) => {

} else {
res[key] = merge$1(target[key], source[key], set);
res[key] = merge(target[key], source[key], set);
}

@@ -326,3 +326,3 @@ } else {

// This should not be a structure with circular references
const merge$1 = (target, source, filterSet) => {
const merge = (target, source, filterSet) => {
const sourceIsArray = isArray(source);

@@ -605,3 +605,3 @@ const targetIsArray = isArray(target);

};
const merge = (target, source) => {
const mg = (target, source) => {
if (!source) return target;

@@ -638,3 +638,3 @@ if (typeof source !== 'object') {

if (isObject(targetItem) && isObject(item)) {
target[i] = merge(targetItem, item);
target[i] = mg(targetItem, item);
} else {

@@ -651,3 +651,3 @@ target.push(item);

const value = source[key];
acc[key] = hasOwn(acc, key) ? merge(acc[key], value) : value;
acc[key] = hasOwn(acc, key) ? mg(acc[key], value) : value;
return acc;

@@ -746,3 +746,3 @@ }, mergeTarget);

const newObj = parseKeys(keys[i], tempObj[keys[i]], options);
obj = merge(obj, newObj);
obj = mg(obj, newObj);
}

@@ -773,2 +773,151 @@ return options.allowSparse ? obj : compact(obj);

// https://github.com/Qix-/color-convert/blob/master/conversions.js
const rgbToHsl = (rgb) => {
let h;
let s;
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const a = rgb[3];
const min = Math.min(r, g, b);
const max = Math.max(r, g, b);
const delta = max - min;
if (max === min) {
h = 0;
} else if (r === max) {
h = (g - b) / delta;
} else if (g === max) {
h = 2 + (b - r) / delta;
} else if (b === max) {
h = 4 + (r - g) / delta;
}
h = Math.min(h * 60, 360);
if (h < 0) h += 360;
const l = (min + max) / 2;
if (max === min) {
s = 0;
} else if (l <= 0.5) {
s = delta / (max + min);
} else {
s = delta / (2 - max - min);
}
const hsl = [h, s * 100, l * 100];
if (typeof a === 'number') hsl.push(a);
return hsl;
};
const rgbToHex = (rgb) => {
const string = (
((Math.round(rgb[0]) & 0xff) << 16) +
((Math.round(rgb[1]) & 0xff) << 8) +
(Math.round(rgb[2]) & 0xff)
)
.toString(16)
.toUpperCase();
let hex = '000000'.substring(string.length) + string;
if (typeof rgb[3] === 'number') {
hex += Math.round(rgb[3] * 0xff).toString(16);
}
return hex;
};
/**
* Not supported on `alpha`
*/
const rgbToAnsi256 = (rgb) => {
const r = rgb[0];
const g = rgb[1];
const b = rgb[2];
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r >> 4 === g >> 4 && g >> 4 === b >> 4) {
if (r < 8) return 16;
if (r > 248) return 231;
return Math.round(((r - 8) / 247) * 24) + 232;
}
return (
16 +
36 * Math.round((r / 255) * 5) +
6 * Math.round((g / 255) * 5) +
Math.round((b / 255) * 5)
);
};
const hslToRgb = (hsl) => {
const h = hsl[0] / 360;
const s = hsl[1] / 100;
const l = hsl[2] / 100;
const a = hsl[3];
let t2;
let t3;
let val;
if (s === 0) {
val = l * 255;
return [val, val, val];
}
if (l < 0.5) {
t2 = l * (1 + s);
} else {
t2 = l + s - l * s;
}
const t1 = 2 * l - t2;
const rgb = [0, 0, 0];
for (let i = 0; i < 3; i++) {
t3 = h + (1 / 3) * -(i - 1);
if (t3 < 0) t3++;
if (t3 > 1) t3--;
if (6 * t3 < 1) {
val = t1 + (t2 - t1) * 6 * t3;
} else if (2 * t3 < 1) {
val = t2;
} else if (3 * t3 < 2) {
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
} else {
val = t1;
}
rgb[i] = val * 255;
}
if (typeof a === 'number') rgb.push(a);
return rgb;
};
const hexToRgb = (hex) => {
const match = hex.match(/[a-f0-9]{8}|[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!match) return [0, 0, 0];
let colorString = match[0];
if (match[0].length === 3) {
colorString = colorString
.split('')
.map((char) => char + char)
.join('');
}
let a;
if (colorString.length === 8) {
a = Number(BigInt('0x' + colorString[6] + colorString[7])) / 0xff;
colorString = colorString.slice(0, 6);
}
const integer = Number(BigInt('0x' + colorString));
const rgb = [(integer >> 16) & 0xff, (integer >> 8) & 0xff, integer & 0xff];
if (a) rgb.push(a);
return rgb;
};
const ansi256ToRgb = (val) => {
if (val >= 232) {
const c = (val - 232) * 10 + 8;
return [c, c, c];
}
val -= 16;
let rem;
const r = (Math.floor(val / 36) / 5) * 255;
const g = (Math.floor((rem = val % 36) / 6) / 5) * 255;
const b = ((rem % 6) / 5) * 255;
return [r, g, b];
};
function randomColor(type) {
const r = random(255);
const g = random(255);
const b = random(255);
const color = [r, g, b];
if (type === 'hex') return rgbToHex(color);
if (type === 'hsl') return rgbToHsl(color);
if (type === 'ansi256') return rgbToAnsi256(color);
return color;
}
const noop = () => {};

@@ -872,3 +1021,3 @@ const objectToString = Object.prototype.toString;

if (max < min) min = [max, (max = min)][0];
return Number(
const n = Number(
(Math.random() * (max - min) + min).toFixed(

@@ -878,2 +1027,5 @@ Math.max(decimalPlaces(min), decimalPlaces(max)),

);
if (n > max) return max;
if (n < min) return min;
return n;
};

@@ -1038,2 +1190,3 @@ const once = (fn) => {

exports.Queue = Queue;
exports.ansi256ToRgb = ansi256ToRgb;
exports.assert = assert;

@@ -1049,2 +1202,4 @@ exports.capitalize = capitalize;

exports.hasOwn = hasOwn;
exports.hexToRgb = hexToRgb;
exports.hslToRgb = hslToRgb;
exports.idleCallback = idleCallback;

@@ -1074,3 +1229,3 @@ exports.isAbsolute = isAbsolute;

exports.map = map;
exports.merge = merge$1;
exports.merge = merge;
exports.noop = noop;

@@ -1085,3 +1240,7 @@ exports.now = now;

exports.random = random;
exports.randomColor = randomColor;
exports.remove = remove;
exports.rgbToAnsi256 = rgbToAnsi256;
exports.rgbToHex = rgbToHex;
exports.rgbToHsl = rgbToHsl;
exports.root = root;

@@ -1088,0 +1247,0 @@ exports.slash = slash;

@@ -15,2 +15,11 @@ import type { TypedArray, PrimitiveType } from './types';

} from './qs';
export {
rgbToHsl,
rgbToHex,
rgbToAnsi256,
hslToRgb,
hexToRgb,
ansi256ToRgb,
randomColor,
} from './color';
export type {

@@ -17,0 +26,0 @@ TypedArray,

3

package.json
{
"name": "aidly",
"version": "1.2.0",
"version": "1.2.1",
"description": "Tool library.",
"sideEffects": false,
"main": "./dist/aidly.cjs.js",

@@ -6,0 +7,0 @@ "unpkg": "./dist/aidly.umd.js",

@@ -20,3 +20,3 @@ <div align="center">

> https://unpkg.com/aidly/dist/
> https://unpkg.com/browse/aidly/dist/index.d.ts

@@ -23,0 +23,0 @@

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