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:
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { last } from '.';
|
||||
|
||||
describe('last', () => {
|
||||
@@ -20,4 +20,10 @@ describe('last', () => {
|
||||
expect(last([1, 2, 3], 42)).toBe(3);
|
||||
expect(last(['a', 'b', 'c'], 'default')).toBe('c');
|
||||
});
|
||||
|
||||
it('preserve a present null/undefined/falsy last element (not the default)', () => {
|
||||
expect(last([1, null as number | null], 42)).toBeNull();
|
||||
expect(last([1, undefined], 42)).toBeUndefined();
|
||||
expect(last([0], 99)).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user