UNPKG

@nasp/icons

Version:

Universal design and icon system for NASP Asset Studio, with NaspScript language support.

48 lines (38 loc) 1.62 kB
# Helper Utilities This document describes the utility modules available in the NASP Design Kit. ## colorUtils.js - `isHexColor(str)` — Validate hex color. - `parseColor(str)` — Parse hex or color name. - `lighten(hex, percent)` — Lighten a color. - `darken(hex, percent)` — Darken a color. - `randomColor()` — Generate a random color. ## stringUtils.js - `toPascalCase(str)` — Convert to PascalCase. - `toCamelCase(str)` — Convert to camelCase. - `toKebabCase(str)` — Convert to kebab-case. - `capitalize(str)` — Capitalize first letter. ## arrayUtils.js - `unique(arr)` — Remove duplicates. - `flatten(arr)` — Flatten nested arrays. - `chunk(arr, size)` — Split array into chunks. - `shuffle(arr)` — Shuffle array. ## objectUtils.js - `deepClone(obj)` — Deep clone an object. - `merge(target, ...sources)` — Merge objects. - `pick(obj, keys)` — Pick keys from object. - `omit(obj, keys)` — Omit keys from object. ## mathUtils.js - `clamp(val, min, max)` — Clamp value. - `lerp(a, b, t)` — Linear interpolation. - `roundTo(val, decimals)` — Round to decimals. - `randomInt(min, max)` — Random integer. ## domUtils.js - `createElement(tag, attrs, children)` — Create DOM element. - `setAttributes(el, attrs)` — Set attributes. - `addClass(el, cls)` — Add class. - `removeClass(el, cls)` — Remove class. ## dslExtensions.js - `registerCommand(name, handler)` — Register a custom DSL command. - `getCommands()` — Get all registered commands. --- **See source in `src/helpers/` for more details and examples.**