( object: JsonObject, keysFirst: string[] )
| 152 | } |
| 153 | |
| 154 | function orderObjectByKeys( |
| 155 | object: JsonObject, |
| 156 | keysFirst: string[] |
| 157 | ): JsonObject { |
| 158 | const result: JsonObject = {} |
| 159 | const seen = new Set<string>() |
| 160 | |
| 161 | for (const key of keysFirst) { |
| 162 | if (Object.hasOwn(object, key)) { |
| 163 | result[key] = object[key] |
| 164 | seen.add(key) |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | for (const key of Object.keys(object) |
| 169 | .filter(key => !seen.has(key)) |
| 170 | .sort()) { |
| 171 | result[key] = object[key] |
| 172 | } |
| 173 | |
| 174 | return result |
| 175 | } |
| 176 | |
| 177 | function orderExports(value: JsonValue, sortExports: string[]): JsonValue { |
| 178 | if (!value || typeof value !== 'object' || Array.isArray(value)) { |
no outgoing calls
no test coverage detected