export const debouncePromise = function ( promisedFunc , timeout = 0 ) { var timer ; return ( ... params ) => new Promise ( ( resolve , reject ) => { clearTimeout ( timer ) ; timer = window . setTimeout ( ( ) => resolve ( promisedFunc . apply ( this , params ) ) , timeout ) ; } ) ; } ;