智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/7a/7ad1adcb6505ea41f4bbe4c9571...

35 lines
797 B

var promisify = require('./promisify');
var callbackify = require('./callbackify');
var last = require('./last');
var isFn = require('./isFn');
exports = function(fn, type) {
var callbackFn;
var promiseFn;
if (type === 'callback') {
callbackFn = fn;
promiseFn = promisify(fn);
} else {
promiseFn = fn;
callbackFn = callbackify(fn);
}
return function() {
for (
var _len = arguments.length, args = new Array(_len), _key = 0;
_key < _len;
_key++
) {
args[_key] = arguments[_key];
}
if (isFn(last(args))) {
callbackFn.apply(this, args);
} else {
return promiseFn.apply(this, args);
}
};
};
module.exports = exports;