Here is what I think I will use:
function verifyEasing(input) { return 'linear' === input || ($.easing && $.easing.hasOwnProperty(input)) ? input : false; }
If the input is 'linear' or if it is accessible from the jQuery UI, it will return it. Otherwise, it will return false . I did it like b / c, if you pass false as the attenuation value .toggle() , then the default will be 'swing' - no need to check for swing . Like this:
$('.target').toggle( 800, verifyEasing(input) );
I think if you want to test custom relief functions as well, you can add a $.isFunction to the boolean:
'linear' === input || ($.easing && $.easing.hasOwnProperty(input)) || $.isFunction(input)
source share