litus 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/arr/index.d.ts +9 -0
- package/dist/arr/index.js +51 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +37 -0
- package/dist/math/index.d.ts +11 -0
- package/dist/math/index.js +51 -0
- package/dist/obj/index.d.ts +8 -0
- package/dist/obj/index.js +40 -0
- package/dist/obj/types.d.ts +5 -0
- package/dist/obj/types.js +2 -0
- package/dist/time/index.d.ts +17 -0
- package/dist/time/index.js +69 -0
- package/dist/time/types.d.ts +4 -0
- package/dist/time/types.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +17 -0
- package/dist/types/primitives.d.ts +4 -0
- package/dist/types/primitives.js +2 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Estid Felipe Lozano Reyes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<!-- HEADER -->
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/estidlore/litus/main/Logo.svg" alt="Logo" width="80" height="80">
|
|
5
|
+
|
|
6
|
+
<h2 align="center">Litus</h2>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
Commonly used utilities for JS and TS
|
|
10
|
+
<br />
|
|
11
|
+
<a href="https://github.com/estidlore/litus/issues">Report Bug</a>
|
|
12
|
+
</p>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
Litus provides strongly-typed utils for:
|
|
16
|
+
|
|
17
|
+
- **Arrays:** chunk, from, group, ...
|
|
18
|
+
- **Math:** mean, median, mod, ...
|
|
19
|
+
- **Object:** copy, entries, merge, ...
|
|
20
|
+
- **Time:** convert, format, setDayTime, ...
|
|
21
|
+
|
|
22
|
+
<!-- Installation -->
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
Using npm
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
npm i litus
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Using yarn
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
yarn add litus
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
<!-- Usage -->
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
**Import all utils**
|
|
43
|
+
|
|
44
|
+
For ES6+ or Typescript
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
import * as ls from "litus";
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For CommonJS
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
var ls = require("litus");
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Import what you need only**
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
import type { Literal, TimeFormat } from "litus";
|
|
60
|
+
import { arr, math, obj, Time } from "litus";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
<!-- CONTRIBUTING -->
|
|
64
|
+
|
|
65
|
+
## Contributing
|
|
66
|
+
|
|
67
|
+
Feel free to open an [issue](https://github.com/estidlore/litus/issues) or fork this repo and create a pull request.
|
|
68
|
+
Don't forget to give the project a star!
|
|
69
|
+
|
|
70
|
+
<!-- LICENSE -->
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
This package released under the [MIT License](https://github.com/estidlore/litus/blob/main/LICENSE).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Primitive } from "../types";
|
|
2
|
+
declare const chunk: <T>(arr: T[], size: number) => T[][];
|
|
3
|
+
declare const fill: <T>(n: number, val: T) => T[];
|
|
4
|
+
declare const from: <T>(n: number, mapFn: (i: number) => T) => T[];
|
|
5
|
+
declare const group: <T extends object, K extends PropertyKey>(arr: T[], getKey: (obj: T) => K) => Record<K, T[]>;
|
|
6
|
+
declare const groupBy: <T extends object, K extends keyof T>(arr: T[], key: T[K] extends PropertyKey ? K : never) => Record<PropertyKey & T[K], T[]>;
|
|
7
|
+
declare const range: (a: number, b: number, step?: number) => number[];
|
|
8
|
+
declare const unique: <T extends Primitive>(arr: T[]) => T[];
|
|
9
|
+
export { chunk, fill, from, group, groupBy, range, unique };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unique = exports.range = exports.groupBy = exports.group = exports.from = exports.fill = exports.chunk = void 0;
|
|
4
|
+
var chunk = function (arr, size) {
|
|
5
|
+
return range(0, arr.length, size).map(function (i) { return arr.slice(i, i + size); });
|
|
6
|
+
};
|
|
7
|
+
exports.chunk = chunk;
|
|
8
|
+
var fill = function (n, val) {
|
|
9
|
+
return from(n, function () { return val; });
|
|
10
|
+
};
|
|
11
|
+
exports.fill = fill;
|
|
12
|
+
var from = function (n, mapFn) {
|
|
13
|
+
var res = Array(n);
|
|
14
|
+
var i = n;
|
|
15
|
+
while (--i >= 0) {
|
|
16
|
+
res[i] = mapFn(i);
|
|
17
|
+
}
|
|
18
|
+
return res;
|
|
19
|
+
};
|
|
20
|
+
exports.from = from;
|
|
21
|
+
var group = function (arr, getKey) {
|
|
22
|
+
var res = {};
|
|
23
|
+
arr.forEach(function (el) {
|
|
24
|
+
var val = getKey(el);
|
|
25
|
+
if (res[val] === undefined) {
|
|
26
|
+
res[val] = [];
|
|
27
|
+
}
|
|
28
|
+
res[val].push(el);
|
|
29
|
+
});
|
|
30
|
+
return res;
|
|
31
|
+
};
|
|
32
|
+
exports.group = group;
|
|
33
|
+
var groupBy = function (arr, key) {
|
|
34
|
+
return group(arr, function (obj) { return obj[key]; });
|
|
35
|
+
};
|
|
36
|
+
exports.groupBy = groupBy;
|
|
37
|
+
var range = function (a, b, step) {
|
|
38
|
+
if (step === void 0) { step = 1; }
|
|
39
|
+
var n = Math.ceil((b - a) / step);
|
|
40
|
+
if (n <= 0) {
|
|
41
|
+
throw Error("Invalid range");
|
|
42
|
+
}
|
|
43
|
+
return from(n, function (i) { return a + step * i; });
|
|
44
|
+
};
|
|
45
|
+
exports.range = range;
|
|
46
|
+
var unique = function (arr) {
|
|
47
|
+
var set = Array.from(new Set(arr));
|
|
48
|
+
var indexed = set.map(function (el) { return [el, arr.indexOf(el)]; });
|
|
49
|
+
return indexed.sort(function (a, b) { return a[1] - b[1]; }).map(function (el) { return el[0]; });
|
|
50
|
+
};
|
|
51
|
+
exports.unique = unique;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Time = exports.obj = exports.math = exports.arr = void 0;
|
|
30
|
+
exports.arr = __importStar(require("./arr"));
|
|
31
|
+
exports.math = __importStar(require("./math"));
|
|
32
|
+
exports.obj = __importStar(require("./obj"));
|
|
33
|
+
__exportStar(require("./obj/types"), exports);
|
|
34
|
+
var time_1 = require("./time");
|
|
35
|
+
Object.defineProperty(exports, "Time", { enumerable: true, get: function () { return time_1.Time; } });
|
|
36
|
+
__exportStar(require("./time/types"), exports);
|
|
37
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const add: (arr: number[], n: number) => number[];
|
|
2
|
+
declare const divide: (arr: number[], n: number) => number[];
|
|
3
|
+
declare const mean: (arr: number[]) => number;
|
|
4
|
+
declare const median: (arr: number[]) => number;
|
|
5
|
+
declare const mod: (x: number, m: number) => number;
|
|
6
|
+
declare const multiply: (arr: number[], n: number) => number[];
|
|
7
|
+
declare const pow: (arr: number[], n: number) => number[];
|
|
8
|
+
declare const round: (arr: number[], n?: number) => number[];
|
|
9
|
+
declare const subtract: (arr: number[], n: number) => number[];
|
|
10
|
+
declare const sum: (arr: number[]) => number;
|
|
11
|
+
export { add, divide, mean, median, mod, multiply, pow, round, subtract, sum };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sum = exports.subtract = exports.round = exports.pow = exports.multiply = exports.mod = exports.median = exports.mean = exports.divide = exports.add = void 0;
|
|
4
|
+
var obj_1 = require("../obj");
|
|
5
|
+
var add = function (arr, n) {
|
|
6
|
+
return arr.map(function (el) { return el + n; });
|
|
7
|
+
};
|
|
8
|
+
exports.add = add;
|
|
9
|
+
var divide = function (arr, n) {
|
|
10
|
+
return multiply(arr, 1 / n);
|
|
11
|
+
};
|
|
12
|
+
exports.divide = divide;
|
|
13
|
+
var mean = function (arr) {
|
|
14
|
+
return sum(arr) / arr.length;
|
|
15
|
+
};
|
|
16
|
+
exports.mean = mean;
|
|
17
|
+
var median = function (arr) {
|
|
18
|
+
var mid = arr.length / 2;
|
|
19
|
+
var a = Math.floor(mid - 0.5);
|
|
20
|
+
var b = Math.ceil(mid + 0.5);
|
|
21
|
+
return mean((0, obj_1.copy)(arr).sort().slice(a, b));
|
|
22
|
+
};
|
|
23
|
+
exports.median = median;
|
|
24
|
+
var mod = function (x, m) {
|
|
25
|
+
return ((x % m) + m) % m;
|
|
26
|
+
};
|
|
27
|
+
exports.mod = mod;
|
|
28
|
+
var multiply = function (arr, n) {
|
|
29
|
+
return arr.map(function (el) { return el * n; });
|
|
30
|
+
};
|
|
31
|
+
exports.multiply = multiply;
|
|
32
|
+
var pow = function (arr, n) {
|
|
33
|
+
return arr.map(function (el) { return Math.pow(el, n); });
|
|
34
|
+
};
|
|
35
|
+
exports.pow = pow;
|
|
36
|
+
var round = function (arr, n) {
|
|
37
|
+
if (n === void 0) { n = 0; }
|
|
38
|
+
return arr.map(function (el) {
|
|
39
|
+
var k = Math.pow(10, n);
|
|
40
|
+
return Math.round(el * k) / k;
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
exports.round = round;
|
|
44
|
+
var subtract = function (arr, n) {
|
|
45
|
+
return add(arr, -n);
|
|
46
|
+
};
|
|
47
|
+
exports.subtract = subtract;
|
|
48
|
+
var sum = function (arr) {
|
|
49
|
+
return arr.reduce(function (acc, el) { return acc + el; }, 0);
|
|
50
|
+
};
|
|
51
|
+
exports.sum = sum;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Entry, Key, Val } from "./types";
|
|
2
|
+
declare const copy: <T>(obj: T) => T;
|
|
3
|
+
declare const entries: <T extends object>(obj: T) => Entry<T>[];
|
|
4
|
+
declare const has: (obj: object, ...keys: PropertyKey[]) => boolean;
|
|
5
|
+
declare const keys: <T extends object>(obj: T) => `${Exclude<keyof T, symbol>}`[];
|
|
6
|
+
declare const merge: <A extends object, B extends object>(a: A, b: B) => A & B;
|
|
7
|
+
declare const vals: <T extends object>(obj: T) => Val<T>[];
|
|
8
|
+
export { copy, entries, has, keys, merge, vals };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.vals = exports.merge = exports.keys = exports.has = exports.entries = exports.copy = void 0;
|
|
4
|
+
var copy = function (obj) {
|
|
5
|
+
if (typeof obj !== "object" || obj === null) {
|
|
6
|
+
return obj;
|
|
7
|
+
}
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
var res = Array.isArray(obj) ? [] : {};
|
|
10
|
+
entries(obj).forEach(function (_a) {
|
|
11
|
+
var key = _a[0], val = _a[1];
|
|
12
|
+
res[key] = copy(val);
|
|
13
|
+
});
|
|
14
|
+
return res;
|
|
15
|
+
};
|
|
16
|
+
exports.copy = copy;
|
|
17
|
+
var entries = function (obj) {
|
|
18
|
+
return Object.entries(obj);
|
|
19
|
+
};
|
|
20
|
+
exports.entries = entries;
|
|
21
|
+
var has = function (obj) {
|
|
22
|
+
var keys = [];
|
|
23
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
24
|
+
keys[_i - 1] = arguments[_i];
|
|
25
|
+
}
|
|
26
|
+
return keys.every(function (key) { return Object.prototype.hasOwnProperty.call(obj, key); });
|
|
27
|
+
};
|
|
28
|
+
exports.has = has;
|
|
29
|
+
var keys = function (obj) {
|
|
30
|
+
return Object.keys(obj);
|
|
31
|
+
};
|
|
32
|
+
exports.keys = keys;
|
|
33
|
+
var merge = function (a, b) {
|
|
34
|
+
return Object.assign(copy(a), copy(b));
|
|
35
|
+
};
|
|
36
|
+
exports.merge = merge;
|
|
37
|
+
var vals = function (obj) {
|
|
38
|
+
return Object.values(obj);
|
|
39
|
+
};
|
|
40
|
+
exports.vals = vals;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TimeFormat, TimeFormatOptions, TimeUnit } from "./types";
|
|
2
|
+
declare class Time {
|
|
3
|
+
static UNITS: Record<TimeUnit, number>;
|
|
4
|
+
static formatOptions: TimeFormatOptions;
|
|
5
|
+
static locales?: Intl.LocalesArgument;
|
|
6
|
+
private readonly date;
|
|
7
|
+
constructor(val?: number, unit?: TimeUnit);
|
|
8
|
+
static convert(val: number, from: TimeUnit, to?: TimeUnit): number;
|
|
9
|
+
add(val: number, unit?: TimeUnit): number;
|
|
10
|
+
format(mode?: TimeFormat, local?: Intl.LocalesArgument, opts?: Intl.DateTimeFormatOptions): string;
|
|
11
|
+
get(unit?: TimeUnit): number;
|
|
12
|
+
getDayTime(unit?: TimeUnit): number;
|
|
13
|
+
set(val: number, unit?: TimeUnit): number;
|
|
14
|
+
setDayTime(val: number, unit?: TimeUnit): number;
|
|
15
|
+
toDate(): Date;
|
|
16
|
+
}
|
|
17
|
+
export { Time };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Time = void 0;
|
|
4
|
+
var obj_1 = require("../obj");
|
|
5
|
+
var Time = /** @class */ (function () {
|
|
6
|
+
function Time(val, unit) {
|
|
7
|
+
if (unit === void 0) { unit = "ms"; }
|
|
8
|
+
this.date = new Date();
|
|
9
|
+
if (val !== undefined) {
|
|
10
|
+
this.set(val, unit);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
Time.convert = function (val, from, to) {
|
|
14
|
+
if (to === void 0) { to = "ms"; }
|
|
15
|
+
var ms = Math.round(Time.UNITS[from] * val);
|
|
16
|
+
return ms / Time.UNITS[to];
|
|
17
|
+
};
|
|
18
|
+
Time.prototype.add = function (val, unit) {
|
|
19
|
+
if (unit === void 0) { unit = "ms"; }
|
|
20
|
+
return this.set(this.get(unit) + val, unit);
|
|
21
|
+
};
|
|
22
|
+
Time.prototype.format = function (mode, local, opts) {
|
|
23
|
+
if (mode === void 0) { mode = "full"; }
|
|
24
|
+
if (local === void 0) { local = Time.locales; }
|
|
25
|
+
if (opts === void 0) { opts = {}; }
|
|
26
|
+
var options = (0, obj_1.merge)(Time.formatOptions[mode], opts);
|
|
27
|
+
return this.date.toLocaleString(local, options);
|
|
28
|
+
};
|
|
29
|
+
Time.prototype.get = function (unit) {
|
|
30
|
+
if (unit === void 0) { unit = "ms"; }
|
|
31
|
+
return Time.convert(this.date.getTime(), "ms", unit);
|
|
32
|
+
};
|
|
33
|
+
Time.prototype.getDayTime = function (unit) {
|
|
34
|
+
if (unit === void 0) { unit = "ms"; }
|
|
35
|
+
return Time.convert(this.get("d") % 1, "d", unit);
|
|
36
|
+
};
|
|
37
|
+
Time.prototype.set = function (val, unit) {
|
|
38
|
+
if (unit === void 0) { unit = "ms"; }
|
|
39
|
+
return this.date.setTime(Time.convert(val, unit));
|
|
40
|
+
};
|
|
41
|
+
Time.prototype.setDayTime = function (val, unit) {
|
|
42
|
+
if (unit === void 0) { unit = "ms"; }
|
|
43
|
+
return this.add(val - this.getDayTime(unit), unit);
|
|
44
|
+
};
|
|
45
|
+
Time.prototype.toDate = function () {
|
|
46
|
+
return new Date(this.date);
|
|
47
|
+
};
|
|
48
|
+
Time.UNITS = {
|
|
49
|
+
d: 864e5,
|
|
50
|
+
h: 36e5,
|
|
51
|
+
m: 6e4,
|
|
52
|
+
ms: 1,
|
|
53
|
+
s: 1e3
|
|
54
|
+
};
|
|
55
|
+
Time.formatOptions = {
|
|
56
|
+
date: {
|
|
57
|
+
dateStyle: "medium"
|
|
58
|
+
},
|
|
59
|
+
full: {
|
|
60
|
+
dateStyle: "short",
|
|
61
|
+
timeStyle: "short"
|
|
62
|
+
},
|
|
63
|
+
time: {
|
|
64
|
+
timeStyle: "medium"
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return Time;
|
|
68
|
+
}());
|
|
69
|
+
exports.Time = Time;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./primitives";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./primitives"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "litus",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Commonly used utilities for JS and TS",
|
|
5
|
+
"author": {
|
|
6
|
+
"email": "estidlore@outlook.com",
|
|
7
|
+
"name": "Estid Felipe Lozano Reyes",
|
|
8
|
+
"url": "https://github.com/estidlore"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/estidlore/litus/issues"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/estidlore/litus#readme",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"array",
|
|
19
|
+
"date",
|
|
20
|
+
"javascript",
|
|
21
|
+
"math",
|
|
22
|
+
"object",
|
|
23
|
+
"time",
|
|
24
|
+
"typescript",
|
|
25
|
+
"utils"
|
|
26
|
+
],
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"main": "dist/index.js",
|
|
29
|
+
"module": "dist/index.js",
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"url": "https://github.com/estidlore/litus",
|
|
35
|
+
"type": "git"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "rm -rf ./dist && tsc -p tsconfig.prod.json && npm pack",
|
|
39
|
+
"format": "prettier --write .",
|
|
40
|
+
"lint": "eslint --ext .ts src --fix",
|
|
41
|
+
"test": "jest"
|
|
42
|
+
},
|
|
43
|
+
"types": "dist/index.d.ts",
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/jest": "^29.4.0",
|
|
46
|
+
"@typescript-eslint/parser": "^5.52.0",
|
|
47
|
+
"eslint": "^8.34.0",
|
|
48
|
+
"eslint-config-estidlore": "github:estidlore/eslint-config-estidlore",
|
|
49
|
+
"jest": "^29.4.3",
|
|
50
|
+
"prettier": "^2.8.4",
|
|
51
|
+
"ts-jest": "^29.0.5",
|
|
52
|
+
"typescript": "^4.9.5"
|
|
53
|
+
}
|
|
54
|
+
}
|