Results for “Measure-Object”
Small, practical examples. Search by task or narrow things down below.
Find members absent from another set
TypeScript: Negate a membership test to calculate the set difference.
TypeScript✓ Tested
Find shared members of two sets
JavaScript: Filter one set through the other set’s membership test.
JavaScript✓ Tested
Find shared members of two sets
TypeScript: Filter one set through the other set’s membership test.
TypeScript✓ Tested
Fit an entire image inside a differently shaped box
CSS: Contain preserves the image aspect ratio while keeping all of it visible inside the specified content box.
CSS✓ Tested
Group records into map entries
JavaScript: Initialize an array for a missing Map key before appending its values.
JavaScript✓ Tested
Group records into map entries
TypeScript: Initialize an array for a missing Map key before appending its values.
TypeScript✓ Tested
Merge configuration maps with override precedence
PowerShell: Copy defaults before applying override keys so the original remains unchanged.
PowerShell✓ Tested
Preserve key insertion order
PowerShell: An ordered dictionary enumerates keys in the order they were inserted.
PowerShell✓ Tested
Prevent runtime changes to top-level properties
JavaScript: Object.freeze prevents ordinary top-level mutations; Reflect.set reports the rejected update without throwing.
JavaScript✓ Tested
Prevent runtime changes to top-level properties
TypeScript: Object.freeze prevents ordinary top-level mutations; Reflect.set reports the rejected update without throwing.
TypeScript✓ Tested
Read a nested optional value
Avoid dereferencing a missing nested object.
optional chaining✓ Tested
Remove a Map entry and detect whether it existed
JavaScript: Map.delete returns true only when an entry was present.
JavaScript✓ Tested