Results for “Hashtables & object records”
Small, practical examples. Search by task or narrow things down below.
Update an object with a readonly input
Create a changed copy while retaining the original.
readonly✓ Tested
Update an object without mutating state
Update an object without mutating state with a small React component and explicit browser behavior.
React✓ Tested
Align an image within its content box
CSS: Object-position places the rendered object when fitting leaves spare space or crops an edge.
CSS✓ Tested
Check whether a file is already sorted
Linux Commands: Use sort -C for a quiet status check that does not rewrite the file.
Linux Commands✓ Tested
Copy nested structured data independently
JavaScript: structuredClone creates an independent copy of supported structured values.
JavaScript✓ Tested
Copy nested structured data independently
TypeScript: structuredClone creates an independent copy of supported structured values.
TypeScript✓ Tested
Count items by group
Group repeated values and report each count.
Group-Object✓ Tested
Count repeated lines after sorting
Linux Commands: Group identical lines before uniq -c, then normalize its leading padding.
Linux Commands✓ Tested
Define an immutable data record
Java: A local record gives a small Java data carrier named accessors and value semantics.
Java✓ Tested
Distinguish an own property from an inherited one
JavaScript: Object.hasOwn avoids depending on an object’s possibly shadowed hasOwnProperty method.
JavaScript✓ Tested
Distinguish an own property from an inherited one
TypeScript: Object.hasOwn avoids depending on an object’s possibly shadowed hasOwnProperty method.
TypeScript✓ Tested
Filter items in a pipeline
Keep numbers that meet a condition.
Where-Object✓ Tested