@kensnzk/koyu 0.5.0
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/.github/workflows/ci.yml +16 -0
- package/.zenodo.json +20 -0
- package/CITATION.cff +26 -0
- package/LICENSE +73 -0
- package/NOTICE +2 -0
- package/README.ja.md +71 -0
- package/README.md +72 -0
- package/docs/decisions/0001-notation-v0.md +29 -0
- package/docs/decisions/0002-height-and-offsets.md +27 -0
- package/docs/decisions/0003-uncounted-divisions.md +36 -0
- package/docs/decisions/0004-typical-floors.md +21 -0
- package/docs/decisions/0005-zones-and-unions.md +23 -0
- package/docs/decisions/0006-voids-and-light.md +31 -0
- package/docs/decisions/0007-semi-outdoor-air.md +27 -0
- package/docs/decisions/0008-vocabulary-and-level-attr.md +23 -0
- package/docs/decisions/0009-site-and-exterior.md +29 -0
- package/docs/ifc-coverage.md +82 -0
- package/docs/ifcx-notes.md +25 -0
- package/docs/img/house-L1.svg +80 -0
- package/docs/img/house-L2.svg +53 -0
- package/docs/img/mansion-L1.svg +113 -0
- package/docs/img/mansion-L10.svg +111 -0
- package/docs/img/mansion-L5.svg +160 -0
- package/docs/img/office-L1.svg +116 -0
- package/docs/img/office-L2.svg +109 -0
- package/docs/img/two-rooms.svg +39 -0
- package/docs/log/2026-07-22.md +13 -0
- package/docs/log/2026-07-23.md +51 -0
- package/docs/roadmap.md +55 -0
- package/docs/writing-architecture.md +119 -0
- package/examples/comparison/README.md +38 -0
- package/examples/comparison/gen-ifc4.ts +133 -0
- package/examples/comparison/gen-ifcx.ts +134 -0
- package/examples/comparison/two-rooms.ifc +152 -0
- package/examples/comparison/two-rooms.ifcx +1030 -0
- package/examples/comparison/validate-ifc.ts +33 -0
- package/examples/house.muro +89 -0
- package/examples/mansion.muro +187 -0
- package/examples/office.muro +110 -0
- package/examples/two-rooms.canonical.json +111 -0
- package/examples/two-rooms.muro +22 -0
- package/package.json +33 -0
- package/spec/notation-v0.md +164 -0
- package/spec/vocabulary.md +62 -0
- package/src/check.ts +302 -0
- package/src/cli.ts +281 -0
- package/src/graph.ts +306 -0
- package/src/index.ts +8 -0
- package/src/light.ts +66 -0
- package/src/model.ts +367 -0
- package/src/parse.ts +512 -0
- package/src/plan.ts +334 -0
- package/src/site.ts +82 -0
- package/test/core.test.ts +171 -0
- package/test/design2.test.ts +97 -0
- package/test/house.test.ts +74 -0
- package/test/mansion.test.ts +99 -0
- package/test/office.test.ts +71 -0
- package/test/uncounted.test.ts +120 -0
- package/test/vertical.test.ts +75 -0
- package/tsconfig.json +13 -0
package/src/model.ts
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
// koyu v0 — データモデル
|
|
2
|
+
// 一次要素は空間。壁は二つの空間の「境界」という関係であり、物ではない。
|
|
3
|
+
// 形はここには無い。形は生成物である。(docs/writing-architecture.md)
|
|
4
|
+
|
|
5
|
+
export type AttrValue = string | number;
|
|
6
|
+
export type Attrs = Record<string, AttrValue>;
|
|
7
|
+
|
|
8
|
+
/** 方位。edge指定は「最初に書いた空間」の矩形から見た辺。N=+Y, S=-Y, E=+X, W=-X */
|
|
9
|
+
export type Edge = "N" | "E" | "S" | "W";
|
|
10
|
+
|
|
11
|
+
export interface Level {
|
|
12
|
+
name: string;
|
|
13
|
+
/** FLの高さ mm */
|
|
14
|
+
z: number;
|
|
15
|
+
/** 階の基準天井高 mm */
|
|
16
|
+
h?: number;
|
|
17
|
+
/** この階の床組み厚 mm (下階の天井面から自階FLまで: スラブ+懐+仕上) */
|
|
18
|
+
slab?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface GridAxis {
|
|
22
|
+
/** 通り名 (X1, X2, ...) */
|
|
23
|
+
names: string[];
|
|
24
|
+
/** 座標 mm */
|
|
25
|
+
coords: number[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** mm矩形 (x1<x2, y1<y2) */
|
|
29
|
+
export interface Rect {
|
|
30
|
+
x1: number;
|
|
31
|
+
y1: number;
|
|
32
|
+
x2: number;
|
|
33
|
+
y2: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 数えない分節 — 室に従属する領域 (床材の切替など)。
|
|
38
|
+
* 面積・室数・グラフには一切現れない。属性の上書きだけを運ぶ (ADR-0003)
|
|
39
|
+
*/
|
|
40
|
+
export interface Area {
|
|
41
|
+
grid: { xa: string; xb: string; ya: string; yb: string };
|
|
42
|
+
rect: Rect;
|
|
43
|
+
attrs: Attrs;
|
|
44
|
+
line: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface GridRef {
|
|
48
|
+
xa: string;
|
|
49
|
+
xb: string;
|
|
50
|
+
ya: string;
|
|
51
|
+
yb: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface Space {
|
|
55
|
+
/** パスが同一性。/L1/a のように人間が読める階層で名指す。
|
|
56
|
+
* パスの第一義は集計の階層 — レベルは既定で先頭セグメントから読むが、
|
|
57
|
+
* 階を跨ぐくくり (メゾネット) は level: 属性で明示する (ADR-0008) */
|
|
58
|
+
path: string;
|
|
59
|
+
/** 開かれた語彙 (room, corridor, exterior, void, ...) */
|
|
60
|
+
type: string;
|
|
61
|
+
/** 所属レベル名 (パス先頭セグメント、または level: 属性) */
|
|
62
|
+
level?: string;
|
|
63
|
+
/** グリッド参照。複数矩形の合併でL字などを表す (rectsと同順) */
|
|
64
|
+
grids: GridRef[];
|
|
65
|
+
/** グリッド解決後のmm矩形の合併。exteriorなどは空 */
|
|
66
|
+
rects: Rect[];
|
|
67
|
+
/** 数えない分節 (字下げのarea行) */
|
|
68
|
+
areas: Area[];
|
|
69
|
+
attrs: Attrs;
|
|
70
|
+
line: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* ゾーン — 数える集約。住戸・部門など、空間の上位のくくり。
|
|
75
|
+
* 幾何は持たず、パス接頭辞で束ねた空間の面積の合計として面積を持つ (ADR-0005)
|
|
76
|
+
*/
|
|
77
|
+
export interface Zone {
|
|
78
|
+
path: string;
|
|
79
|
+
attrs: Attrs;
|
|
80
|
+
line: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* kindは関係のトポロジーだけを言う (IFCのIfcRelSpaceBoundaryがPhysical/Virtualしか
|
|
85
|
+
* 言わないのと同じ構え)。手すり・カーテンウォールといった「実現する物」はspec語彙で、
|
|
86
|
+
* kindには入れない (IfcRailingが要素であって境界種別でないことに倣う — ADR-0007)。
|
|
87
|
+
* 水平: wall (物がある。扉がなければ通れない) / open (何もない — 通行可)
|
|
88
|
+
* 垂直: stair (階段 — 通行可) / shaft (EV等 — 連続するが通行不可) /
|
|
89
|
+
* void (吹抜け — 床の不在)
|
|
90
|
+
* 垂直の既定は床 (slab) であり書かない。levelのslab宣言が一括で与える。
|
|
91
|
+
*/
|
|
92
|
+
export type BoundaryKind = "wall" | "open" | "stair" | "shaft" | "void";
|
|
93
|
+
|
|
94
|
+
export interface Opening {
|
|
95
|
+
kind: "door" | "window";
|
|
96
|
+
/** 幅 mm */
|
|
97
|
+
w: number;
|
|
98
|
+
/** 高さ mm */
|
|
99
|
+
h?: number;
|
|
100
|
+
/** 区間上の位置 0..1 (既定 0.5) */
|
|
101
|
+
at: number;
|
|
102
|
+
/** 区間が複数あるとき (外部境界など) の辺の指定 */
|
|
103
|
+
edge?: Edge;
|
|
104
|
+
/** 開き勝手: 吊元の側 (水平線分ならW/E、垂直線分ならS/N)。既定は始端側 */
|
|
105
|
+
hinge?: Edge;
|
|
106
|
+
/** 開き勝手: 開く側 (境界のa側/b側)。既定はa側 (領域を持つ方) */
|
|
107
|
+
swing?: "a" | "b";
|
|
108
|
+
attrs: Attrs;
|
|
109
|
+
line: number;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 境界上の数えない分節 — 壁材が途中から変わる区間など。
|
|
114
|
+
* 開口と同じ流儀で位置 (at, w) を持つが、通行・接続には一切影響しない (ADR-0003)
|
|
115
|
+
*/
|
|
116
|
+
export interface Seg {
|
|
117
|
+
/** 幅 mm */
|
|
118
|
+
w: number;
|
|
119
|
+
/** 区間中心の位置 0..1 (既定 0.5) */
|
|
120
|
+
at: number;
|
|
121
|
+
edge?: Edge;
|
|
122
|
+
attrs: Attrs;
|
|
123
|
+
line: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** 境界はどちらの空間にも属さない。二つの空間パスを結ぶ第一級の関係 */
|
|
127
|
+
export interface Boundary {
|
|
128
|
+
a: string;
|
|
129
|
+
b: string;
|
|
130
|
+
kind: BoundaryKind;
|
|
131
|
+
/** 壁厚 mm (通り芯・境界線に対して芯振り分け) */
|
|
132
|
+
t?: number;
|
|
133
|
+
/** 遮蔽しない (air:1) — 手すり・柵など、物はあるが外気・光を遮らない。
|
|
134
|
+
* 通行可能性はkindが言い (壁は扉がなければ通れない)、遮蔽性はこの属性が言う。
|
|
135
|
+
* 外部に対して open または air:1 の境界を持つ空間が半屋外と導出される */
|
|
136
|
+
air?: boolean;
|
|
137
|
+
/** 境界をaの矩形から見た特定の辺に限定する */
|
|
138
|
+
edge?: Edge;
|
|
139
|
+
attrs: Attrs;
|
|
140
|
+
openings: Opening[];
|
|
141
|
+
/** 数えない分節 (字下げのseg行) */
|
|
142
|
+
segs: Seg[];
|
|
143
|
+
line: number;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface Model {
|
|
147
|
+
version: string;
|
|
148
|
+
name?: string;
|
|
149
|
+
unit: "mm";
|
|
150
|
+
grid: { X: GridAxis; Y: GridAxis };
|
|
151
|
+
levels: Record<string, Level>;
|
|
152
|
+
spaces: Map<string, Space>;
|
|
153
|
+
zones: Map<string, Zone>;
|
|
154
|
+
boundaries: Boundary[];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export class SourceError extends Error {
|
|
158
|
+
constructor(
|
|
159
|
+
public line: number,
|
|
160
|
+
message: string,
|
|
161
|
+
) {
|
|
162
|
+
super(`${line}行目: ${message}`);
|
|
163
|
+
this.name = "SourceError";
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** 面積 (壁芯) m²。複数矩形は合計 (重なりはcheckが禁じる) */
|
|
168
|
+
export function areaM2(s: Space): number | undefined {
|
|
169
|
+
if (s.rects.length === 0) return undefined;
|
|
170
|
+
const a = s.rects.reduce((sum, r) => sum + (r.x2 - r.x1) * (r.y2 - r.y1), 0) / 1e6;
|
|
171
|
+
return Math.round(a * 100) / 100;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* 半屋外か — 宣言ではなく導出。外部 (type:exterior) に対して
|
|
176
|
+
* open または air:1 (手すり等、遮蔽しない物) の境界で接する空間は半屋外である (ADR-0007)
|
|
177
|
+
*/
|
|
178
|
+
export function isSemiOutdoor(model: Model, s: Space): boolean {
|
|
179
|
+
if (s.rects.length === 0) return false;
|
|
180
|
+
for (const b of model.boundaries) {
|
|
181
|
+
if (b.kind !== "open" && !b.air) continue;
|
|
182
|
+
const other = b.a === s.path ? b.b : b.b === s.path ? b.a : undefined;
|
|
183
|
+
if (!other) continue;
|
|
184
|
+
if (model.spaces.get(other)?.type === "exterior") return true;
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* 上に (どのレベルであれ) 空間が重なっているか — 庇下・バルコニー下の導出。
|
|
191
|
+
* 採光の半屋外係数 (庇下0.7 / 上が開いていれば1.0) などが読む (ADR-0009)
|
|
192
|
+
*/
|
|
193
|
+
export function isCoveredAbove(model: Model, s: Space): boolean {
|
|
194
|
+
if (s.rects.length === 0 || !s.level) return false;
|
|
195
|
+
const z = model.levels[s.level]?.z;
|
|
196
|
+
if (z === undefined) return false;
|
|
197
|
+
for (const o of model.spaces.values()) {
|
|
198
|
+
if (o === s || o.rects.length === 0 || !o.level) continue;
|
|
199
|
+
const oz = model.levels[o.level]?.z;
|
|
200
|
+
if (oz === undefined || oz <= z) continue;
|
|
201
|
+
for (const ra of s.rects) {
|
|
202
|
+
for (const rb of o.rects) {
|
|
203
|
+
const x = Math.min(ra.x2, rb.x2) - Math.max(ra.x1, rb.x1);
|
|
204
|
+
const y = Math.min(ra.y2, rb.y2) - Math.max(ra.y1, rb.y1);
|
|
205
|
+
if (x > 0.5 && y > 0.5) return true;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** 矩形集合の合併面積 m² (水平投影 — 建築面積の導出に使う)。座標圧縮による厳密計算 */
|
|
213
|
+
export function unionAreaM2(rects: Rect[]): number {
|
|
214
|
+
if (rects.length === 0) return 0;
|
|
215
|
+
const xs = [...new Set(rects.flatMap((r) => [r.x1, r.x2]))].sort((a, b) => a - b);
|
|
216
|
+
const ys = [...new Set(rects.flatMap((r) => [r.y1, r.y2]))].sort((a, b) => a - b);
|
|
217
|
+
let area = 0;
|
|
218
|
+
for (let i = 0; i + 1 < xs.length; i++) {
|
|
219
|
+
for (let j = 0; j + 1 < ys.length; j++) {
|
|
220
|
+
const cx = (xs[i]! + xs[i + 1]!) / 2;
|
|
221
|
+
const cy = (ys[j]! + ys[j + 1]!) / 2;
|
|
222
|
+
if (rects.some((r) => cx > r.x1 && cx < r.x2 && cy > r.y1 && cy < r.y2)) {
|
|
223
|
+
area += (xs[i + 1]! - xs[i]!) * (ys[j + 1]! - ys[j]!);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return Math.round((area / 1e6) * 100) / 100;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** ゾーンの面積 = パス接頭辞で束ねた空間の合計 (吹抜けと半屋外は数えない — 専有面積の言葉) */
|
|
231
|
+
export function zoneAreaM2(model: Model, zonePath: string): number {
|
|
232
|
+
let sum = 0;
|
|
233
|
+
for (const s of model.spaces.values()) {
|
|
234
|
+
if (!s.path.startsWith(zonePath + "/")) continue;
|
|
235
|
+
if (s.type === "void") continue;
|
|
236
|
+
if (isSemiOutdoor(model, s)) continue;
|
|
237
|
+
sum += areaM2(s) ?? 0;
|
|
238
|
+
}
|
|
239
|
+
return Math.round(sum * 100) / 100;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** 実効use属性 — 自分に無ければ、最も深いゾーン祖先から継承する */
|
|
243
|
+
export function effectiveUse(model: Model, s: Space): string | undefined {
|
|
244
|
+
const own = s.attrs["use"];
|
|
245
|
+
if (typeof own === "string") return own;
|
|
246
|
+
let best: string | undefined;
|
|
247
|
+
let bestLen = -1;
|
|
248
|
+
for (const z of model.zones.values()) {
|
|
249
|
+
if (s.path.startsWith(z.path + "/") && z.path.length > bestLen) {
|
|
250
|
+
const u = z.attrs["use"];
|
|
251
|
+
if (typeof u === "string") {
|
|
252
|
+
best = u;
|
|
253
|
+
bestLen = z.path.length;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return best;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** 空間の有効天井高 mm (space自身のh属性 → レベルのh の順) */
|
|
261
|
+
export function heff(model: Model, s: Space): number | undefined {
|
|
262
|
+
const own = s.attrs["h"];
|
|
263
|
+
if (typeof own === "number") return own;
|
|
264
|
+
return s.level ? model.levels[s.level]?.h : undefined;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** レベルをzの昇順で返す */
|
|
268
|
+
export function levelsSorted(model: Model): Level[] {
|
|
269
|
+
return Object.values(model.levels).sort((a, b) => a.z - b.z);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export function displayName(s: Space): string {
|
|
273
|
+
const n = s.attrs["name"];
|
|
274
|
+
return typeof n === "string" ? n : (s.path.split("/").pop() ?? s.path);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** 正準JSON — 機械形式。差分とレイヤー合成の土台 (キーは安定順) */
|
|
278
|
+
export function toCanonical(model: Model): string {
|
|
279
|
+
const spaces: Record<string, unknown> = {};
|
|
280
|
+
for (const p of [...model.spaces.keys()].sort()) {
|
|
281
|
+
const s = model.spaces.get(p)!;
|
|
282
|
+
spaces[p] = {
|
|
283
|
+
type: s.type,
|
|
284
|
+
...(s.grids.length === 1
|
|
285
|
+
? { at: [s.grids[0]!.xa, s.grids[0]!.ya, s.grids[0]!.xb, s.grids[0]!.yb] }
|
|
286
|
+
: s.grids.length > 1
|
|
287
|
+
? { at: s.grids.map((g) => [g.xa, g.ya, g.xb, g.yb]) }
|
|
288
|
+
: {}),
|
|
289
|
+
...(Object.keys(s.attrs).length ? { attrs: sortObj(s.attrs) } : {}),
|
|
290
|
+
...(s.areas.length
|
|
291
|
+
? {
|
|
292
|
+
areas: s.areas.map((a) => ({
|
|
293
|
+
at: [a.grid.xa, a.grid.ya, a.grid.xb, a.grid.yb],
|
|
294
|
+
...(Object.keys(a.attrs).length ? { attrs: sortObj(a.attrs) } : {}),
|
|
295
|
+
})),
|
|
296
|
+
}
|
|
297
|
+
: {}),
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
const boundaries = [...model.boundaries]
|
|
301
|
+
.map((b) => ({
|
|
302
|
+
between: [b.a, b.b].sort(),
|
|
303
|
+
kind: b.kind,
|
|
304
|
+
...(b.t !== undefined ? { t: b.t } : {}),
|
|
305
|
+
...(b.air ? { air: true } : {}),
|
|
306
|
+
...(b.edge ? { edge: b.edge } : {}),
|
|
307
|
+
...(Object.keys(b.attrs).length ? { attrs: sortObj(b.attrs) } : {}),
|
|
308
|
+
...(b.openings.length
|
|
309
|
+
? {
|
|
310
|
+
openings: b.openings.map((o) => ({
|
|
311
|
+
kind: o.kind,
|
|
312
|
+
w: o.w,
|
|
313
|
+
...(o.h !== undefined ? { h: o.h } : {}),
|
|
314
|
+
at: o.at,
|
|
315
|
+
...(o.edge ? { edge: o.edge } : {}),
|
|
316
|
+
...(o.hinge ? { hinge: o.hinge } : {}),
|
|
317
|
+
...(o.swing ? { swing: o.swing } : {}),
|
|
318
|
+
...(Object.keys(o.attrs).length ? { attrs: sortObj(o.attrs) } : {}),
|
|
319
|
+
})),
|
|
320
|
+
}
|
|
321
|
+
: {}),
|
|
322
|
+
...(b.segs.length
|
|
323
|
+
? {
|
|
324
|
+
segs: b.segs.map((g) => ({
|
|
325
|
+
w: g.w,
|
|
326
|
+
at: g.at,
|
|
327
|
+
...(g.edge ? { edge: g.edge } : {}),
|
|
328
|
+
...(Object.keys(g.attrs).length ? { attrs: sortObj(g.attrs) } : {}),
|
|
329
|
+
})),
|
|
330
|
+
}
|
|
331
|
+
: {}),
|
|
332
|
+
}))
|
|
333
|
+
.sort((x, y) => (x.between.join() < y.between.join() ? -1 : 1));
|
|
334
|
+
|
|
335
|
+
const zones: Record<string, unknown> = {};
|
|
336
|
+
for (const p of [...model.zones.keys()].sort()) {
|
|
337
|
+
const z = model.zones.get(p)!;
|
|
338
|
+
zones[p] = Object.keys(z.attrs).length ? { attrs: sortObj(z.attrs) } : {};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const doc = {
|
|
342
|
+
koyu: model.version,
|
|
343
|
+
...(model.name ? { name: model.name } : {}),
|
|
344
|
+
unit: model.unit,
|
|
345
|
+
grid: { X: model.grid.X.coords, Y: model.grid.Y.coords },
|
|
346
|
+
levels: sortObj(
|
|
347
|
+
Object.fromEntries(
|
|
348
|
+
Object.entries(model.levels).map(([k, v]) => [
|
|
349
|
+
k,
|
|
350
|
+
{
|
|
351
|
+
z: v.z,
|
|
352
|
+
...(v.h !== undefined ? { h: v.h } : {}),
|
|
353
|
+
...(v.slab !== undefined ? { slab: v.slab } : {}),
|
|
354
|
+
},
|
|
355
|
+
]),
|
|
356
|
+
),
|
|
357
|
+
),
|
|
358
|
+
...(Object.keys(zones).length ? { zones } : {}),
|
|
359
|
+
spaces,
|
|
360
|
+
boundaries,
|
|
361
|
+
};
|
|
362
|
+
return JSON.stringify(doc, null, 2) + "\n";
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function sortObj<T>(o: Record<string, T>): Record<string, T> {
|
|
366
|
+
return Object.fromEntries(Object.entries(o).sort(([a], [b]) => (a < b ? -1 : 1)));
|
|
367
|
+
}
|