Code intelligence

vercel/ms at a commit, in the app. TypeScript answers in a worker in the tab. Pick a state, or focus the code and use the keys.

vercel / ms

Code ▾ Copy permalink
4ff48ce ▾ms / src / format.test.ts
180 lines · 8 KB 1 problem RawCopy
1import { describe, expect, it } from '@jest/globals';
2import { format } from './index';
3
4// numbers
5
6describe('format(number, { long: true })', () => {
7 it('should not throw an error', () => {
8 expect(() => {
9 format(500, { long: true });
10 }).not.toThrow();
11 });
12 it('should support milliseconds', () => {
13 expect(format(500, { long: true })).toBe('500 ms');
14 expect(format(-500, { lng: true })).toBe('-500 ms');
15 });
function format(ms: number, options?: Options): string

Format the given integer as a string.

Tab focus the code
← → ↑ ↓ move between symbols
Enter F12 go to definition
r ⇧F12 references
F8 ⇧F8 next, previous problem
o Symbols pane
Esc close the card, then the pane
pointer rest: hover · click: select · ⌘-click: definition

Hybrid, browser first: TypeScript and JavaScript answer in a Web Worker in the tab over the commit's files (no machine, offline once cached). Other languages and installed dependencies answer in the branch's sandbox through the same LSP seam, and only when a box is already running.