feat(stdlib): new modules + eslint/tsconfig migration

- Add array/async/etc. modules and type tests; migrate to eslint flat config
  and composite tsconfig (vitest typecheck enabled).
- Fix PubSub.emit to snapshot listeners before iterating (stable EventEmitter
  semantics; avoids invoking listeners added during the same emit).
This commit is contained in:
2026-06-07 16:29:08 +07:00
parent 008d85a8fd
commit 96f4cba4a8
118 changed files with 3511 additions and 240 deletions
@@ -1,4 +1,4 @@
import { describe, it, expect } from 'vitest';
import { describe, expect, it } from 'vitest';
import { trigramDistance, trigramProfile } from '.';
describe('trigramProfile', () => {
@@ -66,6 +66,13 @@ describe('trigramDistance', () => {
expect(trigramDistance(profile1, profile2)).toBe(1);
});
it('is symmetric', () => {
const a = trigramProfile('hello world');
const b = trigramProfile('hello lorem');
expect(trigramDistance(a, b)).toBe(trigramDistance(b, a));
});
it('one for empty text and non-empty text', () => {
const profile1 = trigramProfile('hello world');
const profile2 = trigramProfile('');