@mlightcad/common 1.2.1 → 1.2.3

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.
Files changed (67) hide show
  1. package/package.json +2 -2
  2. package/dist/common.js +0 -1479
  3. package/dist/common.umd.cjs +0 -1
  4. package/lib/AcCmColor.d.ts +0 -201
  5. package/lib/AcCmColor.d.ts.map +0 -1
  6. package/lib/AcCmColor.js +0 -641
  7. package/lib/AcCmColor.js.map +0 -1
  8. package/lib/AcCmColorUtil.d.ts +0 -41
  9. package/lib/AcCmColorUtil.d.ts.map +0 -1
  10. package/lib/AcCmColorUtil.js +0 -90
  11. package/lib/AcCmColorUtil.js.map +0 -1
  12. package/lib/AcCmErrors.d.ts +0 -56
  13. package/lib/AcCmErrors.d.ts.map +0 -1
  14. package/lib/AcCmErrors.js +0 -70
  15. package/lib/AcCmErrors.js.map +0 -1
  16. package/lib/AcCmEventDispatcher.d.ts +0 -101
  17. package/lib/AcCmEventDispatcher.d.ts.map +0 -1
  18. package/lib/AcCmEventDispatcher.js +0 -97
  19. package/lib/AcCmEventDispatcher.js.map +0 -1
  20. package/lib/AcCmEventManager.d.ts +0 -66
  21. package/lib/AcCmEventManager.d.ts.map +0 -1
  22. package/lib/AcCmEventManager.js +0 -133
  23. package/lib/AcCmEventManager.js.map +0 -1
  24. package/lib/AcCmLodashUtils.d.ts +0 -145
  25. package/lib/AcCmLodashUtils.d.ts.map +0 -1
  26. package/lib/AcCmLodashUtils.js +0 -293
  27. package/lib/AcCmLodashUtils.js.map +0 -1
  28. package/lib/AcCmLogUtil.d.ts +0 -80
  29. package/lib/AcCmLogUtil.d.ts.map +0 -1
  30. package/lib/AcCmLogUtil.js +0 -72
  31. package/lib/AcCmLogUtil.js.map +0 -1
  32. package/lib/AcCmObject.d.ts +0 -150
  33. package/lib/AcCmObject.d.ts.map +0 -1
  34. package/lib/AcCmObject.js +0 -204
  35. package/lib/AcCmObject.js.map +0 -1
  36. package/lib/AcCmPerformanceCollector.d.ts +0 -89
  37. package/lib/AcCmPerformanceCollector.d.ts.map +0 -1
  38. package/lib/AcCmPerformanceCollector.js +0 -119
  39. package/lib/AcCmPerformanceCollector.js.map +0 -1
  40. package/lib/AcCmStringUtil.d.ts +0 -44
  41. package/lib/AcCmStringUtil.d.ts.map +0 -1
  42. package/lib/AcCmStringUtil.js +0 -58
  43. package/lib/AcCmStringUtil.js.map +0 -1
  44. package/lib/AcCmTaskScheduler.d.ts +0 -186
  45. package/lib/AcCmTaskScheduler.d.ts.map +0 -1
  46. package/lib/AcCmTaskScheduler.js +0 -253
  47. package/lib/AcCmTaskScheduler.js.map +0 -1
  48. package/lib/index.d.ts +0 -12
  49. package/lib/index.d.ts.map +0 -1
  50. package/lib/index.js +0 -12
  51. package/lib/index.js.map +0 -1
  52. package/lib/loader/AcCmFileLoader.d.ts +0 -95
  53. package/lib/loader/AcCmFileLoader.d.ts.map +0 -1
  54. package/lib/loader/AcCmFileLoader.js +0 -275
  55. package/lib/loader/AcCmFileLoader.js.map +0 -1
  56. package/lib/loader/AcCmLoader.d.ts +0 -125
  57. package/lib/loader/AcCmLoader.d.ts.map +0 -1
  58. package/lib/loader/AcCmLoader.js +0 -116
  59. package/lib/loader/AcCmLoader.js.map +0 -1
  60. package/lib/loader/AcCmLoadingManager.d.ts +0 -166
  61. package/lib/loader/AcCmLoadingManager.d.ts.map +0 -1
  62. package/lib/loader/AcCmLoadingManager.js +0 -172
  63. package/lib/loader/AcCmLoadingManager.js.map +0 -1
  64. package/lib/loader/index.d.ts +0 -3
  65. package/lib/loader/index.d.ts.map +0 -1
  66. package/lib/loader/index.js +0 -3
  67. package/lib/loader/index.js.map +0 -1
@@ -1,133 +0,0 @@
1
- /**
2
- * @fileoverview Simple event manager implementation for the AutoCAD Common library.
3
- *
4
- * This module provides a lightweight event management system for handling
5
- * listeners and dispatching events with type-safe payload support.
6
- *
7
- * @module AcCmEventManager
8
- * @version 1.0.0
9
- */
10
- var __values = (this && this.__values) || function(o) {
11
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
12
- if (m) return m.call(o);
13
- if (o && typeof o.length === "number") return {
14
- next: function () {
15
- if (o && i >= o.length) o = void 0;
16
- return { value: o && o[i++], done: !o };
17
- }
18
- };
19
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
20
- };
21
- var __read = (this && this.__read) || function (o, n) {
22
- var m = typeof Symbol === "function" && o[Symbol.iterator];
23
- if (!m) return o;
24
- var i = m.call(o), r, ar = [], e;
25
- try {
26
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27
- }
28
- catch (error) { e = { error: error }; }
29
- finally {
30
- try {
31
- if (r && !r.done && (m = i["return"])) m.call(i);
32
- }
33
- finally { if (e) throw e.error; }
34
- }
35
- return ar;
36
- };
37
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
38
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
39
- if (ar || !(i in from)) {
40
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
41
- ar[i] = from[i];
42
- }
43
- }
44
- return to.concat(ar || Array.prototype.slice.call(from));
45
- };
46
- /**
47
- * Simple event manager for handling event listeners and dispatching events.
48
- *
49
- * Provides a lightweight alternative to the more complex AcCmEventDispatcher
50
- * for cases where you need basic event handling with type-safe payloads.
51
- *
52
- * @template T - The type of the event payload.
53
- *
54
- * @example
55
- * ```typescript
56
- * // Create an event manager for string payloads
57
- * const manager = new AcCmEventManager<string>()
58
- *
59
- * // Add a listener
60
- * manager.addEventListener((message) => {
61
- * console.log('Received:', message)
62
- * })
63
- *
64
- * // Dispatch an event
65
- * manager.dispatch('Hello, World!')
66
- *
67
- * // For complex payloads
68
- * interface LoadEvent {
69
- * url: string
70
- * progress: number
71
- * }
72
- *
73
- * const loadManager = new AcCmEventManager<LoadEvent>()
74
- * loadManager.addEventListener(({ url, progress }) => {
75
- * console.log(`Loading ${url}: ${progress}%`)
76
- * })
77
- * ```
78
- */
79
- var AcCmEventManager = /** @class */ (function () {
80
- function AcCmEventManager() {
81
- this.listeners = [];
82
- }
83
- /**
84
- * Add the event listener
85
- * @param listener Input listener to be added
86
- */
87
- AcCmEventManager.prototype.addEventListener = function (listener) {
88
- this.listeners.push(listener);
89
- };
90
- /**
91
- * Remove the listener
92
- * @param listener Input listener to be removed
93
- */
94
- AcCmEventManager.prototype.removeEventListener = function (listener) {
95
- this.listeners = this.listeners.filter(function (s) { return s !== listener; });
96
- };
97
- /**
98
- * Remove all listeners bound to the target and add one new listener
99
- * @param listener Input listener to be added
100
- */
101
- AcCmEventManager.prototype.replaceEventListener = function (listener) {
102
- this.removeEventListener(listener);
103
- this.addEventListener(listener);
104
- };
105
- /**
106
- * Notify all listeners
107
- * @param payload Input payload passed to listener
108
- */
109
- AcCmEventManager.prototype.dispatch = function (payload) {
110
- var e_1, _a;
111
- var args = [];
112
- for (var _i = 1; _i < arguments.length; _i++) {
113
- args[_i - 1] = arguments[_i];
114
- }
115
- try {
116
- for (var _b = __values(this.listeners), _c = _b.next(); !_c.done; _c = _b.next()) {
117
- var item = _c.value;
118
- var listener = item;
119
- listener.call.apply(listener, __spreadArray([null, payload], __read(args), false));
120
- }
121
- }
122
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
123
- finally {
124
- try {
125
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
126
- }
127
- finally { if (e_1) throw e_1.error; }
128
- }
129
- };
130
- return AcCmEventManager;
131
- }());
132
- export { AcCmEventManager };
133
- //# sourceMappingURL=AcCmEventManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcCmEventManager.js","sourceRoot":"","sources":["../src/AcCmEventManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH;IAAA;QACU,cAAS,GAA6B,EAAE,CAAA;IAqClD,CAAC;IAnCC;;;OAGG;IACI,2CAAgB,GAAvB,UAAwB,QAA8B;QACpD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC/B,CAAC;IAED;;;OAGG;IACI,8CAAmB,GAA1B,UAA2B,QAA8B;QACvD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,KAAK,QAAQ,EAAd,CAAc,CAAC,CAAA;IAC7D,CAAC;IAED;;;OAGG;IACI,+CAAoB,GAA3B,UAA4B,QAA8B;QACxD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAA;QAClC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACjC,CAAC;IAED;;;OAGG;IACI,mCAAQ,GAAf,UAAgB,OAAW;;QAAE,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,6BAAkB;;;YAC7C,KAAmB,IAAA,KAAA,SAAA,IAAI,CAAC,SAAS,CAAA,gBAAA,4BAAE,CAAC;gBAA/B,IAAM,IAAI,WAAA;gBACb,IAAM,QAAQ,GAAG,IAAoC,CAAA;gBACrD,QAAQ,CAAC,IAAI,OAAb,QAAQ,iBAAM,IAAI,EAAE,OAAO,UAAK,IAAI,WAAC;YACvC,CAAC;;;;;;;;;IACH,CAAC;IACH,uBAAC;AAAD,CAAC,AAtCD,IAsCC"}
@@ -1,145 +0,0 @@
1
- /**
2
- * @fileoverview Lightweight utility functions inspired by lodash-es.
3
- *
4
- * This module provides simplified implementations of commonly used lodash functions
5
- * to reduce bundle size while maintaining essential functionality for object manipulation,
6
- * comparison, and validation operations.
7
- *
8
- * @module AcCmLodashUtils
9
- * @version 1.0.0
10
- */
11
- /**
12
- * Utility functions extracted from lodash-es to reduce bundle size
13
- * These are simplified implementations of commonly used lodash functions
14
- */
15
- /**
16
- * Creates a shallow clone of an object or array.
17
- *
18
- * For primitive values, returns the value as-is. For objects and arrays,
19
- * creates a new instance with the same properties or elements.
20
- *
21
- * @template T - The type of the object to clone.
22
- * @param {T} obj - The object to clone.
23
- * @returns {T} A shallow clone of the object.
24
- *
25
- * @example
26
- * ```typescript
27
- * import { clone } from './AcCmLodashUtils'
28
- *
29
- * const original = { a: 1, b: 2 }
30
- * const cloned = clone(original)
31
- * cloned.a = 3
32
- * console.log(original.a) // 1 (unchanged)
33
- * console.log(cloned.a) // 3
34
- *
35
- * const arr = [1, 2, 3]
36
- * const clonedArr = clone(arr) // [1, 2, 3]
37
- * ```
38
- */
39
- export declare function clone<T>(obj: T): T;
40
- /**
41
- * Assigns own enumerable properties of source objects to the destination object
42
- * for all destination properties that resolve to undefined.
43
- *
44
- * This function fills in undefined properties in an object with the first value
45
- * present in any of the source objects. Source objects are applied from left to right.
46
- *
47
- * @param {Record<string, unknown>} obj - The destination object.
48
- * @param {...Record<string, unknown>[]} sources - The source objects.
49
- * @returns {Record<string, unknown>} The destination object.
50
- *
51
- * @example
52
- * ```typescript
53
- * import { defaults } from './AcCmLodashUtils'
54
- *
55
- * const object = { a: 1 }
56
- * const result = defaults(object, { b: 2 }, { a: 3, c: 3 })
57
- * console.log(result) // { a: 1, b: 2, c: 3 }
58
- *
59
- * // undefined properties are filled in
60
- * const partial = { a: 1, b: undefined }
61
- * defaults(partial, { b: 2, c: 3 })
62
- * console.log(partial) // { a: 1, b: 2, c: 3 }
63
- * ```
64
- */
65
- export declare function defaults(obj: Record<string, unknown>, ...sources: Record<string, unknown>[]): Record<string, unknown>;
66
- /**
67
- * Checks if path is a direct property of object.
68
- *
69
- * This function checks whether the specified property exists directly on the object
70
- * (not inherited from its prototype chain).
71
- *
72
- * @param {Record<string, unknown>} obj - The object to query.
73
- * @param {string} path - The path to check.
74
- * @returns {boolean} Returns true if path exists, else false.
75
- *
76
- * @example
77
- * ```typescript
78
- * import { has } from './AcCmLodashUtils'
79
- *
80
- * const object = { a: 1, b: 2 }
81
- * has(object, 'a') // true
82
- * has(object, 'c') // false
83
- * has(object, 'toString') // false (inherited property)
84
- * ```
85
- */
86
- export declare function has(obj: Record<string, unknown>, path: string): boolean;
87
- /**
88
- * Checks if value is an empty object, collection, map, or set.
89
- *
90
- * Values are considered empty if they are:
91
- * - null or undefined
92
- * - Arrays or strings with length 0
93
- * - Maps or Sets with size 0
94
- * - Objects with no enumerable properties
95
- *
96
- * @param {unknown} value - The value to check.
97
- * @returns {boolean} Returns true if value is empty, else false.
98
- *
99
- * @example
100
- * ```typescript
101
- * import { isEmpty } from './AcCmLodashUtils'
102
- *
103
- * isEmpty(null) // true
104
- * isEmpty(undefined) // true
105
- * isEmpty('') // true
106
- * isEmpty([]) // true
107
- * isEmpty({}) // true
108
- * isEmpty(new Map()) // true
109
- * isEmpty(new Set()) // true
110
- * isEmpty('hello') // false
111
- * isEmpty([1, 2, 3]) // false
112
- * isEmpty({ a: 1 }) // false
113
- * ```
114
- */
115
- export declare function isEmpty(value: unknown): boolean;
116
- /**
117
- * Performs a deep comparison between two values to determine if they are equivalent.
118
- *
119
- * This function recursively compares objects and arrays, checking that all nested
120
- * properties and elements are equal. Handles null/undefined values, primitive types,
121
- * arrays, and plain objects.
122
- *
123
- * @param {unknown} value - The value to compare.
124
- * @param {unknown} other - The other value to compare.
125
- * @returns {boolean} Returns true if the values are equivalent, else false.
126
- *
127
- * @example
128
- * ```typescript
129
- * import { isEqual } from './AcCmLodashUtils'
130
- *
131
- * isEqual(1, 1) // true
132
- * isEqual('hello', 'hello') // true
133
- * isEqual([1, 2], [1, 2]) // true
134
- * isEqual({ a: 1 }, { a: 1 }) // true
135
- * isEqual([1, 2], [2, 1]) // false
136
- * isEqual({ a: 1 }, { a: 2 }) // false
137
- *
138
- * // Deep comparison
139
- * const obj1 = { a: { b: 1 } }
140
- * const obj2 = { a: { b: 1 } }
141
- * isEqual(obj1, obj2) // true
142
- * ```
143
- */
144
- export declare function isEqual(value: unknown, other: unknown): boolean;
145
- //# sourceMappingURL=AcCmLodashUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcCmLodashUtils.d.ts","sourceRoot":"","sources":["../src/AcCmLodashUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAUlC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,GAAG,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAkB/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAwD/D"}
@@ -1,293 +0,0 @@
1
- /**
2
- * @fileoverview Lightweight utility functions inspired by lodash-es.
3
- *
4
- * This module provides simplified implementations of commonly used lodash functions
5
- * to reduce bundle size while maintaining essential functionality for object manipulation,
6
- * comparison, and validation operations.
7
- *
8
- * @module AcCmLodashUtils
9
- * @version 1.0.0
10
- */
11
- var __assign = (this && this.__assign) || function () {
12
- __assign = Object.assign || function(t) {
13
- for (var s, i = 1, n = arguments.length; i < n; i++) {
14
- s = arguments[i];
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
16
- t[p] = s[p];
17
- }
18
- return t;
19
- };
20
- return __assign.apply(this, arguments);
21
- };
22
- var __read = (this && this.__read) || function (o, n) {
23
- var m = typeof Symbol === "function" && o[Symbol.iterator];
24
- if (!m) return o;
25
- var i = m.call(o), r, ar = [], e;
26
- try {
27
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
28
- }
29
- catch (error) { e = { error: error }; }
30
- finally {
31
- try {
32
- if (r && !r.done && (m = i["return"])) m.call(i);
33
- }
34
- finally { if (e) throw e.error; }
35
- }
36
- return ar;
37
- };
38
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
- if (ar || !(i in from)) {
41
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
- ar[i] = from[i];
43
- }
44
- }
45
- return to.concat(ar || Array.prototype.slice.call(from));
46
- };
47
- var __values = (this && this.__values) || function(o) {
48
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
49
- if (m) return m.call(o);
50
- if (o && typeof o.length === "number") return {
51
- next: function () {
52
- if (o && i >= o.length) o = void 0;
53
- return { value: o && o[i++], done: !o };
54
- }
55
- };
56
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
57
- };
58
- /**
59
- * Utility functions extracted from lodash-es to reduce bundle size
60
- * These are simplified implementations of commonly used lodash functions
61
- */
62
- /**
63
- * Creates a shallow clone of an object or array.
64
- *
65
- * For primitive values, returns the value as-is. For objects and arrays,
66
- * creates a new instance with the same properties or elements.
67
- *
68
- * @template T - The type of the object to clone.
69
- * @param {T} obj - The object to clone.
70
- * @returns {T} A shallow clone of the object.
71
- *
72
- * @example
73
- * ```typescript
74
- * import { clone } from './AcCmLodashUtils'
75
- *
76
- * const original = { a: 1, b: 2 }
77
- * const cloned = clone(original)
78
- * cloned.a = 3
79
- * console.log(original.a) // 1 (unchanged)
80
- * console.log(cloned.a) // 3
81
- *
82
- * const arr = [1, 2, 3]
83
- * const clonedArr = clone(arr) // [1, 2, 3]
84
- * ```
85
- */
86
- export function clone(obj) {
87
- if (obj === null || typeof obj !== 'object') {
88
- return obj;
89
- }
90
- if (Array.isArray(obj)) {
91
- return __spreadArray([], __read(obj), false);
92
- }
93
- return __assign({}, obj);
94
- }
95
- /**
96
- * Assigns own enumerable properties of source objects to the destination object
97
- * for all destination properties that resolve to undefined.
98
- *
99
- * This function fills in undefined properties in an object with the first value
100
- * present in any of the source objects. Source objects are applied from left to right.
101
- *
102
- * @param {Record<string, unknown>} obj - The destination object.
103
- * @param {...Record<string, unknown>[]} sources - The source objects.
104
- * @returns {Record<string, unknown>} The destination object.
105
- *
106
- * @example
107
- * ```typescript
108
- * import { defaults } from './AcCmLodashUtils'
109
- *
110
- * const object = { a: 1 }
111
- * const result = defaults(object, { b: 2 }, { a: 3, c: 3 })
112
- * console.log(result) // { a: 1, b: 2, c: 3 }
113
- *
114
- * // undefined properties are filled in
115
- * const partial = { a: 1, b: undefined }
116
- * defaults(partial, { b: 2, c: 3 })
117
- * console.log(partial) // { a: 1, b: 2, c: 3 }
118
- * ```
119
- */
120
- export function defaults(obj) {
121
- var e_1, _a;
122
- var sources = [];
123
- for (var _i = 1; _i < arguments.length; _i++) {
124
- sources[_i - 1] = arguments[_i];
125
- }
126
- try {
127
- for (var sources_1 = __values(sources), sources_1_1 = sources_1.next(); !sources_1_1.done; sources_1_1 = sources_1.next()) {
128
- var source = sources_1_1.value;
129
- if (source) {
130
- for (var key in source) {
131
- if (Object.prototype.hasOwnProperty.call(source, key) &&
132
- obj[key] === undefined) {
133
- obj[key] = source[key];
134
- }
135
- }
136
- }
137
- }
138
- }
139
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
140
- finally {
141
- try {
142
- if (sources_1_1 && !sources_1_1.done && (_a = sources_1.return)) _a.call(sources_1);
143
- }
144
- finally { if (e_1) throw e_1.error; }
145
- }
146
- return obj;
147
- }
148
- /**
149
- * Checks if path is a direct property of object.
150
- *
151
- * This function checks whether the specified property exists directly on the object
152
- * (not inherited from its prototype chain).
153
- *
154
- * @param {Record<string, unknown>} obj - The object to query.
155
- * @param {string} path - The path to check.
156
- * @returns {boolean} Returns true if path exists, else false.
157
- *
158
- * @example
159
- * ```typescript
160
- * import { has } from './AcCmLodashUtils'
161
- *
162
- * const object = { a: 1, b: 2 }
163
- * has(object, 'a') // true
164
- * has(object, 'c') // false
165
- * has(object, 'toString') // false (inherited property)
166
- * ```
167
- */
168
- export function has(obj, path) {
169
- return obj != null && Object.prototype.hasOwnProperty.call(obj, path);
170
- }
171
- /**
172
- * Checks if value is an empty object, collection, map, or set.
173
- *
174
- * Values are considered empty if they are:
175
- * - null or undefined
176
- * - Arrays or strings with length 0
177
- * - Maps or Sets with size 0
178
- * - Objects with no enumerable properties
179
- *
180
- * @param {unknown} value - The value to check.
181
- * @returns {boolean} Returns true if value is empty, else false.
182
- *
183
- * @example
184
- * ```typescript
185
- * import { isEmpty } from './AcCmLodashUtils'
186
- *
187
- * isEmpty(null) // true
188
- * isEmpty(undefined) // true
189
- * isEmpty('') // true
190
- * isEmpty([]) // true
191
- * isEmpty({}) // true
192
- * isEmpty(new Map()) // true
193
- * isEmpty(new Set()) // true
194
- * isEmpty('hello') // false
195
- * isEmpty([1, 2, 3]) // false
196
- * isEmpty({ a: 1 }) // false
197
- * ```
198
- */
199
- export function isEmpty(value) {
200
- if (value == null) {
201
- return true;
202
- }
203
- if (Array.isArray(value) || typeof value === 'string') {
204
- return value.length === 0;
205
- }
206
- if (value instanceof Map || value instanceof Set) {
207
- return value.size === 0;
208
- }
209
- if (typeof value === 'object') {
210
- return Object.keys(value).length === 0;
211
- }
212
- return false;
213
- }
214
- /**
215
- * Performs a deep comparison between two values to determine if they are equivalent.
216
- *
217
- * This function recursively compares objects and arrays, checking that all nested
218
- * properties and elements are equal. Handles null/undefined values, primitive types,
219
- * arrays, and plain objects.
220
- *
221
- * @param {unknown} value - The value to compare.
222
- * @param {unknown} other - The other value to compare.
223
- * @returns {boolean} Returns true if the values are equivalent, else false.
224
- *
225
- * @example
226
- * ```typescript
227
- * import { isEqual } from './AcCmLodashUtils'
228
- *
229
- * isEqual(1, 1) // true
230
- * isEqual('hello', 'hello') // true
231
- * isEqual([1, 2], [1, 2]) // true
232
- * isEqual({ a: 1 }, { a: 1 }) // true
233
- * isEqual([1, 2], [2, 1]) // false
234
- * isEqual({ a: 1 }, { a: 2 }) // false
235
- *
236
- * // Deep comparison
237
- * const obj1 = { a: { b: 1 } }
238
- * const obj2 = { a: { b: 1 } }
239
- * isEqual(obj1, obj2) // true
240
- * ```
241
- */
242
- export function isEqual(value, other) {
243
- var e_2, _a;
244
- if (value === other) {
245
- return true;
246
- }
247
- if (value == null || other == null) {
248
- return value === other;
249
- }
250
- if (typeof value !== typeof other) {
251
- return false;
252
- }
253
- if (typeof value !== 'object') {
254
- return value === other;
255
- }
256
- if (Array.isArray(value) !== Array.isArray(other)) {
257
- return false;
258
- }
259
- if (Array.isArray(value)) {
260
- if (value.length !== other.length) {
261
- return false;
262
- }
263
- for (var i = 0; i < value.length; i++) {
264
- if (!isEqual(value[i], other[i])) {
265
- return false;
266
- }
267
- }
268
- return true;
269
- }
270
- var valueKeys = Object.keys(value);
271
- var otherKeys = Object.keys(other);
272
- if (valueKeys.length !== otherKeys.length) {
273
- return false;
274
- }
275
- try {
276
- for (var valueKeys_1 = __values(valueKeys), valueKeys_1_1 = valueKeys_1.next(); !valueKeys_1_1.done; valueKeys_1_1 = valueKeys_1.next()) {
277
- var key = valueKeys_1_1.value;
278
- if (!Object.prototype.hasOwnProperty.call(other, key) ||
279
- !isEqual(value[key], other[key])) {
280
- return false;
281
- }
282
- }
283
- }
284
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
285
- finally {
286
- try {
287
- if (valueKeys_1_1 && !valueKeys_1_1.done && (_a = valueKeys_1.return)) _a.call(valueKeys_1);
288
- }
289
- finally { if (e_2) throw e_2.error; }
290
- }
291
- return true;
292
- }
293
- //# sourceMappingURL=AcCmLodashUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcCmLodashUtils.js","sourceRoot":"","sources":["../src/AcCmLodashUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,KAAK,CAAI,GAAM;IAC7B,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,yBAAI,GAAG,SAAM,CAAA;IACtB,CAAC;IAED,oBAAY,GAAG,EAAE;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,QAAQ,CACtB,GAA4B;;IAC5B,iBAAqC;SAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;QAArC,gCAAqC;;;QAErC,KAAqB,IAAA,YAAA,SAAA,OAAO,CAAA,gCAAA,qDAAE,CAAC;YAA1B,IAAM,MAAM,oBAAA;YACf,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,IAAM,GAAG,IAAI,MAAM,EAAE,CAAC;oBACzB,IACE,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;wBACjD,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EACtB,CAAC;wBACD,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;oBACxB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;;;;;;;;;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,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ilities for the AutoCAD Common library.
3
- *
4
- * This module provides a centralized logging interface using the loglevel library,
5
- * with configurable log levels for development and production environments.
6
- *
7
- * @module AcCmLogUtil
8
- * @version 1.0.0
9
- */
10
- import * as loglevel from 'loglevel';
11
- /**
12
- * Flag indicating whether debug mode is enabled.
13
- * When true, sets log level to 'debug'; otherwise sets to 'warn'.
14
- *
15
- * @constant {boolean}
16
- */
17
- export declare const DEBUG_MODE = true;
18
- /**
19
- * The main logging instance from the loglevel library.
20
- * Provides standard logging methods: trace, debug, info, warn, error.
21
- *
22
- * @constant {loglevel.Logger}
23
- *
24
- * @example
25
- * ```typescript
26
- * import { log } from './AcCmLogUtil'
27
- *
28
- * log.debug('Debug message')
29
- * log.info('Info message')
30
- * log.warn('Warning message')
31
- * log.error('Error message')
32
- * ```
33
- */
34
- export declare const log: {
35
- default: loglevel.RootLogger;
36
- noConflict(): any;
37
- getLogger(name: string | symbol): loglevel.Logger;
38
- getLoggers(): {
39
- [name: string]: loglevel.Logger;
40
- };
41
- levels: loglevel.LogLevel;
42
- methodFactory: loglevel.MethodFactory;
43
- trace(...msg: any[]): void;
44
- debug(...msg: any[]): void;
45
- log(...msg: any[]): void;
46
- info(...msg: any[]): void;
47
- warn(...msg: any[]): void;
48
- error(...msg: any[]): void;
49
- setLevel(level: loglevel.LogLevelDesc, persist?: boolean): void;
50
- getLevel(): loglevel.LogLevel[keyof loglevel.LogLevel];
51
- setDefaultLevel(level: loglevel.LogLevelDesc): void;
52
- resetLevel(): void;
53
- enableAll(persist?: boolean): void;
54
- disableAll(persist?: boolean): void;
55
- rebuild(): void;
56
- };
57
- /**
58
- * Sets the log level for the logging system.
59
- *
60
- * Valid log levels are: 'trace', 'debug', 'info', 'warn', 'error', 'silent'.
61
- * If an invalid level is provided, the level will default to 'error' and an error will be logged.
62
- *
63
- * @param {string} level - The log level to set.
64
- *
65
- * @example
66
- * ```typescript
67
- * import { setLogLevel } from './AcCmLogUtil'
68
- *
69
- * // Set to debug level for development
70
- * setLogLevel('debug')
71
- *
72
- * // Set to error level for production
73
- * setLogLevel('error')
74
- *
75
- * // Silent all logging
76
- * setLogLevel('silent')
77
- * ```
78
- */
79
- export declare const setLogLevel: (level: string) => void;
80
- //# sourceMappingURL=AcCmLogUtil.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcCmLogUtil.d.ts","sourceRoot":"","sources":["../src/AcCmLogUtil.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAA;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,OAAO,CAAA;AAE9B;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;CAAW,CAAA;AAQ3B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,UAAW,MAAM,SAOxC,CAAA"}