Utilities: live code examples
24 examples for 5 libraries. Open one to read how it works, run it in your browser and change it, by hand or with AI.
All 231 examples UI components and icons Forms, validation and schemas Animation and motion 3D and graphics Web frameworks State and data fetching Markdown, editors and content Files, images and media Styling and CSS Auth and security libraries Charts and data visualisation HTTP clients and networking Game development
date-fns 5 examples · usage and stats
Sort objects by a date field in date-fnsRename the due field or add tasks to try it with your own data.
Format a date as yyyy-MM-dd in date-fnsChange the numbers in new Date() to see different formatted dates.
Sort dates oldest first in date-fnsAdd more dates to the array and the sorted list updates on the next run.
Sort dates newest first in date-fnsBoth lines come from the same array, sorted with different callbacks.
Group dates by day in date-fnsAdd events with different hours on the same day and watch that day's count grow.uuid 5 examples · usage and stats
Random UUIDs with uuid v4Run it a few times: the plain v4() lines change, the fixed-bytes line stays 109156be-c4fb-41ea-b1b4-efe1671c5836.
Time-based UUIDs with uuid v7The decoded time of v7 #1 is the moment you ran the code; change the date in Date.UTC to move the fixed one.
Name-based UUIDs with uuid v5Change "Hello, World!" or an email and the UUID changes; run again with the same text and it stays the same.
Validating UUIDs with uuidAdd your own strings to the samples object and see which ones pass.
Converting UUIDs to bytes with uuidChange the id string and compare its hex pairs with the bytes line.yaml 5 examples · usage and stats
Parse YAML in JavaScript with yamlAdd a new key to the YAML text and print it, or change port to a quoted string to see its type change.
Convert an object to YAML with yamlAdd a nested array of objects to config and watch how stringify lays it out.
Parse options and schemas in yamlTry other values such as 'yes', 'on' or '0o14' with and without version: '1.1'.
Multi-document YAML with yamlAdd a fourth document to the stream and watch the count change.
Edit YAML without losing commentsAdd another comment to the source text and change a different key with doc.set.js-yaml 4 examples · usage and stats
Parse YAML with js-yaml load()Add a new key to the YAML text and print it with another console.log line.
Write YAML with js-yaml dump()Add another nested object to config and see how dump() indents it.
Handle YAML parse errors in js-yamlFix one of the broken snippets and watch it move from the error list to the OK list.
Update a YAML config with js-yamlChange a different field before dumping, for example set debug to true.Lodash 5 examples · usage and stats
Default values with _.defaultsAdd a key to userOptions and see it override the default in the output.
Split arrays with _.partitionChange the predicate, for example to n => n > 2, and watch both groups change.
Read nested values with _.atAdd a path such as 'orders[1].items[0]' to the list and rerun.
Iterate collections with LodashSwap the word in the string example and the per-letter output changes.
Compose functions with LodashAdd a fourth step to the slugify pipeline, such as cutting the result to 20 characters.