Skip to content

Commit

Permalink
version bump & build
Browse files Browse the repository at this point in the history
  • Loading branch information
jlsnow301 committed Jun 29, 2024
1 parent cc853e3 commit cc2bb84
Show file tree
Hide file tree
Showing 100 changed files with 1,113 additions and 1,398 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
node_modules
pnpm-lock.yaml
5 changes: 0 additions & 5 deletions dist/assets.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
const l = [/v4shim/i], d = {}, r = (t) => d[t] || t, f = (t) => (p) => (n) => {
const { type: i, payload: e } = n;
if (i === "asset/stylesheet") {
Expand Down
70 changes: 1 addition & 69 deletions dist/common/collections.d.ts
Original file line number Diff line number Diff line change
@@ -1,64 +1,3 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
/**
* Iterates over elements of collection, returning an array of all elements
* iteratee returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* If collection is 'null' or 'undefined', it will be returned "as is"
* without emitting any errors (which can be useful in some cases).
*/
export declare const filter: <T>(collection: T[], iterateeFn: (input: T, index: number, collection: T[]) => boolean) => T[];
type MapFunction = {
<T, U>(collection: T[], iterateeFn: (value: T, index: number, collection: T[]) => U): U[];
<T, U, K extends string | number>(collection: Record<K, T>, iterateeFn: (value: T, index: K, collection: Record<K, T>) => U): U[];
};
/**
* Creates an array of values by running each element in collection
* thru an iteratee function. The iteratee is invoked with three
* arguments: (value, index|key, collection).
*
* If collection is 'null' or 'undefined', it will be returned "as is"
* without emitting any errors (which can be useful in some cases).
*/
export declare const map: MapFunction;
/**
* Creates an array of elements, sorted in ascending order by the results
* of running each element in a collection thru each iteratee.
*
* Iteratees are called with one argument (value).
*/
export declare const sortBy: <T>(array: T[], ...iterateeFns: ((input: T) => unknown)[]) => T[];
export declare const sort: <T>(array: T[]) => T[];
/**
* Returns a range of numbers from start to end, exclusively.
* For example, range(0, 5) will return [0, 1, 2, 3, 4].
*/
export declare const range: (start: number, end: number) => number[];
type ReduceFunction = {
<T, U>(array: T[], reducerFn: (accumulator: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
<T>(array: T[], reducerFn: (accumulator: T, currentValue: T, currentIndex: number, array: T[]) => T): T;
};
/**
* A fast implementation of reduce.
*/
export declare const reduce: ReduceFunction;
/**
* Creates a duplicate-free version of an array, using SameValueZero for
* equality comparisons, in which only the first occurrence of each element
* is kept. The order of result values is determined by the order they occur
* in the array.
*
* It accepts iteratee which is invoked for each element in array to generate
* the criterion by which uniqueness is computed. The order of result values
* is determined by the order they occur in the array. The iteratee is
* invoked with one argument: value.
*/
export declare const uniqBy: <T extends unknown>(array: T[], iterateeFn?: (value: T) => unknown) => T[];
export declare const uniq: <T>(array: T[]) => T[];
type Zip<T extends unknown[][]> = {
[I in keyof T]: T[I] extends (infer U)[] ? U : never;
}[];
Expand All @@ -67,12 +6,5 @@ type Zip<T extends unknown[][]> = {
* the first elements of the given arrays, the second of which contains
* the second elements of the given arrays, and so on.
*/
export declare const zip: <T extends unknown[][]>(...arrays: T) => Zip<T>;
export declare const binaryInsertWith: <T, U = unknown>(collection: readonly T[], value: T, getKey: (value: T) => U) => T[];
/**
* This method takes a collection of items and a number, returning a collection
* of collections, where the maximum amount of items in each is that second arg
*/
export declare const paginate: <T>(collection: T[], maxPerPage: number) => T[][];
export declare const deepMerge: (...objects: any[]) => any;
export declare function zip<T extends unknown[][]>(...arrays: T): Zip<T>;
export {};
146 changes: 11 additions & 135 deletions dist/common/collections.js
Original file line number Diff line number Diff line change
@@ -1,139 +1,15 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
const y = (t, n) => {
if (t == null)
return t;
if (Array.isArray(t)) {
const s = [];
for (let e = 0; e < t.length; e++) {
const r = t[e];
n(r, e, t) && s.push(r);
}
return s;
}
throw new Error(`filter() can't iterate on type ${typeof t}`);
}, d = (t, n) => {
if (t == null)
return t;
if (Array.isArray(t)) {
const s = [];
for (let e = 0; e < t.length; e++)
s.push(n(t[e], e, t));
return s;
}
if (typeof t == "object") {
const s = [];
for (let e in t)
Object.prototype.hasOwnProperty.call(t, e) && s.push(n(t[e], e, t));
return s;
}
throw new Error(`map() can't iterate on type ${typeof t}`);
}, p = (t, n) => {
const s = t.criteria, e = n.criteria, r = s.length;
for (let u = 0; u < r; u++) {
const i = s[u], f = e[u];
if (i < f)
return -1;
if (i > f)
return 1;
}
return 0;
}, l = (t, ...n) => {
if (!Array.isArray(t))
return t;
let s = t.length, e = [];
for (let u = 0; u < s; u++) {
const i = t[u];
e.push({
criteria: n.map((f) => f(i)),
value: i
});
}
e.sort(p);
const r = [];
for (; s--; )
r[s] = e[s].value;
return r;
}, A = (t) => l(t), m = (t, n) => new Array(n - t).fill(null).map((s, e) => e + t), w = (t, n, s) => {
const e = t.length;
let r, u;
for (s === void 0 ? (r = 1, u = t[0]) : (r = 0, u = s); r < e; r++)
u = n(u, t[r], r, t);
return u;
}, c = (t, n) => {
const { length: s } = t, e = [], r = n ? [] : e;
let u = -1;
t:
for (; ++u < s; ) {
let i = t[u];
const f = n ? n(i) : i;
if (f === f) {
let o = r.length;
for (; o--; )
if (r[o] === f)
continue t;
n && r.push(f), e.push(i);
} else
r.includes(f) || (r !== e && r.push(f), e.push(i));
}
return e;
}, b = (t) => c(t), v = (...t) => {
if (t.length === 0)
function s(...n) {
if (n.length === 0)
return [];
const n = t.length, s = t[0].length, e = [];
for (let r = 0; r < s; r++) {
const u = [];
for (let i = 0; i < n; i++)
u.push(t[i][r]);
e.push(u);
const o = n.length, r = n[0].length, u = [];
for (let t = 0; t < r; t++) {
const l = [];
for (let e = 0; e < o; e++)
l.push(n[e][t]);
u.push(l);
}
return e;
}, g = (t, n, s) => {
if (n.length === 0)
return 0;
const e = t(s);
let [r, u] = [0, n.length], i, f = 0;
for (; r < u; )
if (f = r + u >> 1, i = t(n[f]), i < e)
r = f + 1;
else {
if (i === e)
return f;
u = f;
}
return i > e ? f : f + 1;
}, j = (t, n, s) => {
const e = [...t];
return e.splice(g(s, t, n), 0, n), e;
}, O = (t, n) => {
const s = [];
let e = [], r = n;
for (const u of t)
e.push(u), r--, r || (r = n, s.push(e), e = []);
return e.length && s.push(e), s;
}, h = (t) => typeof t == "object" && t !== null, a = (...t) => {
const n = {};
for (const s of t)
for (const e of Object.keys(s)) {
const r = n[e], u = s[e];
Array.isArray(r) && Array.isArray(u) ? n[e] = [...r, ...u] : h(r) && h(u) ? n[e] = a(r, u) : n[e] = u;
}
return n;
};
return u;
}
export {
j as binaryInsertWith,
a as deepMerge,
y as filter,
d as map,
O as paginate,
m as range,
w as reduce,
A as sort,
l as sortBy,
b as uniq,
c as uniqBy,
v as zip
s as zip
};
5 changes: 0 additions & 5 deletions dist/common/color.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
export declare class Color {
r: number;
g: number;
Expand Down
7 changes: 1 addition & 6 deletions dist/common/color.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
var b = Object.defineProperty;
var l = (i, t, s) => t in i ? b(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s;
var e = (i, t, s) => (l(i, typeof t != "symbol" ? t + "" : t, s), s);
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
var e = (i, t, s) => l(i, typeof t != "symbol" ? t + "" : t, s);
class n {
constructor(t = 0, s = 0, r = 0, a = 1) {
e(this, "r");
Expand Down
5 changes: 0 additions & 5 deletions dist/common/events.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
type Fn = (...args: any[]) => void;
export declare class EventEmitter {
private listeners;
Expand Down
7 changes: 1 addition & 6 deletions dist/common/events.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
var h = Object.defineProperty;
var c = (e, s, t) => s in e ? h(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
var n = (e, s, t) => (c(e, typeof s != "symbol" ? s + "" : s, t), t);
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
var n = (e, s, t) => c(e, typeof s != "symbol" ? s + "" : s, t);
class u {
constructor() {
n(this, "listeners");
Expand Down
2 changes: 1 addition & 1 deletion dist/common/exhaustive.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* exhaustiveCheck(color);
* }
*/
export declare const exhaustiveCheck: (input: never) => never;
export declare function exhaustiveCheck(input: never): void;
6 changes: 3 additions & 3 deletions dist/common/exhaustive.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const r = (e) => {
function n(e) {
throw new Error(`Unhandled case: ${e}`);
};
}
export {
r as exhaustiveCheck
n as exhaustiveCheck
};
5 changes: 0 additions & 5 deletions dist/common/fp.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
type Func = (...args: any[]) => any;
/**
* Creates a function that returns the result of invoking the given
Expand Down
17 changes: 6 additions & 11 deletions dist/common/fp.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
const l = (...t) => (e, ...o) => {
let r = e;
for (let f of t)
Array.isArray(f) ? r = l(...f)(r, ...o) : f && (r = f(r, ...o));
return r;
const n = (...t) => (e, ...f) => {
let o = e;
for (const r of t)
Array.isArray(r) ? o = n(...r)(o, ...f) : r && (o = r(o, ...f));
return o;
};
export {
l as flow
n as flow
};
29 changes: 10 additions & 19 deletions dist/common/math.d.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,39 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
/**
* Limits a number to the range between 'min' and 'max'.
*/
export declare const clamp: (value: any, min: any, max: any) => any;
export declare function clamp(value: any, min: any, max: any): any;
/**
* Limits a number between 0 and 1.
*/
export declare const clamp01: (value: any) => any;
export declare function clamp01(value: any): any;
/**
* Scales a number to fit into the range between min and max.
*/
export declare const scale: (value: any, min: any, max: any) => number;
export declare function scale(value: any, min: any, max: any): number;
/**
* Robust number rounding.
*
* Adapted from Locutus, see: http://locutus.io/php/math/round/
* Robust number rounding, similar to PHP's round() function.
*
* @param {number} value
* @param {number} precision
* @return {number}
* @url https://stackoverflow.com/questions/53450248/how-to-round-in-javascript-like-php-do/54721202#54721202
*/
export declare const round: (value: any, precision: any) => any;
export declare function round(num: any, dec: any): number;
/**
* Returns a string representing a number in fixed point notation.
*/
export declare const toFixed: (value: any, fractionDigits?: number) => string;
export declare function toFixed(value: any, fractionDigits?: number): string;
/**
* Checks whether a value is within the provided range.
*
* Range is an array of two numbers, for example: [0, 15].
*/
export declare const inRange: (value: any, range: any) => any;
export declare function inRange(value: any, range: any): any;
/**
* Walks over the object with ranges, comparing value against every range,
* and returns the key of the first matching range.
*
* Range is an array of two numbers, for example: [0, 15].
*/
export declare const keyOfMatchingRange: (value: any, ranges: any) => string | undefined;
export declare function keyOfMatchingRange(value: any, ranges: any): string | undefined;
/**
* Get number of digits following the decimal point in a number
*/
export declare const numberOfDecimalDigits: (value: any) => any;
export declare function numberOfDecimalDigits(value: any): any;
Loading

0 comments on commit cc2bb84

Please sign in to comment.