I have a JSON array or literal (passes through JSON.parse).
Requirement: an array of tasks which contains operations which are key/value pairs.
Array of tasks > Array of operations (array of operations at times will contain duplicate key/value pairs)
[
[
{
resize: [1200, 1200]
}, {
moveTo: "dest/nick"
}, {
rename: "{base}-12.{ext}"
}, {
toWeb: true
}, {
rename: "{base}.{ext}"
}
], [
{
resize: [1000, 1000]
}, {
rename: "{base}-10.{ext}"
}
]
]
The code works and I simply want to know if there is a better way of doing this. I had to wrap the individual operations with {}
so that the duplicate keys wouldn't overwrite each other.