Results for “value”
Small, practical examples. Search by task or narrow things down below.
Validate a finite numeric value without coercion
JavaScript: Number.isFinite rejects numeric strings as well as NaN and infinity.
JavaScript✓ Tested
Validate a finite numeric value without coercion
TypeScript: Number.isFinite rejects numeric strings as well as NaN and infinity.
TypeScript✓ Tested
Validate an unknown value with a type guard
Check a field before treating unknown data as a typed object.
unknown✓ Tested
Wait for several deferred values
jQuery: when resolves only after every supplied deferred has resolved.
jQuery✓ Tested
Wrap a value in a distinct type
Wrap a value in a distinct type in a complete Rust program using the standard library.
Rust✓ Tested
Yield values on demand
Python: Use a generator to produce a sequence without storing all intermediate values.
Python✓ Tested
Add context to a parsing failure
Add context to a parsing failure in a complete Rust program using the standard library.
Rust✓ Tested
Assign a bit from a Boolean state
Arduino / C: bitWrite accepts a bit position and a zero or nonzero value.
Arduino / C✓ Tested
Build a minimum-priority queue
C++: Supply greater as the comparator because priority_queue defaults to the largest value first.
C++✓ Tested
Calculate a CRC-8 over a byte sequence
Arduino / C: This implementation uses polynomial 0x07, initial zero, and no reflection.
Arduino / C✓ Tested
Calculate a SHA-256 content digest
Java: Hash UTF-8 bytes and format the result as lowercase hexadecimal.
Java✓ Tested
Calculate a simple packet XOR checksum
Arduino / C: XOR all payload bytes to produce a basic error-detection byte.
Arduino / C✓ Tested