Results for “code”
Small, practical examples. Search by task or narrow things down below.
Transform a resolved promise result
TypeScript: A then handler returns the value passed to the next promise in the chain.
TypeScript✓ Tested
Transform a value by shadowing
Transform a value by shadowing in a complete Rust program using the standard library.
Rust✓ Tested
Transform a vector into a separate result
C++: Pre-size the output before writing through its iterator.
C++✓ Tested
Transform an asynchronous result
Java: Chain thenApply and join a CompletableFuture to retrieve the completed value.
Java✓ Tested
Transform an observable value
Transform an observable value with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Transform an optional value
Java: Use Optional.map and orElse to transform a possibly absent result.
Java✓ Tested
Transform an optional value
Transform an optional value in a complete Rust program using the standard library.
Rust✓ Tested
Transform array values
Use map to create a JavaScript array of squared values.
JavaScript✓ Tested
Transform each item in a collection
Build a result array with a foreach expression.
foreach✓ Tested
Transform each item with Select
C#: Project each input value into a new value without modifying the source array.
C#✓ Tested
Transform each pipeline value
PowerShell: Transform each pipeline value using PowerShell 7.
PowerShell✓ Tested
Transform each regex match with a callback
JavaScript: A replacement callback computes the replacement separately for each match.
JavaScript✓ Tested