tidy-url icon indicating copy to clipboard operation
tidy-url copied to clipboard

Request: More flexibility with `set`

Open DrKain opened this issue 9 months ago • 0 comments

Right now you can use set(key, value) or setMany(object).
I'd like to allow users to use set for both cases. I was being lazy when I created setMany. In future versions I would like this function to be removed and the set function expanded to fit this issue.

For clarification, a user should be able to use the following:


tidy.set('key', 'value');
tidy.set('another', 'val');
// or 
tidy.set({ key: 'value', another: 'val' });

You should be able to pass either an object or two parameters. In both cases the keys should be validated to ensure they match the config. If something is invalid or doesn't match then a warning should be displayed.
Because this is a breaking change the setMany function should be marked as @deprecated until the next major update.

DrKain avatar May 01 '24 13:05 DrKain