FIND YOUR NEXT FEW LINES

Results for “node”

Small, practical examples. Search by task or narrow things down below.

258 snippets foundClear filters
TypeScriptUtilities & async

Select fields with the Pick utility type

Expose a smaller view of a larger object type.

Pick✓ Tested
JavaScriptArray traversal & selection

Separate a first item from the remaining items

JavaScript: Array destructuring and a rest element produce named pieces of a sequence.

JavaScript✓ Tested
TypeScriptArray traversal & selection

Separate a first item from the remaining items

TypeScript: Array destructuring and a rest element produce named pieces of a sequence.

TypeScript✓ Tested
JavaScriptObjects & JSON

Serialize an object

Turn a JavaScript object into JSON text.

JavaScript✓ Tested
Linux CommandsStreams & byte tools

Set a file to a specific byte length

Linux Commands: Use truncate to shorten a known scratch file without replacing its inode.

Linux Commands✓ Tested
JavaScriptArrays

Sort numbers numerically

Supply a numeric comparator instead of JavaScript string sorting.

JavaScript✓ Tested
JavaScriptUTC date operations

Sort timestamp strings by their parsed instants

JavaScript: Compare epoch values explicitly when date strings may contain different offsets.

JavaScript✓ Tested
TypeScriptUTC date operations

Sort timestamp strings by their parsed instants

TypeScript: Compare epoch values explicitly when date strings may contain different offsets.

TypeScript✓ Tested
JavaScriptArray restructuring

Split an array into bounded batches

JavaScript: Advance by a positive batch size and allow a shorter final chunk.

JavaScript✓ Tested
TypeScriptArray restructuring

Split an array into bounded batches

TypeScript: Advance by a positive batch size and allow a shorter final chunk.

TypeScript✓ Tested
JavaScriptStrings

Split and trim text

Split simple comma-separated JavaScript text and trim each part.

JavaScript✓ Tested
JavaScriptRegular expressions & URL encoding

Split text on several separator characters

JavaScript: A regex character class can recognize alternative simple delimiters.

JavaScript✓ Tested