Results for “Hashtables & object records”
Small, practical examples. Search by task or narrow things down below.
Find lines common to two sorted files
Linux Commands: Use comm -12 to suppress the two columns of unmatched lines.
Linux Commands✓ Tested
Find lines unique to the first sorted file
Linux Commands: Use comm -23 to retain only records absent from the second input.
Linux Commands✓ Tested
Find members absent from another set
JavaScript: Negate a membership test to calculate the set difference.
JavaScript✓ Tested
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
Join two sorted files by a shared key
Linux Commands: Use join for sorted, simple delimiter-separated records with one row per key.
Linux Commands✓ 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
Print only duplicate values
Linux Commands: Use uniq -d after sorting to report each repeated value once.
Linux Commands✓ Tested
Read a nested optional value
Avoid dereferencing a missing nested object.
optional chaining✓ Tested