mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
tweaking id management...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
fa4c7737f9
commit
1064cb79b3
@ -395,15 +395,21 @@ var BaseBrowserPrototype = {
|
||||
&& Date.now())
|
||||
|| JSON.stringify(value)
|
||||
|
||||
// handle duplicate ids -> err if found...
|
||||
if(opts.id && opts.id in new_index){
|
||||
throw new Error(`make(..): duplicate id "${key}": `
|
||||
+`can't create multiple items with the same key.`) }
|
||||
|
||||
// handle duplicate keys...
|
||||
var k = key
|
||||
while(k in new_index){
|
||||
// no duplicate keys...
|
||||
// duplicate keys disabled...
|
||||
if(options.noDuplicateValues){
|
||||
throw new Error(`make(..): duplicate key "${key}": `
|
||||
+`can't create multiple items with the same key.`) }
|
||||
|
||||
// create a new key...
|
||||
k = k +' '+ Date.now()
|
||||
k = key +' '+ Date.now()
|
||||
}
|
||||
key = opts.id = k
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user