import isFunction from 'lodash/isFunction' ; export default function promisify ( cb , params ? ) { return new Promise < any > ( ( resolve , reject ) => { if ( params ) cb ( params , ( err , res ) => { if ( err ) reject ( err ) ; resolve ( res ) ; } ) ; else if ( isFunction ( cb ?. tokenize ) ) { cb ?. tokenize ( ( err , payload ) => { if ( err ) reject ( err ) ; resolve ( payload ) ; } ) ; } else cb ( ( err , res ) => { if ( err ) reject ( err ) ; resolve ( res ) ; } ) ; } ) ; }