@agogte/utilynx 1.0.7
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 +7 -0
- package/README.md +206 -0
- package/dist/collection.d.ts +9 -0
- package/dist/datetime.d.ts +32 -0
- package/dist/extensions.d.ts +23 -0
- package/dist/index.d.ts +5 -0
- package/dist/math.d.ts +9 -0
- package/dist/string.d.ts +34 -0
- package/dist-obf/collection.js +1 -0
- package/dist-obf/datetime.js +1 -0
- package/dist-obf/extensions.js +1 -0
- package/dist-obf/index.js +1 -0
- package/dist-obf/math.js +1 -0
- package/dist-obf/string.js +1 -0
- package/package.json +40 -0
package/LICENSE
ADDED
package/README.md
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
# utilynx
|
2
|
+
|
3
|
+
High-level utility functions for working with arrays, math, strings, and more — bringing expressive language features to JavaScript and TypeScript.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```bash
|
8
|
+
npm install utilynx
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Import the package in your TypeScript or JavaScript project:
|
14
|
+
|
15
|
+
```typescript
|
16
|
+
import * as utilynx from 'utilynx';
|
17
|
+
// or import specific utilities:
|
18
|
+
import { groupBy, round } from 'utilynx';
|
19
|
+
```
|
20
|
+
|
21
|
+
Some utilities extend built-in prototypes (like `Number`, `Array`, `String`, `Object`, and `Date`).
|
22
|
+
To use these, simply import the package once at the top of your entry file:
|
23
|
+
|
24
|
+
```typescript
|
25
|
+
import 'utilynx';
|
26
|
+
```
|
27
|
+
|
28
|
+
---
|
29
|
+
|
30
|
+
## API Reference
|
31
|
+
|
32
|
+
### Math Utilities (`math.ts`)
|
33
|
+
|
34
|
+
These methods extend the `Number` prototype.
|
35
|
+
**Import the package once to enable them:**
|
36
|
+
|
37
|
+
```typescript
|
38
|
+
import 'utilynx';
|
39
|
+
|
40
|
+
(9).sqrt(); // 3
|
41
|
+
|
42
|
+
(3.14159).round(2); // 3.14
|
43
|
+
(10.5678).round(); // 11
|
44
|
+
|
45
|
+
(4).isEven(); // true
|
46
|
+
(5).isOdd(); // true
|
47
|
+
```
|
48
|
+
|
49
|
+
#### `Number.prototype.sqrt(): number`
|
50
|
+
Returns the square root of the number.
|
51
|
+
|
52
|
+
#### `Number.prototype.round(precision?: number): number`
|
53
|
+
Rounds the number to a specified number of decimal places.
|
54
|
+
|
55
|
+
#### `Number.prototype.isEven(): boolean`
|
56
|
+
Checks if the number is even.
|
57
|
+
|
58
|
+
#### `Number.prototype.isOdd(): boolean`
|
59
|
+
Checks if the number is odd.
|
60
|
+
|
61
|
+
---
|
62
|
+
|
63
|
+
### Collection Utilities (`collection.ts`)
|
64
|
+
|
65
|
+
These methods extend the `Array` prototype.
|
66
|
+
**Import the package once to enable them:**
|
67
|
+
|
68
|
+
```typescript
|
69
|
+
import 'utilynx';
|
70
|
+
|
71
|
+
[1, 2, 3].firstOrDefault(); // 1
|
72
|
+
[1, 2, 3].firstOrDefault(x => x > 1); // 2
|
73
|
+
|
74
|
+
const grouped = [
|
75
|
+
{ type: 'fruit', name: 'apple' },
|
76
|
+
{ type: 'vegetable', name: 'carrot' },
|
77
|
+
{ type: 'fruit', name: 'banana' }
|
78
|
+
].groupBy(item => item.type);
|
79
|
+
// grouped = { fruit: [...], vegetable: [...] }
|
80
|
+
|
81
|
+
[1, 2, 3].sum(); // 6
|
82
|
+
[2, 4, 6].average(); // 4
|
83
|
+
```
|
84
|
+
|
85
|
+
#### `Array.prototype.firstOrDefault(predicate?: (item: T) => boolean): T | undefined`
|
86
|
+
Returns the first element in an array, or the first that matches a predicate, or `undefined` if none found.
|
87
|
+
|
88
|
+
#### `Array.prototype.groupBy(keySelector: (item: T) => K): Record<K, T[]>`
|
89
|
+
Groups array elements by a key.
|
90
|
+
|
91
|
+
#### `Array.prototype.sum(): number | undefined`
|
92
|
+
Returns the sum of an array of numbers, or `undefined` if the array is empty.
|
93
|
+
|
94
|
+
#### `Array.prototype.average(): number | undefined`
|
95
|
+
Returns the average of an array of numbers, or `undefined` if the array is empty.
|
96
|
+
|
97
|
+
---
|
98
|
+
|
99
|
+
### String Utilities (`string.ts`)
|
100
|
+
|
101
|
+
These methods extend the `String` prototype.
|
102
|
+
**Import the package once to enable them:**
|
103
|
+
|
104
|
+
```typescript
|
105
|
+
import 'utilynx';
|
106
|
+
|
107
|
+
''.isNullOrEmpty(); // true
|
108
|
+
'abc'.isNullOrEmpty(); // false
|
109
|
+
|
110
|
+
'abc'.padLeft(5, '0'); // '00abc'
|
111
|
+
'abc'.padRight(5, '0'); // 'abc00'
|
112
|
+
```
|
113
|
+
|
114
|
+
#### `String.prototype.isNullOrEmpty(): boolean`
|
115
|
+
Checks if a string is empty.
|
116
|
+
|
117
|
+
#### `String.prototype.padLeft(totalLength: number, padChar: string): string`
|
118
|
+
Pads the string on the left to the specified length.
|
119
|
+
|
120
|
+
#### `String.prototype.padRight(totalLength: number, padChar: string): string`
|
121
|
+
Pads the string on the right to the specified length.
|
122
|
+
|
123
|
+
---
|
124
|
+
|
125
|
+
### Date Utilities (`datetime.ts`)
|
126
|
+
|
127
|
+
These methods extend the `Date` prototype.
|
128
|
+
**Import the package once to enable them:**
|
129
|
+
|
130
|
+
```typescript
|
131
|
+
import 'utilynx';
|
132
|
+
|
133
|
+
const d = new Date('2020-01-01');
|
134
|
+
d.addDays(1); // 2020-01-02
|
135
|
+
|
136
|
+
new Date('2023-06-24').isWeekend(); // true (Saturday)
|
137
|
+
|
138
|
+
new Date('2020-01-02T12:34:56Z').toShortDateString(); // '2020-01-02'
|
139
|
+
|
140
|
+
const d1 = new Date('2020-01-01');
|
141
|
+
const d2 = new Date('2020-01-03');
|
142
|
+
d1.diffDays(d2); // 2
|
143
|
+
|
144
|
+
new Date('2020-01-01T00:00:00Z').addHours(2); // 2020-01-01T02:00:00Z
|
145
|
+
new Date('2020-01-01T00:00:00Z').addMinutes(30); // 2020-01-01T00:30:00Z
|
146
|
+
```
|
147
|
+
|
148
|
+
#### `Date.prototype.addDays(days: number): Date`
|
149
|
+
Returns a new `Date` with the specified number of days added.
|
150
|
+
|
151
|
+
#### `Date.prototype.isWeekend(): boolean`
|
152
|
+
Checks if the date is a Saturday or Sunday.
|
153
|
+
|
154
|
+
#### `Date.prototype.toShortDateString(): string`
|
155
|
+
Returns the date as a string in `YYYY-MM-DD` format.
|
156
|
+
|
157
|
+
#### `Date.prototype.diffDays(otherDate: Date): number`
|
158
|
+
Returns the difference in whole days between two dates.
|
159
|
+
|
160
|
+
#### `Date.prototype.addHours(hours: number): Date`
|
161
|
+
Returns a new `Date` with the specified number of hours added.
|
162
|
+
|
163
|
+
#### `Date.prototype.addMinutes(minutes: number): Date`
|
164
|
+
Returns a new `Date` with the specified number of minutes added.
|
165
|
+
|
166
|
+
---
|
167
|
+
|
168
|
+
### Object Utilities (`extensions.ts`)
|
169
|
+
|
170
|
+
These methods extend the `Object` prototype.
|
171
|
+
**Import the package once to enable them:**
|
172
|
+
|
173
|
+
```typescript
|
174
|
+
import 'utilynx';
|
175
|
+
|
176
|
+
({}.hasValue()); // true
|
177
|
+
(null as any)?.hasValue?.(); // false
|
178
|
+
|
179
|
+
({}.isEmpty()); // true
|
180
|
+
({ a: 1 }.isEmpty()); // false
|
181
|
+
''.isEmpty(); // true
|
182
|
+
[1].isEmpty(); // false
|
183
|
+
|
184
|
+
('123'.isNumeric()); // true
|
185
|
+
('abc'.isNumeric()); // false
|
186
|
+
(123 as any).isNumeric(); // true
|
187
|
+
(NaN as any).isNumeric(); // false
|
188
|
+
```
|
189
|
+
|
190
|
+
#### `Object.prototype.hasValue(): boolean`
|
191
|
+
Checks if the object is not `null` or `undefined`.
|
192
|
+
|
193
|
+
#### `Object.prototype.isEmpty(): boolean`
|
194
|
+
Checks if the object, array, or string is empty.
|
195
|
+
|
196
|
+
#### `Object.prototype.isNumeric(): boolean`
|
197
|
+
Checks if the object represents a numeric value.
|
198
|
+
|
199
|
+
---
|
200
|
+
|
201
|
+
## License
|
202
|
+
|
203
|
+
This software is **not open source**.
|
204
|
+
You must obtain explicit written permission from the author to use, copy, modify, or distribute this package.
|
205
|
+
Commercial or non-commercial use requires a paid license.
|
206
|
+
Contact the author for licensing terms and pricing.
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export {};
|
2
|
+
declare global {
|
3
|
+
interface Array<T> {
|
4
|
+
firstOrDefault(predicate?: (item: T) => boolean): T | undefined;
|
5
|
+
groupBy<K extends string | number | symbol>(keySelector: (item: T) => K): Record<K, T[]>;
|
6
|
+
sum(this: number[]): number | undefined;
|
7
|
+
average(this: number[]): number | undefined;
|
8
|
+
}
|
9
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/**
|
2
|
+
* Extends the global `Date` interface with additional utility methods.
|
3
|
+
*
|
4
|
+
* @method addDays
|
5
|
+
* Adds the specified number of days to the current date instance and returns a new `Date` object.
|
6
|
+
* @param days - The number of days to add (can be negative).
|
7
|
+
* @returns A new `Date` object with the days added.
|
8
|
+
*
|
9
|
+
* @method isWeekend
|
10
|
+
* Determines whether the current date instance falls on a weekend (Saturday or Sunday).
|
11
|
+
* @returns `true` if the date is a weekend, otherwise `false`.
|
12
|
+
*
|
13
|
+
* @method toShortDateString
|
14
|
+
* Returns a string representation of the date in a short, locale-specific format (e.g., "YYYY-MM-DD").
|
15
|
+
* @returns A short date string.
|
16
|
+
*
|
17
|
+
* @method diffDays
|
18
|
+
* Calculates the difference in whole days between the current date instance and another date.
|
19
|
+
* @param otherDate - The date to compare with.
|
20
|
+
* @returns The number of days difference as an integer.
|
21
|
+
*/
|
22
|
+
declare global {
|
23
|
+
interface Date {
|
24
|
+
addDays(days: number): Date;
|
25
|
+
isWeekend(): boolean;
|
26
|
+
toShortDateString(): string;
|
27
|
+
diffDays(otherDate: Date): number;
|
28
|
+
addHours(hours: number): Date;
|
29
|
+
addMinutes(minutes: number): Date;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
export {};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
export {};
|
2
|
+
/**
|
3
|
+
* Extends the global `Object` interface with utility methods.
|
4
|
+
*
|
5
|
+
* @method hasValue
|
6
|
+
* Determines if the object has a meaningful value (implementation-specific).
|
7
|
+
* @returns {boolean} `true` if the object has a value, otherwise `false`.
|
8
|
+
*
|
9
|
+
* @method isEmpty
|
10
|
+
* Checks if the object is considered empty (implementation-specific).
|
11
|
+
* @returns {boolean} `true` if the object is empty, otherwise `false`.
|
12
|
+
*
|
13
|
+
* @method isNumeric
|
14
|
+
* Determines if the object represents a numeric value.
|
15
|
+
* @returns {boolean} `true` if the object is numeric, otherwise `false`.
|
16
|
+
*/
|
17
|
+
declare global {
|
18
|
+
interface Object {
|
19
|
+
hasValue(): boolean;
|
20
|
+
isEmpty(): boolean;
|
21
|
+
isNumeric(): boolean;
|
22
|
+
}
|
23
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/math.d.ts
ADDED
package/dist/string.d.ts
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
export {};
|
2
|
+
/**
|
3
|
+
* Extends the global `String` interface with utility methods.
|
4
|
+
*
|
5
|
+
* @remarks
|
6
|
+
* These methods provide convenient ways to check for null or empty strings,
|
7
|
+
* and to pad strings to a desired length from the left or right.
|
8
|
+
*
|
9
|
+
* @method
|
10
|
+
* isNullOrEmpty
|
11
|
+
* Checks whether the string is `null`, `undefined`, or an empty string.
|
12
|
+
* @returns `true` if the string is `null`, `undefined`, or empty; otherwise, `false`.
|
13
|
+
*
|
14
|
+
* @method
|
15
|
+
* padLeft
|
16
|
+
* Pads the current string on the left with the specified character until the resulting string reaches the given total length.
|
17
|
+
* @param totalLength - The desired total length of the resulting string.
|
18
|
+
* @param padChar - The character to use for padding.
|
19
|
+
* @returns The padded string.
|
20
|
+
*
|
21
|
+
* @method
|
22
|
+
* padRight
|
23
|
+
* Pads the current string on the right with the specified character until the resulting string reaches the given total length.
|
24
|
+
* @param totalLength - The desired total length of the resulting string.
|
25
|
+
* @param padChar - The character to use for padding.
|
26
|
+
* @returns The padded string.
|
27
|
+
*/
|
28
|
+
declare global {
|
29
|
+
interface String {
|
30
|
+
isNullOrEmpty(): boolean;
|
31
|
+
padLeft(totalLength: number, padChar: string): string;
|
32
|
+
padRight(totalLength: number, padChar: string): string;
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
const a0_0x197603=a0_0x2a6a;(function(_0x6abaca,_0x576e4e){const _0x1cb87d=a0_0x2a6a,_0x4e0390=_0x6abaca();while(!![]){try{const _0x19f11e=parseInt(_0x1cb87d(0xaf))/0x1+parseInt(_0x1cb87d(0xb0))/0x2*(parseInt(_0x1cb87d(0xb2))/0x3)+-parseInt(_0x1cb87d(0xae))/0x4*(parseInt(_0x1cb87d(0xb6))/0x5)+parseInt(_0x1cb87d(0xa4))/0x6+-parseInt(_0x1cb87d(0xac))/0x7*(parseInt(_0x1cb87d(0xab))/0x8)+parseInt(_0x1cb87d(0xb3))/0x9*(-parseInt(_0x1cb87d(0xb7))/0xa)+parseInt(_0x1cb87d(0xb5))/0xb*(parseInt(_0x1cb87d(0xa9))/0xc);if(_0x19f11e===_0x576e4e)break;else _0x4e0390['push'](_0x4e0390['shift']());}catch(_0x18a35f){_0x4e0390['push'](_0x4e0390['shift']());}}}(a0_0x2a51,0x419fd));!Array[a0_0x197603(0xa7)]['firstOrDefault']&&(Array[a0_0x197603(0xa7)][a0_0x197603(0xb1)]=function(_0x170ee5){const _0x4e4fe3=a0_0x197603;if(!Array[_0x4e4fe3(0xa6)](this))return undefined;return _0x170ee5?this[_0x4e4fe3(0xa5)](_0x170ee5):this[0x0];});!Array[a0_0x197603(0xa7)][a0_0x197603(0xad)]&&(Array['prototype'][a0_0x197603(0xad)]=function(_0x389e08){const _0x3c2e1b=a0_0x197603,_0xe7ff5b=Object['create'](null);for(let _0x44dc9f=0x0,_0x3dcd2a=this['length'];_0x44dc9f<_0x3dcd2a;++_0x44dc9f){const _0x619186=this[_0x44dc9f],_0x359d22=_0x389e08(_0x619186);!_0xe7ff5b[_0x359d22]?_0xe7ff5b[_0x359d22]=[_0x619186]:_0xe7ff5b[_0x359d22][_0x3c2e1b(0xb4)](_0x619186);}return _0xe7ff5b;});!Array['prototype'][a0_0x197603(0xaa)]&&(Array['prototype']['sum']=function(){const _0x279ac9=a0_0x197603;if(!Array[_0x279ac9(0xa6)](this)||this['length']===0x0)return undefined;let _0x456f06=0x0;for(let _0x52c55c=0x0,_0x107442=this['length'];_0x52c55c<_0x107442;++_0x52c55c){_0x456f06+=this[_0x52c55c];}return _0x456f06;});function a0_0x2a6a(_0x307cfe,_0x42d664){const _0x2a51f7=a0_0x2a51();return a0_0x2a6a=function(_0x2a6af1,_0x1ca687){_0x2a6af1=_0x2a6af1-0xa4;let _0x1f07b1=_0x2a51f7[_0x2a6af1];return _0x1f07b1;},a0_0x2a6a(_0x307cfe,_0x42d664);}!Array['prototype']['average']&&(Array[a0_0x197603(0xa7)][a0_0x197603(0xb8)]=function(){const _0x46c459=a0_0x197603;if(!Array['isArray'](this)||this['length']===0x0)return undefined;let _0x7bea8b=0x0;for(let _0x24339f=0x0,_0x57d188=this[_0x46c459(0xa8)];_0x24339f<_0x57d188;++_0x24339f){_0x7bea8b+=this[_0x24339f];}return _0x7bea8b/this[_0x46c459(0xa8)];});function a0_0x2a51(){const _0x2745c4=['sum','190568OnxRsK','14KbqSQz','groupBy','4gojUNN','305187FcNwxO','178jGNYgG','firstOrDefault','4287ohAUql','2247354LXufqA','push','44231YwWvvR','2414135PqQoXw','20SSOyVW','average','2616378EnbqGq','find','isArray','prototype','length','1284YepsDm'];a0_0x2a51=function(){return _0x2745c4;};return a0_0x2a51();}export{};
|
@@ -0,0 +1 @@
|
|
1
|
+
function a1_0x211f(){const _0x57397f=['3063060ttUhoy','defineProperty','getFullYear','2388CtxXQn','13327SDeoxN','getDay','floor','getTime','valueOf','8cBvrjl','5836HGQKDO','8532655lpPXPf','getDate','isWeekend','slice','134DNzOpV','addHours','getMonth','10542940UmGvFs','142667DNziQS','addMinutes','addDays','4462047IRFKfG','prototype','diffDays','222saQgzl'];a1_0x211f=function(){return _0x57397f;};return a1_0x211f();}const a1_0x2a6e13=a1_0x5ab3;(function(_0x3b4d46,_0xc114ba){const _0x513360=a1_0x5ab3,_0x2df49c=_0x3b4d46();while(!![]){try{const _0x5a3255=-parseInt(_0x513360(0xee))/0x1*(parseInt(_0x513360(0xdf))/0x2)+parseInt(_0x513360(0xed))/0x3*(parseInt(_0x513360(0xda))/0x4)+parseInt(_0x513360(0xdb))/0x5+parseInt(_0x513360(0xe9))/0x6*(parseInt(_0x513360(0xe3))/0x7)+-parseInt(_0x513360(0xf3))/0x8*(parseInt(_0x513360(0xe6))/0x9)+-parseInt(_0x513360(0xe2))/0xa+-parseInt(_0x513360(0xea))/0xb;if(_0x5a3255===_0xc114ba)break;else _0x2df49c['push'](_0x2df49c['shift']());}catch(_0x1ed1fa){_0x2df49c['push'](_0x2df49c['shift']());}}}(a1_0x211f,0xdbdc2));!Date[a1_0x2a6e13(0xe7)]['addDays']&&Object[a1_0x2a6e13(0xeb)](Date[a1_0x2a6e13(0xe7)],a1_0x2a6e13(0xe5),{'value':function(_0x70fb09){const _0x5df1c9=a1_0x2a6e13,_0x5a61d8=new Date(this[_0x5df1c9(0xf2)]());return _0x5a61d8['setDate'](_0x5a61d8['getDate']()+_0x70fb09),_0x5a61d8;},'enumerable':![]});!Date[a1_0x2a6e13(0xe7)][a1_0x2a6e13(0xdd)]&&Object[a1_0x2a6e13(0xeb)](Date[a1_0x2a6e13(0xe7)],a1_0x2a6e13(0xdd),{'value':function(){const _0x3483e1=a1_0x2a6e13,_0x43347b=this[_0x3483e1(0xef)]();return _0x43347b===0x0||_0x43347b===0x6;},'enumerable':![]});!Date['prototype']['toShortDateString']&&Object[a1_0x2a6e13(0xeb)](Date[a1_0x2a6e13(0xe7)],'toShortDateString',{'value':function(){const _0x42ae49=a1_0x2a6e13;return this['toISOString']()[_0x42ae49(0xde)](0x0,0xa);},'enumerable':![]});function a1_0x5ab3(_0x141b62,_0xf9c2a5){const _0x211fa3=a1_0x211f();return a1_0x5ab3=function(_0x5ab32e,_0x4d9b9c){_0x5ab32e=_0x5ab32e-0xda;let _0x284227=_0x211fa3[_0x5ab32e];return _0x284227;},a1_0x5ab3(_0x141b62,_0xf9c2a5);}Date['prototype'][a1_0x2a6e13(0xe8)]=function(_0x5d7ea3){const _0x4b9b7a=a1_0x2a6e13,_0x13d806=Date['UTC'](this[_0x4b9b7a(0xec)](),this['getMonth'](),this['getDate']()),_0x30cb9c=Date['UTC'](_0x5d7ea3[_0x4b9b7a(0xec)](),_0x5d7ea3[_0x4b9b7a(0xe1)](),_0x5d7ea3[_0x4b9b7a(0xdc)]());return Math[_0x4b9b7a(0xf0)]((_0x30cb9c-_0x13d806)/0x5265c00);},Date[a1_0x2a6e13(0xe7)][a1_0x2a6e13(0xe0)]=function(_0x12d04f){const _0x49384d=a1_0x2a6e13;return new Date(this[_0x49384d(0xf1)]()+_0x12d04f*0x36ee80);},Date['prototype'][a1_0x2a6e13(0xe4)]=function(_0x273c2e){const _0x643319=a1_0x2a6e13;return new Date(this[_0x643319(0xf1)]()+_0x273c2e*0xea60);};export{};
|
@@ -0,0 +1 @@
|
|
1
|
+
const a2_0x5014d0=a2_0x2f5d;(function(_0x5e5af3,_0x4e6214){const _0xb173c6=a2_0x2f5d,_0x24fbfc=_0x5e5af3();while(!![]){try{const _0x3b4025=-parseInt(_0xb173c6(0x1a2))/0x1*(parseInt(_0xb173c6(0x1a3))/0x2)+parseInt(_0xb173c6(0x1a4))/0x3+parseInt(_0xb173c6(0x1a9))/0x4*(-parseInt(_0xb173c6(0x1ab))/0x5)+-parseInt(_0xb173c6(0x1ac))/0x6*(parseInt(_0xb173c6(0x1b2))/0x7)+parseInt(_0xb173c6(0x1a6))/0x8*(-parseInt(_0xb173c6(0x1ae))/0x9)+parseInt(_0xb173c6(0x1b3))/0xa+-parseInt(_0xb173c6(0x1a5))/0xb*(-parseInt(_0xb173c6(0x1a7))/0xc);if(_0x3b4025===_0x4e6214)break;else _0x24fbfc['push'](_0x24fbfc['shift']());}catch(_0x482e0c){_0x24fbfc['push'](_0x24fbfc['shift']());}}}(a2_0x43ed,0x9aef6));!Object['prototype']['hasValue']&&Object[a2_0x5014d0(0x1b4)](Object[a2_0x5014d0(0x1b1)],a2_0x5014d0(0x1ad),{'value':function(){return this!=null;},'enumerable':![]});!Object[a2_0x5014d0(0x1b1)][a2_0x5014d0(0x1aa)]&&Object['defineProperty'](Object[a2_0x5014d0(0x1b1)],'isEmpty',{'value':function(){const _0x556136=a2_0x5014d0;if(this==null)return!![];if(typeof this==='string'||Array[_0x556136(0x1af)](this))return this[_0x556136(0x1b5)]===0x0;if(typeof this==='object')return Object['keys'](this)['length']===0x0;return![];},'enumerable':![]});!Object['prototype'][a2_0x5014d0(0x1b0)]&&Object['defineProperty'](Object[a2_0x5014d0(0x1b1)],a2_0x5014d0(0x1b0),{'value':function(){const _0x114a6c=a2_0x5014d0,_0x272ffe=+this;return typeof _0x272ffe===_0x114a6c(0x1a8)&&!isNaN(_0x272ffe)&&isFinite(_0x272ffe);},'enumerable':![]});function a2_0x43ed(){const _0x44fdf0=['isEmpty','2699260IPTyks','6UKuEbF','hasValue','9055089JRyiii','isArray','isNumeric','prototype','2619407omXAfy','3964380XHwwKh','defineProperty','length','22309cgXQCF','112fQOMCT','2809503rwPlWX','33121055tWLFyT','8RJOoSG','12tFLUcW','number','8etROFl'];a2_0x43ed=function(){return _0x44fdf0;};return a2_0x43ed();}function a2_0x2f5d(_0x2e7481,_0x9ae40){const _0x43ede6=a2_0x43ed();return a2_0x2f5d=function(_0x2f5d26,_0x1477f8){_0x2f5d26=_0x2f5d26-0x1a2;let _0x303d4d=_0x43ede6[_0x2f5d26];return _0x303d4d;},a2_0x2f5d(_0x2e7481,_0x9ae40);}export{};
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(_0xf8012c,_0x3e59ce){var _0x377d2a=a3_0xcd71,_0x2f50d4=_0xf8012c();while(!![]){try{var _0x3c1d52=-parseInt(_0x377d2a(0x8f))/0x1+parseInt(_0x377d2a(0x8d))/0x2*(-parseInt(_0x377d2a(0x89))/0x3)+parseInt(_0x377d2a(0x90))/0x4+-parseInt(_0x377d2a(0x91))/0x5*(parseInt(_0x377d2a(0x8c))/0x6)+-parseInt(_0x377d2a(0x8a))/0x7*(parseInt(_0x377d2a(0x88))/0x8)+-parseInt(_0x377d2a(0x8b))/0x9+parseInt(_0x377d2a(0x8e))/0xa*(parseInt(_0x377d2a(0x87))/0xb);if(_0x3c1d52===_0x3e59ce)break;else _0x2f50d4['push'](_0x2f50d4['shift']());}catch(_0xcfe50c){_0x2f50d4['push'](_0x2f50d4['shift']());}}}(a3_0x76c8,0x899ba));function a3_0xcd71(_0x27ea13,_0x4ddd5a){var _0x76c835=a3_0x76c8();return a3_0xcd71=function(_0xcd71a8,_0x2726c7){_0xcd71a8=_0xcd71a8-0x87;var _0x59b720=_0x76c835[_0xcd71a8];return _0x59b720;},a3_0xcd71(_0x27ea13,_0x4ddd5a);}import'./extensions';function a3_0x76c8(){var _0x37f89b=['143559IAKOUM','1543026DuwbiI','514vIPxKq','18557740omxCgK','771325VDVLpL','283952vSHCqX','5CWAoTy','11tNtsJZ','16gxBESH','1107QpdWKX','783440ivEWLA'];a3_0x76c8=function(){return _0x37f89b;};return a3_0x76c8();}export*from'./math';export*from'./collection';export*from'./string';export*from'./datetime';
|
package/dist-obf/math.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const a4_0x15b6a6=a4_0x4b2d;(function(_0x5cc534,_0x22d776){const _0x17548a=a4_0x4b2d,_0x20a805=_0x5cc534();while(!![]){try{const _0x9ff2a4=-parseInt(_0x17548a(0x18d))/0x1+-parseInt(_0x17548a(0x18c))/0x2*(-parseInt(_0x17548a(0x192))/0x3)+-parseInt(_0x17548a(0x186))/0x4+-parseInt(_0x17548a(0x193))/0x5+parseInt(_0x17548a(0x190))/0x6+-parseInt(_0x17548a(0x18b))/0x7*(parseInt(_0x17548a(0x18e))/0x8)+parseInt(_0x17548a(0x188))/0x9;if(_0x9ff2a4===_0x22d776)break;else _0x20a805['push'](_0x20a805['shift']());}catch(_0x192d32){_0x20a805['push'](_0x20a805['shift']());}}}(a4_0x1cfb,0x8110d));!Number[a4_0x15b6a6(0x185)][a4_0x15b6a6(0x18f)]&&(Number['prototype']['isEven']=function(){return(this['valueOf']()&0x1)===0x0;});!Number['prototype'][a4_0x15b6a6(0x191)]&&(Number[a4_0x15b6a6(0x185)]['isOdd']=function(){const _0xec5473=a4_0x15b6a6;return(this[_0xec5473(0x184)]()&0x1)===0x1;});function a4_0x4b2d(_0x4b117e,_0x2376e3){const _0x1cfbdf=a4_0x1cfb();return a4_0x4b2d=function(_0x4b2dd4,_0x3e91a9){_0x4b2dd4=_0x4b2dd4-0x184;let _0x405c85=_0x1cfbdf[_0x4b2dd4];return _0x405c85;},a4_0x4b2d(_0x4b117e,_0x2376e3);}!Number['prototype']['sqrt']&&(Number['prototype'][a4_0x15b6a6(0x189)]=function(){const _0x50ef42=a4_0x15b6a6;return Math[_0x50ef42(0x189)](this['valueOf']());});function a4_0x1cfb(){const _0x357fa5=['valueOf','prototype','800824peWJPJ','EPSILON','8909397nqzyVW','sqrt','pow','124082JyCPAc','62898MvKLsj','102535lzbicq','440oCSpnh','isEven','991872BOKeQz','isOdd','87VTjaPZ','1304710AhpkCm','round'];a4_0x1cfb=function(){return _0x357fa5;};return a4_0x1cfb();}!Number[a4_0x15b6a6(0x185)][a4_0x15b6a6(0x194)]&&(Number[a4_0x15b6a6(0x185)]['round']=function(_0x262e61=0x0){const _0x1ef420=a4_0x15b6a6,_0x2e6060=Math[_0x1ef420(0x18a)](0xa,_0x262e61);return Math['round']((this['valueOf']()+Number[_0x1ef420(0x187)])*_0x2e6060)/_0x2e6060;});export{};
|
@@ -0,0 +1 @@
|
|
1
|
+
const a5_0x391f53=a5_0x36a1;function a5_0x36a1(_0x21aa92,_0x849777){const _0x1c66ab=a5_0x1c66();return a5_0x36a1=function(_0x36a13f,_0x4da61f){_0x36a13f=_0x36a13f-0x1a6;let _0x1a29df=_0x1c66ab[_0x36a13f];return _0x1a29df;},a5_0x36a1(_0x21aa92,_0x849777);}(function(_0x409785,_0x5cf778){const _0x1b639c=a5_0x36a1,_0x10ca48=_0x409785();while(!![]){try{const _0x4c2e25=parseInt(_0x1b639c(0x1a7))/0x1*(parseInt(_0x1b639c(0x1a6))/0x2)+-parseInt(_0x1b639c(0x1b3))/0x3*(-parseInt(_0x1b639c(0x1a9))/0x4)+-parseInt(_0x1b639c(0x1ab))/0x5+-parseInt(_0x1b639c(0x1b2))/0x6+parseInt(_0x1b639c(0x1b0))/0x7+parseInt(_0x1b639c(0x1ac))/0x8*(parseInt(_0x1b639c(0x1aa))/0x9)+parseInt(_0x1b639c(0x1ad))/0xa*(parseInt(_0x1b639c(0x1ae))/0xb);if(_0x4c2e25===_0x5cf778)break;else _0x10ca48['push'](_0x10ca48['shift']());}catch(_0x58a835){_0x10ca48['push'](_0x10ca48['shift']());}}}(a5_0x1c66,0x19c23),String[a5_0x391f53(0x1af)][a5_0x391f53(0x1b1)]=function(){return this['length']===0x0;},String['prototype']['padLeft']=function(_0x2ed76e,_0x568992){const _0x2fc58b=a5_0x391f53,_0x336d8a=String(this),_0x3aba4a=_0x2ed76e-_0x336d8a['length'];if(_0x3aba4a<=0x0)return _0x336d8a;if(!_0x568992||_0x568992['length']===0x0)_0x568992='\x20';let _0x1ad866='';if(_0x568992['length']===0x1)_0x1ad866=new Array(_0x3aba4a+0x1)[_0x2fc58b(0x1a8)](_0x568992);else{while(_0x1ad866[_0x2fc58b(0x1b4)]<_0x3aba4a){_0x1ad866+=_0x568992;}_0x1ad866=_0x1ad866['slice'](0x0,_0x3aba4a);}return _0x1ad866+_0x336d8a;},String['prototype']['padRight']=function(_0x27380e,_0x54f588){const _0x44374a=a5_0x391f53,_0x566b9f=String(this),_0x24c17f=_0x27380e-_0x566b9f['length'];if(_0x24c17f<=0x0)return _0x566b9f;if(!_0x54f588||_0x54f588[_0x44374a(0x1b4)]===0x0)_0x54f588='\x20';let _0x3e6b8f='';if(_0x54f588['length']===0x1)_0x3e6b8f=new Array(_0x24c17f+0x1)['join'](_0x54f588);else{while(_0x3e6b8f[_0x44374a(0x1b4)]<_0x24c17f){_0x3e6b8f+=_0x54f588;}_0x3e6b8f=_0x3e6b8f['slice'](0x0,_0x24c17f);}return _0x566b9f+_0x3e6b8f;});function a5_0x1c66(){const _0x4e119d=['join','70624HNxwkF','3609zdcSUu','439495pQRyCF','2032tUwhVu','23150UIITnG','132HHCIfB','prototype','1006600zPlcXq','isNullOrEmpty','724764jeIVHP','3yJMFYa','length','9244TSzpPj','5jIpYVq'];a5_0x1c66=function(){return _0x4e119d;};return a5_0x1c66();}export{};
|
package/package.json
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
{
|
2
|
+
"name": "@agogte/utilynx",
|
3
|
+
"version": "1.0.7",
|
4
|
+
"type": "module",
|
5
|
+
"description": "High-level utility functions for working with arrays, math, strings, and more — bringing expressive language features to JavaScript and TypeScript.",
|
6
|
+
"main": "dist-obf/index.js",
|
7
|
+
"types": "dist/index.d.ts",
|
8
|
+
"scripts": {
|
9
|
+
"clean": "rm -rf dist dist-obf",
|
10
|
+
"build": "tsc",
|
11
|
+
"obfuscate": "javascript-obfuscator dist --output dist-obf --config obfuscator-config.json",
|
12
|
+
"strip-dist-js": "find dist -type f -name '*.js' -delete",
|
13
|
+
"build:prod": "npm run clean && npm run build && npm run obfuscate && npm run strip-dist-js",
|
14
|
+
"prepublishOnly": "npm run build:prod"
|
15
|
+
},
|
16
|
+
"files": [
|
17
|
+
"dist",
|
18
|
+
"dist-obf"
|
19
|
+
],
|
20
|
+
"keywords": [
|
21
|
+
"typescript",
|
22
|
+
"javascript",
|
23
|
+
"utilities",
|
24
|
+
"math",
|
25
|
+
"string",
|
26
|
+
"array",
|
27
|
+
"linq",
|
28
|
+
"functional"
|
29
|
+
],
|
30
|
+
"author": "Advait Gogte",
|
31
|
+
"license": "Commercial",
|
32
|
+
"devDependencies": {
|
33
|
+
"@types/jest": "^30.0.0",
|
34
|
+
"javascript-obfuscator": "^4.1.1",
|
35
|
+
"terser": "^5.43.1",
|
36
|
+
"ts-jest": "^29.4.0",
|
37
|
+
"typescript": "^5.8.3",
|
38
|
+
"jest": "^29.7.0"
|
39
|
+
}
|
40
|
+
}
|