()
| 2395 | } |
| 2396 | |
| 2397 | func ExamplePipe_Freq() { |
| 2398 | input := strings.Join([]string{ |
| 2399 | "apple", |
| 2400 | "orange", |
| 2401 | "banana", |
| 2402 | "banana", |
| 2403 | "apple", |
| 2404 | "orange", |
| 2405 | "kumquat", |
| 2406 | "apple", |
| 2407 | "orange", |
| 2408 | "apple", |
| 2409 | "banana", |
| 2410 | "banana", |
| 2411 | "apple", |
| 2412 | "apple", |
| 2413 | "orange", |
| 2414 | "apple", |
| 2415 | "apple", |
| 2416 | "apple", |
| 2417 | "apple", |
| 2418 | }, "\n") |
| 2419 | script.Echo(input).Freq().Stdout() |
| 2420 | // Output: |
| 2421 | // 10 apple |
| 2422 | // 4 banana |
| 2423 | // 4 orange |
| 2424 | // 1 kumquat |
| 2425 | } |
| 2426 | |
| 2427 | func ExamplePipe_Get() { |
| 2428 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |