Results for “ps”
Small, practical examples. Search by task or narrow things down below.
Check an external process exit status explicitly
PowerShell: LASTEXITCODE reports a native child exit code independently of ordinary PowerShell cmdlet errors.
PowerShell✓ Tested
Check for a hashtable key before reading it
PowerShell: ContainsKey distinguishes a missing key from a key whose value happens to be null.
PowerShell✓ Tested
Check JSONB containment
Test whether an object contains a key-value pair.
jsonb✓ 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 any item matches
JavaScript: some stops once a predicate succeeds.
JavaScript✓ Tested
Check whether any item matches
TypeScript: some stops once a predicate succeeds.
TypeScript✓ Tested
Check whether every item matches
JavaScript: every stops at the first failed predicate and returns true for an empty array.
JavaScript✓ 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
Choose an action with switch
Map a small command value to a result.
switch✓ Tested
Clamp a number to inclusive bounds
PowerShell: Math.Clamp chooses the nearest endpoint for an out-of-range value.
PowerShell✓ Tested
Clear an owning pointer after releasing its allocation
C: Assigning NULL helps prevent accidental reuse through the same variable.
C✓ Tested