(obj)
| 98 | * @returns {Record<string, T>} the lazy access object |
| 99 | */ |
| 100 | const lazyObject = (obj) => { |
| 101 | const newObj = /** @type {Record<string, T>} */ ({}); |
| 102 | for (const key of Object.keys(obj)) { |
| 103 | const fn = obj[key]; |
| 104 | Object.defineProperty(newObj, key, { |
| 105 | get: () => fn(), |
| 106 | set: (v) => { |
| 107 | Object.defineProperty(newObj, key, { |
| 108 | value: v, |
| 109 | enumerable: true, |
| 110 | writable: true |
| 111 | }); |
| 112 | }, |
| 113 | enumerable: true, |
| 114 | configurable: true |
| 115 | }); |
| 116 | } |
| 117 | return newObj; |
| 118 | }; |
| 119 | |
| 120 | const SQUARE_BRACKET_TAG_REGEXP = /\[\\*([\w-]+)\\*\]/g; |
| 121 | /** |
no test coverage detected