Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

render_example_test.gno

1.07 Kb · 46 lines
 1package humanizedemo
 2
 3// ExampleRender pins the realm's Render output as a testable example.
 4func ExampleRender() {
 5	print(Render(""))
 6	// Output:
 7	// # Humanize
 8	//
 9	// Integer-only formatting for people, demoing the [`p/moul/x/daily/humanize`](/p/moul/x/daily/humanize/v0) library.
10	//
11	// ## Bytes
12	//
13	// | n | rendered |
14	// |---|---|
15	// | `0` | 0 B |
16	// | `999` | 999 B |
17	// | `1024` | 1 KiB |
18	// | `1536` | 1.5 KiB |
19	// | `1048576` | 1 MiB |
20	// | `1073741824` | 1 GiB |
21	//
22	// ## Thousands
23	//
24	// | n | rendered |
25	// |---|---|
26	// | `0` | 0 |
27	// | `1000` | 1,000 |
28	// | `1234567` | 1,234,567 |
29	//
30	// ## Ordinals
31	//
32	// `1st` · `2nd` · `3rd` · `11th` · `12th` · `13th` · `21st` · `101st`
33	//
34	// > 11th/12th/13th, not 11st/12nd/13rd — the teens are the trap.
35	//
36	// ## Block counts
37	//
38	// | blocks | rendered |
39	// |---|---|
40	// | `0` | now |
41	// | `1` | 1 block |
42	// | `15` | ~10 blocks |
43	// | `1234` | ~1,200 blocks |
44	//
45	// > Deliberately vague, and in **blocks**: there is no wall clock on chain, so "about 2 hours" would be a lie dressed as precision.
46}