@gjsify/util 0.3.13 → 0.3.14

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.
@@ -1,3 +1,4 @@
1
+ //#region src/types/index.ts
1
2
  const _toString = Object.prototype.toString;
2
3
  const _bigIntValueOf = BigInt.prototype.valueOf;
3
4
  const _booleanValueOf = Boolean.prototype.valueOf;
@@ -7,294 +8,246 @@ const _stringValueOf = String.prototype.valueOf;
7
8
  const _symbolValueOf = Symbol.prototype.valueOf;
8
9
  const _weakMapHas = WeakMap.prototype.has;
9
10
  const _weakSetHas = WeakSet.prototype.has;
10
- const _getArrayBufferByteLength = Object.getOwnPropertyDescriptor(
11
- ArrayBuffer.prototype,
12
- "byteLength"
13
- ).get;
14
- const _getSharedArrayBufferByteLength = typeof SharedArrayBuffer !== "undefined" ? Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get : void 0;
15
- const _getTypedArrayToStringTag = Object.getOwnPropertyDescriptor(
16
- Object.getPrototypeOf(Uint8Array).prototype,
17
- Symbol.toStringTag
18
- ).get;
11
+ const _getArrayBufferByteLength = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
12
+ const _getSharedArrayBufferByteLength = typeof SharedArrayBuffer !== "undefined" ? Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength").get : undefined;
13
+ const _getTypedArrayToStringTag = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array).prototype, Symbol.toStringTag).get;
19
14
  const _getSetSize = Object.getOwnPropertyDescriptor(Set.prototype, "size").get;
20
15
  const _getMapSize = Object.getOwnPropertyDescriptor(Map.prototype, "size").get;
21
16
  function isObjectLike(value) {
22
- return value !== null && typeof value === "object";
17
+ return value !== null && typeof value === "object";
23
18
  }
24
19
  function isAnyArrayBuffer(value) {
25
- return isArrayBuffer(value) || isSharedArrayBuffer(value);
20
+ return isArrayBuffer(value) || isSharedArrayBuffer(value);
26
21
  }
27
22
  function isArrayBuffer(value) {
28
- try {
29
- _getArrayBufferByteLength.call(value);
30
- return true;
31
- } catch {
32
- return false;
33
- }
23
+ try {
24
+ _getArrayBufferByteLength.call(value);
25
+ return true;
26
+ } catch {
27
+ return false;
28
+ }
34
29
  }
35
30
  function isSharedArrayBuffer(value) {
36
- if (_getSharedArrayBufferByteLength === void 0) return false;
37
- try {
38
- _getSharedArrayBufferByteLength.call(value);
39
- return true;
40
- } catch {
41
- return false;
42
- }
31
+ if (_getSharedArrayBufferByteLength === undefined) return false;
32
+ try {
33
+ _getSharedArrayBufferByteLength.call(value);
34
+ return true;
35
+ } catch {
36
+ return false;
37
+ }
43
38
  }
44
39
  function isArrayBufferView(value) {
45
- return ArrayBuffer.isView(value);
40
+ return ArrayBuffer.isView(value);
46
41
  }
47
42
  function isTypedArray(value) {
48
- return _getTypedArrayToStringTag.call(value) !== void 0;
43
+ return _getTypedArrayToStringTag.call(value) !== undefined;
49
44
  }
50
45
  function isUint8Array(value) {
51
- return _getTypedArrayToStringTag.call(value) === "Uint8Array";
46
+ return _getTypedArrayToStringTag.call(value) === "Uint8Array";
52
47
  }
53
48
  function isUint8ClampedArray(value) {
54
- return _getTypedArrayToStringTag.call(value) === "Uint8ClampedArray";
49
+ return _getTypedArrayToStringTag.call(value) === "Uint8ClampedArray";
55
50
  }
56
51
  function isUint16Array(value) {
57
- return _getTypedArrayToStringTag.call(value) === "Uint16Array";
52
+ return _getTypedArrayToStringTag.call(value) === "Uint16Array";
58
53
  }
59
54
  function isUint32Array(value) {
60
- return _getTypedArrayToStringTag.call(value) === "Uint32Array";
55
+ return _getTypedArrayToStringTag.call(value) === "Uint32Array";
61
56
  }
62
57
  function isInt8Array(value) {
63
- return _getTypedArrayToStringTag.call(value) === "Int8Array";
58
+ return _getTypedArrayToStringTag.call(value) === "Int8Array";
64
59
  }
65
60
  function isInt16Array(value) {
66
- return _getTypedArrayToStringTag.call(value) === "Int16Array";
61
+ return _getTypedArrayToStringTag.call(value) === "Int16Array";
67
62
  }
68
63
  function isInt32Array(value) {
69
- return _getTypedArrayToStringTag.call(value) === "Int32Array";
64
+ return _getTypedArrayToStringTag.call(value) === "Int32Array";
70
65
  }
71
66
  function isFloat32Array(value) {
72
- return _getTypedArrayToStringTag.call(value) === "Float32Array";
67
+ return _getTypedArrayToStringTag.call(value) === "Float32Array";
73
68
  }
74
69
  function isFloat64Array(value) {
75
- return _getTypedArrayToStringTag.call(value) === "Float64Array";
70
+ return _getTypedArrayToStringTag.call(value) === "Float64Array";
76
71
  }
77
72
  function isBigInt64Array(value) {
78
- return _getTypedArrayToStringTag.call(value) === "BigInt64Array";
73
+ return _getTypedArrayToStringTag.call(value) === "BigInt64Array";
79
74
  }
80
75
  function isBigUint64Array(value) {
81
- return _getTypedArrayToStringTag.call(value) === "BigUint64Array";
76
+ return _getTypedArrayToStringTag.call(value) === "BigUint64Array";
82
77
  }
83
78
  function isDataView(value) {
84
- return ArrayBuffer.isView(value) && _getTypedArrayToStringTag.call(value) === void 0;
79
+ return ArrayBuffer.isView(value) && _getTypedArrayToStringTag.call(value) === undefined;
85
80
  }
86
81
  function isMap(value) {
87
- try {
88
- _getMapSize.call(value);
89
- return true;
90
- } catch {
91
- return false;
92
- }
82
+ try {
83
+ _getMapSize.call(value);
84
+ return true;
85
+ } catch {
86
+ return false;
87
+ }
93
88
  }
94
89
  function isSet(value) {
95
- try {
96
- _getSetSize.call(value);
97
- return true;
98
- } catch {
99
- return false;
100
- }
90
+ try {
91
+ _getSetSize.call(value);
92
+ return true;
93
+ } catch {
94
+ return false;
95
+ }
101
96
  }
102
97
  function isWeakMap(value) {
103
- try {
104
- _weakMapHas.call(value, null);
105
- return true;
106
- } catch {
107
- return false;
108
- }
98
+ try {
99
+ _weakMapHas.call(value, null);
100
+ return true;
101
+ } catch {
102
+ return false;
103
+ }
109
104
  }
110
105
  function isWeakSet(value) {
111
- try {
112
- _weakSetHas.call(value, null);
113
- return true;
114
- } catch {
115
- return false;
116
- }
106
+ try {
107
+ _weakSetHas.call(value, null);
108
+ return true;
109
+ } catch {
110
+ return false;
111
+ }
117
112
  }
118
113
  function isMapIterator(value) {
119
- return isObjectLike(value) && value[Symbol.toStringTag] === "Map Iterator";
114
+ return isObjectLike(value) && value[Symbol.toStringTag] === "Map Iterator";
120
115
  }
121
116
  function isSetIterator(value) {
122
- return isObjectLike(value) && value[Symbol.toStringTag] === "Set Iterator";
117
+ return isObjectLike(value) && value[Symbol.toStringTag] === "Set Iterator";
123
118
  }
124
119
  function isDate(value) {
125
- try {
126
- _dateValueOf.call(value);
127
- return true;
128
- } catch {
129
- return false;
130
- }
120
+ try {
121
+ _dateValueOf.call(value);
122
+ return true;
123
+ } catch {
124
+ return false;
125
+ }
131
126
  }
132
127
  function isRegExp(value) {
133
- return isObjectLike(value) && value[Symbol.toStringTag] === void 0 && _toString.call(value) === "[object RegExp]";
128
+ return isObjectLike(value) && value[Symbol.toStringTag] === undefined && _toString.call(value) === "[object RegExp]";
134
129
  }
135
130
  function isNativeError(value) {
136
- return isObjectLike(value) && value[Symbol.toStringTag] === void 0 && _toString.call(value) === "[object Error]";
131
+ return isObjectLike(value) && value[Symbol.toStringTag] === undefined && _toString.call(value) === "[object Error]";
137
132
  }
138
133
  function isAsyncFunction(value) {
139
- return typeof value === "function" && value[Symbol.toStringTag] === "AsyncFunction";
134
+ return typeof value === "function" && value[Symbol.toStringTag] === "AsyncFunction";
140
135
  }
141
136
  function isGeneratorFunction(value) {
142
- return typeof value === "function" && value[Symbol.toStringTag] === "GeneratorFunction";
137
+ return typeof value === "function" && value[Symbol.toStringTag] === "GeneratorFunction";
143
138
  }
144
139
  function isGeneratorObject(value) {
145
- return isObjectLike(value) && value[Symbol.toStringTag] === "Generator";
140
+ return isObjectLike(value) && value[Symbol.toStringTag] === "Generator";
146
141
  }
147
142
  function isPromise(value) {
148
- return isObjectLike(value) && value[Symbol.toStringTag] === "Promise";
143
+ return isObjectLike(value) && value[Symbol.toStringTag] === "Promise";
149
144
  }
150
145
  function isBooleanObject(value) {
151
- if (!isObjectLike(value)) return false;
152
- try {
153
- _booleanValueOf.call(value);
154
- return true;
155
- } catch {
156
- return false;
157
- }
146
+ if (!isObjectLike(value)) return false;
147
+ try {
148
+ _booleanValueOf.call(value);
149
+ return true;
150
+ } catch {
151
+ return false;
152
+ }
158
153
  }
159
154
  function isNumberObject(value) {
160
- if (!isObjectLike(value)) return false;
161
- try {
162
- _numberValueOf.call(value);
163
- return true;
164
- } catch {
165
- return false;
166
- }
155
+ if (!isObjectLike(value)) return false;
156
+ try {
157
+ _numberValueOf.call(value);
158
+ return true;
159
+ } catch {
160
+ return false;
161
+ }
167
162
  }
168
163
  function isStringObject(value) {
169
- if (!isObjectLike(value)) return false;
170
- try {
171
- _stringValueOf.call(value);
172
- return true;
173
- } catch {
174
- return false;
175
- }
164
+ if (!isObjectLike(value)) return false;
165
+ try {
166
+ _stringValueOf.call(value);
167
+ return true;
168
+ } catch {
169
+ return false;
170
+ }
176
171
  }
177
172
  function isSymbolObject(value) {
178
- if (!isObjectLike(value)) return false;
179
- try {
180
- _symbolValueOf.call(value);
181
- return true;
182
- } catch {
183
- return false;
184
- }
173
+ if (!isObjectLike(value)) return false;
174
+ try {
175
+ _symbolValueOf.call(value);
176
+ return true;
177
+ } catch {
178
+ return false;
179
+ }
185
180
  }
186
181
  function isBigIntObject(value) {
187
- if (!isObjectLike(value)) return false;
188
- try {
189
- _bigIntValueOf.call(value);
190
- return true;
191
- } catch {
192
- return false;
193
- }
182
+ if (!isObjectLike(value)) return false;
183
+ try {
184
+ _bigIntValueOf.call(value);
185
+ return true;
186
+ } catch {
187
+ return false;
188
+ }
194
189
  }
195
190
  function isBoxedPrimitive(value) {
196
- return isBooleanObject(value) || isStringObject(value) || isNumberObject(value) || isSymbolObject(value) || isBigIntObject(value);
191
+ return isBooleanObject(value) || isStringObject(value) || isNumberObject(value) || isSymbolObject(value) || isBigIntObject(value);
197
192
  }
198
193
  function isArgumentsObject(value) {
199
- return isObjectLike(value) && value[Symbol.toStringTag] === void 0 && _toString.call(value) === "[object Arguments]";
194
+ return isObjectLike(value) && value[Symbol.toStringTag] === undefined && _toString.call(value) === "[object Arguments]";
200
195
  }
201
196
  function isModuleNamespaceObject(value) {
202
- return isObjectLike(value) && value[Symbol.toStringTag] === "Module";
197
+ return isObjectLike(value) && value[Symbol.toStringTag] === "Module";
203
198
  }
204
199
  function isProxy(value) {
205
- return false;
200
+ return false;
206
201
  }
207
202
  function isCryptoKey(value) {
208
- return isObjectLike(value) && _toString.call(value) === "[object CryptoKey]";
203
+ return isObjectLike(value) && _toString.call(value) === "[object CryptoKey]";
209
204
  }
210
205
  function isKeyObject(value) {
211
- return false;
206
+ return false;
212
207
  }
213
208
  const types = {
214
- isAnyArrayBuffer,
215
- isArrayBuffer,
216
- isArrayBufferView,
217
- isArgumentsObject,
218
- isAsyncFunction,
219
- isBigInt64Array,
220
- isBigUint64Array,
221
- isBigIntObject,
222
- isBooleanObject,
223
- isBoxedPrimitive,
224
- isCryptoKey,
225
- isDataView,
226
- isDate,
227
- isFloat32Array,
228
- isFloat64Array,
229
- isGeneratorFunction,
230
- isGeneratorObject,
231
- isInt8Array,
232
- isInt16Array,
233
- isInt32Array,
234
- isKeyObject,
235
- isMap,
236
- isMapIterator,
237
- isModuleNamespaceObject,
238
- isNativeError,
239
- isNumberObject,
240
- isPromise,
241
- isProxy,
242
- isRegExp,
243
- isSet,
244
- isSetIterator,
245
- isSharedArrayBuffer,
246
- isStringObject,
247
- isSymbolObject,
248
- isTypedArray,
249
- isUint8Array,
250
- isUint8ClampedArray,
251
- isUint16Array,
252
- isUint32Array,
253
- isWeakMap,
254
- isWeakSet
255
- };
256
- var types_default = types;
257
- export {
258
- types_default as default,
259
- isAnyArrayBuffer,
260
- isArgumentsObject,
261
- isArrayBuffer,
262
- isArrayBufferView,
263
- isAsyncFunction,
264
- isBigInt64Array,
265
- isBigIntObject,
266
- isBigUint64Array,
267
- isBooleanObject,
268
- isBoxedPrimitive,
269
- isCryptoKey,
270
- isDataView,
271
- isDate,
272
- isFloat32Array,
273
- isFloat64Array,
274
- isGeneratorFunction,
275
- isGeneratorObject,
276
- isInt16Array,
277
- isInt32Array,
278
- isInt8Array,
279
- isKeyObject,
280
- isMap,
281
- isMapIterator,
282
- isModuleNamespaceObject,
283
- isNativeError,
284
- isNumberObject,
285
- isPromise,
286
- isProxy,
287
- isRegExp,
288
- isSet,
289
- isSetIterator,
290
- isSharedArrayBuffer,
291
- isStringObject,
292
- isSymbolObject,
293
- isTypedArray,
294
- isUint16Array,
295
- isUint32Array,
296
- isUint8Array,
297
- isUint8ClampedArray,
298
- isWeakMap,
299
- isWeakSet
209
+ isAnyArrayBuffer,
210
+ isArrayBuffer,
211
+ isArrayBufferView,
212
+ isArgumentsObject,
213
+ isAsyncFunction,
214
+ isBigInt64Array,
215
+ isBigUint64Array,
216
+ isBigIntObject,
217
+ isBooleanObject,
218
+ isBoxedPrimitive,
219
+ isCryptoKey,
220
+ isDataView,
221
+ isDate,
222
+ isFloat32Array,
223
+ isFloat64Array,
224
+ isGeneratorFunction,
225
+ isGeneratorObject,
226
+ isInt8Array,
227
+ isInt16Array,
228
+ isInt32Array,
229
+ isKeyObject,
230
+ isMap,
231
+ isMapIterator,
232
+ isModuleNamespaceObject,
233
+ isNativeError,
234
+ isNumberObject,
235
+ isPromise,
236
+ isProxy,
237
+ isRegExp,
238
+ isSet,
239
+ isSetIterator,
240
+ isSharedArrayBuffer,
241
+ isStringObject,
242
+ isSymbolObject,
243
+ isTypedArray,
244
+ isUint8Array,
245
+ isUint8ClampedArray,
246
+ isUint16Array,
247
+ isUint32Array,
248
+ isWeakMap,
249
+ isWeakSet
300
250
  };
251
+
252
+ //#endregion
253
+ export { types as default, isAnyArrayBuffer, isArgumentsObject, isArrayBuffer, isArrayBufferView, isAsyncFunction, isBigInt64Array, isBigIntObject, isBigUint64Array, isBooleanObject, isBoxedPrimitive, isCryptoKey, isDataView, isDate, isFloat32Array, isFloat64Array, isGeneratorFunction, isGeneratorObject, isInt16Array, isInt32Array, isInt8Array, isKeyObject, isMap, isMapIterator, isModuleNamespaceObject, isNativeError, isNumberObject, isPromise, isProxy, isRegExp, isSet, isSetIterator, isSharedArrayBuffer, isStringObject, isSymbolObject, isTypedArray, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isWeakMap, isWeakSet };
package/lib/esm/types.js CHANGED
@@ -1,6 +1,52 @@
1
- export * from "./types/index.js";
2
- import types from "./types/index.js";
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import types, { isAnyArrayBuffer, isArgumentsObject, isArrayBuffer, isArrayBufferView, isAsyncFunction, isBigInt64Array, isBigIntObject, isBigUint64Array, isBooleanObject, isBoxedPrimitive, isCryptoKey, isDataView, isDate, isFloat32Array, isFloat64Array, isGeneratorFunction, isGeneratorObject, isInt16Array, isInt32Array, isInt8Array, isKeyObject, isMap, isMapIterator, isModuleNamespaceObject, isNativeError, isNumberObject, isPromise, isProxy, isRegExp, isSet, isSetIterator, isSharedArrayBuffer, isStringObject, isSymbolObject, isTypedArray, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isWeakMap, isWeakSet } from "./types/index.js";
3
+
4
+ //#region src/types.ts
5
+ var types_exports = /* @__PURE__ */ __exportAll({
6
+ default: () => types_default,
7
+ isAnyArrayBuffer: () => isAnyArrayBuffer,
8
+ isArgumentsObject: () => isArgumentsObject,
9
+ isArrayBuffer: () => isArrayBuffer,
10
+ isArrayBufferView: () => isArrayBufferView,
11
+ isAsyncFunction: () => isAsyncFunction,
12
+ isBigInt64Array: () => isBigInt64Array,
13
+ isBigIntObject: () => isBigIntObject,
14
+ isBigUint64Array: () => isBigUint64Array,
15
+ isBooleanObject: () => isBooleanObject,
16
+ isBoxedPrimitive: () => isBoxedPrimitive,
17
+ isCryptoKey: () => isCryptoKey,
18
+ isDataView: () => isDataView,
19
+ isDate: () => isDate,
20
+ isFloat32Array: () => isFloat32Array,
21
+ isFloat64Array: () => isFloat64Array,
22
+ isGeneratorFunction: () => isGeneratorFunction,
23
+ isGeneratorObject: () => isGeneratorObject,
24
+ isInt16Array: () => isInt16Array,
25
+ isInt32Array: () => isInt32Array,
26
+ isInt8Array: () => isInt8Array,
27
+ isKeyObject: () => isKeyObject,
28
+ isMap: () => isMap,
29
+ isMapIterator: () => isMapIterator,
30
+ isModuleNamespaceObject: () => isModuleNamespaceObject,
31
+ isNativeError: () => isNativeError,
32
+ isNumberObject: () => isNumberObject,
33
+ isPromise: () => isPromise,
34
+ isProxy: () => isProxy,
35
+ isRegExp: () => isRegExp,
36
+ isSet: () => isSet,
37
+ isSetIterator: () => isSetIterator,
38
+ isSharedArrayBuffer: () => isSharedArrayBuffer,
39
+ isStringObject: () => isStringObject,
40
+ isSymbolObject: () => isSymbolObject,
41
+ isTypedArray: () => isTypedArray,
42
+ isUint16Array: () => isUint16Array,
43
+ isUint32Array: () => isUint32Array,
44
+ isUint8Array: () => isUint8Array,
45
+ isUint8ClampedArray: () => isUint8ClampedArray,
46
+ isWeakMap: () => isWeakMap,
47
+ isWeakSet: () => isWeakSet
48
+ });
3
49
  var types_default = types;
4
- export {
5
- types_default as default
6
- };
50
+
51
+ //#endregion
52
+ export { types_default as default, isAnyArrayBuffer, isArgumentsObject, isArrayBuffer, isArrayBufferView, isAsyncFunction, isBigInt64Array, isBigIntObject, isBigUint64Array, isBooleanObject, isBoxedPrimitive, isCryptoKey, isDataView, isDate, isFloat32Array, isFloat64Array, isGeneratorFunction, isGeneratorObject, isInt16Array, isInt32Array, isInt8Array, isKeyObject, isMap, isMapIterator, isModuleNamespaceObject, isNativeError, isNumberObject, isPromise, isProxy, isRegExp, isSet, isSetIterator, isSharedArrayBuffer, isStringObject, isSymbolObject, isTypedArray, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isWeakMap, isWeakSet, types_exports };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/util",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "Node.js util module for Gjs",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -34,8 +34,8 @@
34
34
  "util"
35
35
  ],
36
36
  "devDependencies": {
37
- "@gjsify/cli": "^0.3.13",
38
- "@gjsify/unit": "^0.3.13",
37
+ "@gjsify/cli": "^0.3.14",
38
+ "@gjsify/unit": "^0.3.14",
39
39
  "@types/inherits": "^2.0.0",
40
40
  "@types/node": "^25.6.0",
41
41
  "typescript": "^6.0.3"