add deprecation messages for select and selectV2

This commit is contained in:
Simon Knox 2018-01-15 22:52:29 +11:00
parent 92a68f0f49
commit 81864f817d

View File

@ -1,3 +1,4 @@
import deprecate from 'util-deprecate';
import KnobManager from './KnobManager';
export const manager = new KnobManager();
@ -46,11 +47,17 @@ export function object(name, value) {
}
export function select(name, options, value) {
return manager.knob(name, { type: 'select', options, value });
return deprecate(
manager.knob(name, { type: 'select', options, value }),
'in v4 keys/values of the options argument are reversed'
);
}
export function selectV2(name, options, value) {
return manager.knob(name, { type: 'select', selectV2: true, options, value });
return deprecate(
manager.knob(name, { type: 'select', selectV2: true, options, value }),
'in v4 selectV2 will be renamed to select'
);
}
export function array(name, value, separator = ',') {