-
-
Notifications
You must be signed in to change notification settings - Fork 16
.poke
localDataStorage.poke( arrayKeyName, value [, index] )
This is used to place a value onto an existing arrayKeyName, an Array Key, optionally at the index position, as a destructive insert which replaces the original element. When index is omitted, the element is appended to the Array Key by default. When specified, the index is automatically corrected to prevent sparse arrays.
EXAMPLES:
🔹 Existing Array Key called 'course' having value [{'book':'math'}, {'book':'english'}, {'book':'science'}]:
Replace the English book:
● localData.poke( 'course', {'book':'french'}, 2 ); --> [{'book':'math'}, {'book':'french'}, {'book':'science'}]
Append a new book to the array:
● localData.poke( 'course', {'book':'biology'} ); --> [{'book':'math'}, {'book':'french'}, {'book':'science'}, {'book':'biology'}]
The value of the updated arrayKeyName is returned when this method executes.
📝 NOTE: This method is specific to Array Keys and will fail if used on any other key type. This method is related to push and pull. Array Keys use one-based array indices.
Array Keys:
push / pull, pullall poke contains where
Broadcasting:
broadcast
Data Transfer:
import / export
Duplicates:
countdupes, showdupes, listdupes
Internals:
cancrunch crunch / uncrunch
shufflestring / unshufflestring
Management:
keys
Memory Consumption:
Memory Quota:
showquota
Query:
haskey, hasval, hastype
setscramblekey / getscramblekey
Type Check:
isarray isbigint isboolean iscrunch
isdate isfloat isinteger isnull
Utility:
chopget copy softset rename
_set / _get _clear _key _remove
Management:
_keys
Type Check:
_isarray _isbigint _isboolean _iscrunch