Results for “require”
Small, practical examples. Search by task or narrow things down below.
Choose among several numeric ranges
Bash Scripts: An if-elif chain evaluates branches in order and executes the first match.
Bash Scripts✓ Tested
Choose an action with case
Bash Scripts: Choose an action with case with a small standalone Bash program.
Bash Scripts✓ Tested
Choose an action with switch
Map a small command value to a result.
switch✓ Tested
Choose an image’s default directory
Docker / Compose: Choose an image’s default directory with a complete introductory Dockerfile.
Docker / Compose✓ Tested
Choose Bash with pipefail for build commands
Docker / Compose: SHELL changes the interpreter for subsequent shell-form instructions.
Docker / Compose✓ Tested
Choose between two branches
TypeScript: Use if and else to handle an available or empty stock count.
TypeScript✓ Tested
Choose between two script branches
Bash Scripts: Choose between two script branches with a small standalone Bash program.
Bash Scripts✓ Tested
Choose the command a container executes
Docker / Compose: Choose the command a container executes using a locally available Ubuntu image.
Docker / Compose✓ Tested
Choose the signal used for graceful stopping
Docker / Compose: The configured stop signal is recorded in container metadata.
Docker / Compose✓ Tested
Clamp a number between inclusive bounds
TypeScript: Combine Math.min and Math.max when lower is no greater than upper.
TypeScript✓ Tested
Clamp a number to inclusive bounds
PowerShell: Math.Clamp chooses the nearest endpoint for an out-of-range value.
PowerShell✓ Tested
Clamp a numeric setting to a valid range
Bash Scripts: Use arithmetic comparisons before applying a user-supplied bounded setting.
Bash Scripts✓ Tested