nl_tokens: Converts a result / error tuple into a promise if the result is not already a promise .
pl_tokens: function createPromise ( result , error ) { // Create a pre-rejected promise for errors. if ( error ) { var deferred = ijsrt . q . defer ( ) ; deferred . reject ( error ) ; return deferred . promise ; } // Create a pre-resolved promise with the result when the result is not a promise. if ( ( result === null ) || ( result === undefined ) || ( typeof result != 'object' ) || ( typeof result . then != 'function' ) ) { var deferred = ijsrt . q . defer ( ) ; deferred . resolve ( result ) ; return deferred . promise ; } return <mask> ; }