add core docs

This commit is contained in:
2025-02-10 09:48:59 -06:00
parent 7283ced1ca
commit 375a6ad3a4
74 changed files with 5148 additions and 643 deletions

View File

@@ -5,7 +5,7 @@ A collection of general-purpose utility functions for object manipulation, mergi
deep copying, safe property access, etc.
### guid
### guid() <sub>function</sub>
Return a random 32-character hexadecimal UUID-like string (not guaranteed RFC4122-compliant).
@@ -14,7 +14,7 @@ Return a random 32-character hexadecimal UUID-like string (not guaranteed RFC412
**Returns**: A random 32-character string (hex).
### insertion_sort(arr, cmp)
### insertion_sort(arr, cmp) <sub>function</sub>
In-place insertion sort of an array using cmp(a,b)->Number for ordering.
@@ -28,7 +28,7 @@ In-place insertion sort of an array using cmp(a,b)->Number for ordering.
**Returns**: The same array, sorted in-place.
### deepfreeze(obj)
### deepfreeze(obj) <sub>function</sub>
Recursively freeze an object and all of its nested objects so they cannot be modified.
@@ -40,7 +40,7 @@ Recursively freeze an object and all of its nested objects so they cannot be mod
**Returns**: None
### dainty_assign(target, source)
### dainty_assign(target, source) <sub>function</sub>
Copy non-function properties from source into matching keys of target without overwriting
@@ -55,7 +55,7 @@ keys that don't exist in target. Arrays are deep-copied, and objects are recursi
**Returns**: None
### get(obj, path, defValue)
### get(obj, path, defValue) <sub>function</sub>
Safely retrieve a nested property from obj at path (array or dot-string).
@@ -72,7 +72,7 @@ Returns defValue if the property is undefined.
**Returns**: The nested property or defValue.
### isEmpty(o)
### isEmpty(o) <sub>function</sub>
Return true if the object has no own properties, otherwise false.
@@ -84,7 +84,7 @@ Return true if the object has no own properties, otherwise false.
**Returns**: Boolean indicating if the object is empty.
### dig(obj, path, def)
### dig(obj, path, def) <sub>function</sub>
Ensure a nested path of objects exists inside obj; create objects if missing, and set
@@ -101,7 +101,7 @@ the final path component to def.
**Returns**: The assigned final value.
### access(obj, name)
### access(obj, name) <sub>function</sub>
Traverse obj by dot-separated path name, returning the final value or undefined
@@ -116,7 +116,7 @@ if any step is missing.
**Returns**: The value at that path, or undefined if missing.
### mergekey(o1, o2, k)
### mergekey(o1, o2, k) <sub>function</sub>
Helper for merge, updating key k from o2 into o1. Arrays are deep-copied and objects are
@@ -133,7 +133,7 @@ recursively merged.
**Returns**: None
### merge(target, objs)
### merge(target, objs) <sub>function</sub>
Merge all passed objects into target, copying or merging each key as needed.
@@ -148,7 +148,7 @@ Arrays are deep-copied, objects are recursively merged, etc.
**Returns**: The updated target object.
### copy(proto, objs)
### copy(proto, objs) <sub>function</sub>
Create a new object with proto as its prototype, then mix in additional objects properties.
@@ -162,7 +162,7 @@ Create a new object with proto as its prototype, then mix in additional objects
**Returns**: The newly created object.
### obj_lerp(a, b, t)
### obj_lerp(a, b, t) <sub>function</sub>
Linearly interpolate between two objects a and b by factor t, assuming each property
@@ -179,7 +179,7 @@ supports .lerp().
**Returns**: A new object with interpolated properties.
### normalizeSpacing(spacing)
### normalizeSpacing(spacing) <sub>function</sub>
Normalize any spacing input into a {l, r, t, b} object.