-
-
Notifications
You must be signed in to change notification settings - Fork 16
.iscrunch
localDataStorage.iscrunch( keyName )
This method checks the data type of the value stored under keyName to determine if it's a compressed string (a string that's been "crunched"), and returns true or false.
This example demonstrates saving a string to storage, both natively and using localDataStorage, checking the memory used, and then verifying it's a compressed string.
EXAMPLE:
● let txt = 'This is a test of the emergency broadcast system.'
● localData.forceset( 'normalText', txt ) // stores uncompressed, à la localStorage
● localData.valbytes( 'normalText' ) --> 98 bytes // as expected, the key's value is stored using 2 bytes per character
● localData.set( 'compressedText', txt ) // automatically compresses the string if a memory savings can be had
● localData.valbytes( 'compressedText' ) --> 68 bytes // a 31% increase in efficiency
● localData.iscrunch( 'compressedText' ) --> true
🏿 The corresponding Memory Key method is _iscrunch.
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