Blame view

node_modules/loopback-connector/lib/utils.js 552 Bytes
f7563de62   Palak Handa   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  // Copyright IBM Corp. 2012,2016. All Rights Reserved.
  // Node module: loopback-datasource-juggler
  // This file is licensed under the MIT License.
  // License text available at https://opensource.org/licenses/MIT
  
  var Promise = require('bluebird');
  
  exports.createPromiseCallback = createPromiseCallback;
  
  function createPromiseCallback() {
    var cb;
    var promise = new Promise(function(resolve, reject) {
      cb = function(err, data) {
        if (err) return reject(err);
        return resolve(data);
      };
    });
    cb.promise = promise;
    return cb;
  }