rollup/rollup-plugin-replace

Why is the input an object and not an array?

yairEO opened this issue · 0 comments

Seems like it would be easier to pass a 2D array rather than an Object, due to the limitation of key names:

As an Object

{
  "[a]" : 1,
  "{b}" : 2
}

As an Array

[
  ["[a]", 1],
  ["{b}", 2]
]

Seems more logical to me no? you could then also pass more settings per replacement like so:

Array with replacement settings

[
  ["[a]", 1, 'i'] // case-insensitive search
]

As an Array with Regex

[
  [/\/foo\/, '/bar/foo/', g]
]