Results for “require”
Small, practical examples. Search by task or narrow things down below.
Display a fallback for missing data
SQLite: Return a supplied label when a column contains NULL.
SQLite✓ Tested
Display a hint for a truly empty container
CSS: The empty selector requires no element or text children, including whitespace text nodes.
CSS✓ Tested
Display a number with a fixed decimal width
TypeScript: toFixed returns a formatted string rather than a numeric value.
TypeScript✓ Tested
Distinguish a bare repository from a working checkout
Git: rev-parse reports repository mode without relying on directory naming conventions.
Git✓ Tested
Distinguish a file from a directory
PowerShell: Test-Path can constrain the kind of item that is accepted.
PowerShell✓ Tested
Distinguish an empty input line from end of input
Bash Scripts: A successful read can return an empty value; its status indicates whether a line was read.
Bash Scripts✓ Tested
Distinguish an own property from an inherited one
TypeScript: Object.hasOwn avoids depending on an object’s possibly shadowed hasOwnProperty method.
TypeScript✓ Tested
Distinguish row count from non-null value count
SQL Server: COUNT(*) includes every row while COUNT(column) skips NULL values.
SQL Server✓ Tested
Distinguish row count from non-null value count
Postgres: COUNT(*) includes every row while COUNT(column) skips NULL values.
Postgres✓ Tested
Distinguish row count from non-null value count
SQLite: COUNT(*) includes every row while COUNT(column) skips NULL values.
SQLite✓ Tested
Distinguish staged changes from working edits
Git: Distinguish staged changes from working edits inside the disposable repository created by the input setup.
Git✓ Tested
Distinguish unset variables from empty strings
Bash Scripts: Omitting the colon tests only whether a variable is unset; including it also treats an empty value as missing.
Bash Scripts✓ Tested