Results for “require”
Small, practical examples. Search by task or narrow things down below.
Check what kind of Git object a revision names
Git: cat-file -t distinguishes a commit, tree, blob, or annotated tag.
Git✓ Tested
Check whether a command can be resolved
PowerShell: Get-Command with a local error override supports an expected missing-command lookup.
PowerShell✓ Tested
Check whether a function has been defined
Bash Scripts: declare -F tests a function name without executing it.
Bash Scripts✓ Tested
Check whether a value is a safe integer
TypeScript: Number.isSafeInteger also checks the exact-integer range supported by Number.
TypeScript✓ Tested
Check whether a variable exists under nounset
Bash Scripts: The plus expansion distinguishes an unset variable without reading its missing value.
Bash Scripts✓ Tested
Check whether any item matches
TypeScript: some stops once a predicate succeeds.
TypeScript✓ Tested
Check whether every item matches
TypeScript: every stops at the first failed predicate and returns true for an empty array.
TypeScript✓ Tested
Check whether input is a nonnegative integer
Reject empty input and nonnumeric characters before arithmetic.
validation✓ Tested
Check whether text ends with a suffix
TypeScript: Use endsWith for a literal case-sensitive ending.
TypeScript✓ Tested
Check whether text is valid JSON
Reject malformed input before processing it.
json_valid✓ Tested
Check whether text starts with a prefix
TypeScript: Use startsWith for a literal case-sensitive prefix comparison.
TypeScript✓ Tested
Choose a service’s internal hostname
Docker / Compose: hostname controls the name reported inside the container.
Docker / Compose✓ Tested