.copy - macmcmeans/localDataStorage GitHub Wiki

localDataStorage.copy( sourceKeyName, destinationKeyName )

This method creates a new key, destinationKeyName, from the value stored under sourceKeyName, respecting the data type.

Existing keys cannot be overwritten.

EXAMPLES:

● localData.set( 'key1', 14.99 ) ● localData.copy( 'key1', 'newkey1' ) ● localData.get( 'newkey1' )   -->   14.99

🌐 This method may fire an event allowing you to monitor the key change.

🏿 The corresponding Memory Key method is _copy.

⚠️ Obfuscated keys cannot be successfully copied over to a new key. When a global scramble key has been employed in their creation, the interface can detect this and throw a warning. However, there is no way the library can detect when a user scramble key was used. In this case, the copy operation will take place, but the destinationKeyName will contain a value that cannot be retrieved, effectively polluting the store with a useless key.