FIND YOUR NEXT FEW LINES

Results for “utility type”

Small, practical examples. Search by task or narrow things down below.

219 snippets foundClear filters
RustFunctions & data types

Implement a method on a struct

Implement a method on a struct in a complete Rust program using the standard library.

Rust✓ Tested
CSSType & reading flow

Increase spacing between words

CSS: Word-spacing adds to the font’s normal space width.

CSS✓ Tested
TypeScriptPromises & iteration protocols

Inspect both successful and failed promise results

TypeScript: allSettled preserves input order and reports failures without rejecting the combined promise.

TypeScript✓ Tested
TypeScriptRegular expressions & URL encoding

Inspect the parsed pieces of a URL

TypeScript: Use URL properties rather than splitting a URL at punctuation.

TypeScript✓ Tested
TypeScriptArray traversal & selection

Iterate with array indices and values

TypeScript: entries provides each position and value without a separate counter.

TypeScript✓ Tested
AngularAccessibility & reusable patterns

Keep a secondary button from submitting a form

Keep a secondary button from submitting a form with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
HTMLForm behavior

Keep an action button from submitting a form

HTML: Specify type button for controls whose purpose is a local action.

HTML✓ Tested
TypeScriptArray restructuring

Keep both matching and rejected values

TypeScript: Use two explicit outputs when a caller needs both sides of a classification.

TypeScript✓ Tested
CSSType & reading flow

Lay out a short label in a vertical writing mode

CSS: Writing-mode changes the direction in which lines and inline content are laid out.

CSS✓ Tested
TypeScriptObject behavior & collections

List an object’s own enumerable keys

TypeScript: Object.keys omits inherited and non-enumerable properties.

TypeScript✓ Tested
TypeScriptArray restructuring

Map items to multiple output values

TypeScript: flatMap combines mapping and a one-level flattening operation.

TypeScript✓ Tested
TypeScriptGetting Started

Measure a short text value

TypeScript: Read the length of an ASCII string. Non-ASCII text may use multiple code units or bytes depending on the language.

TypeScript✓ Tested