Results for “du”
Small, practical examples. Search by task or narrow things down below.
Generate every combination of two sets
Postgres: CROSS JOIN creates one result per possible pair, so the output size is the product of the input sizes.
Postgres✓ Tested
Generate every combination of two sets
SQLite: CROSS JOIN creates one result per possible pair, so the output size is the product of the input sizes.
SQLite✓ Tested
Give an optional property a default
Handle missing object fields with nullish coalescing.
optional✓ Tested
Group by more than one field
SQL: Each distinct combination of grouping fields produces its own row.
SQL✓ Tested
Group by more than one field
SQL Server: Each distinct combination of grouping fields produces its own row.
SQL Server✓ Tested
Group by more than one field
Postgres: Each distinct combination of grouping fields produces its own row.
Postgres✓ Tested
Group by more than one field
SQLite: Each distinct combination of grouping fields produces its own row.
SQLite✓ Tested
Group records into map entries
TypeScript: Initialize an array for a missing Map key before appending its values.
TypeScript✓ Tested
Handle a filename pattern with no matches
Use nullglob so an unmatched pattern produces an empty array.
nullglob✓ Tested
Handle a result with a discriminated union
Separate success data from an error message.
discriminated union✓ Tested
Handle a terminating error
Catch conversion failures and produce a clear fallback.
try catch✓ Tested
Handle three possible outcomes
TypeScript: Check high, normal and low values with an ordered conditional chain.
TypeScript✓ Tested