How to use the @feathersjs/commons.isPromise function in @feathersjs/commons

To help you get started, we’ve selected a few @feathersjs/commons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github feathersjs / feathers / packages / feathers / lib / hooks / index.js View on Github external
const promise = new Promise(resolve => {
            const func = original || service[method];
            const args = service.methods[method].map((value) => hookObject[value]);
            const result = func.apply(service, args);

            if (!isPromise(result)) {
              throw new Error(`Service method '${hookObject.method}' for '${hookObject.path}' service must return a promise`);
            }

            resolve(result);
          });