Results for “Functions & data types”
Small, practical examples. Search by task or narrow things down below.
Enforce a numeric range at a function boundary
PowerShell: ValidateRange performs argument validation before work begins.
PowerShell✓ Tested
Explain a calculation with a comment
TypeScript: Keep the code executable while documenting why a fixed input is used.
TypeScript✓ Tested
Extract all regex matches with their groups
TypeScript: matchAll requires a global regular expression and returns an iterator of matches.
TypeScript✓ Tested
Extract text by start and end positions
TypeScript: String slice uses an inclusive start and exclusive end measured in UTF-16 code units.
TypeScript✓ Tested
Extract the text after the last delimiter
TypeScript: Use lastIndexOf when earlier occurrences should remain part of the prefix.
TypeScript✓ Tested
Filter observable emissions
Filter observable emissions with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Find members absent from another set
TypeScript: Negate a membership test to calculate the set difference.
TypeScript✓ Tested
Find parents whose every child meets a rule
SQL: Combine existence with the absence of a violating child to exclude parents with no children.
SQL✓ Tested
Find parents whose every child meets a rule
SQL Server: Combine existence with the absence of a violating child to exclude parents with no children.
SQL Server✓ Tested
Find parents whose every child meets a rule
Postgres: Combine existence with the absence of a violating child to exclude parents with no children.
Postgres✓ Tested
Find parents whose every child meets a rule
SQLite: Combine existence with the absence of a violating child to exclude parents with no children.
SQLite✓ Tested
Find parents with at least two child rows
SQL: Use a correlated count when testing a per-parent threshold.
SQL✓ Tested