import parseBuffer = require ( './parse-buffer' ) ; import parseOptions = require ( './parse-options' ) ; import Jscc from '../index' ; const isFunction = ( fn ) : fn is Function => ( ! ! fn && typeof fn === 'function' ) ; param source param filename param options param callback function jscc ( source , filename ? , options ? , callback ? ) { const props = parseOptions ( filename || '' , options || { } ) ; if ( ! isFunction ( callback ) ) { return parseBuffer ( source , props ) ; } process . nextTick ( ( ) => { try { const result = parseBuffer ( source , props ) ; callback ( null , result ) ; } catch ( err ) { callback ( err ) ; } } ) ; return undefined ; } export = jscc ;