Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function validatePackageName (package_name) {
// Make the package conform to Java package types
// http://developer.android.com/guide/topics/manifest/manifest-element.html#package
// Enforce underscore limitation
var msg = 'Error validating package name. ';
if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(package_name)) {
return Q.reject(new CordovaError(msg + 'Package name must look like: com.company.Name'));
}
// Class is a reserved word
if (/\b[Cc]lass\b/.test(package_name)) {
return Q.reject(new CordovaError(msg + '"class" is a reserved word'));
}
return Q.resolve();
}
.catch(function(err) {
// real uncatched errors must pass through
if (err instanceof Error) {
return q.reject(err);
}
// transform response rejections into normal responses
return err;
});
}
it('should fail if any functions throw and not log if error is not instanceof Error', function(done) {
var error = 1;
spyOn(ConfigXml, 'setConfigXml').andReturn(Q.reject(error));
compile.run({}, argv, rawCliArguments).then(function() {
expect(log.error).not.toHaveBeenCalled();
done();
});
});
(error) => { return Q.reject(error || unknownErrorMsg); }
);
refreshTokens: function(req, res, user, next) {
return Q.reject('GitHub tokens don\'t expire for another 200,000 years. Either something went wrong or the end times fallen upon us.')
.nodeify(next);
}
};
function isInitialized(bigIp) {
if (bigIp.isInitialized) {
return q();
}
return q.reject();
}
BigIpCluster.prototype.createDeviceGroup = function createDeviceGroup(
deviceGroup,
type,
deviceNames,
options,
retryOptions
) {
let names;
if (!deviceGroup) {
return q.reject(new Error('deviceGroup is required'));
}
if (type !== 'sync-only' && type !== 'sync-failover') {
return q.reject(new Error('type must be sync-only or sync-failover'));
}
if (!Array.isArray(deviceNames)) {
names = [deviceNames];
} else {
names = deviceNames.slice();
}
const retry = retryOptions || util.DEFAULT_RETRY;
const groupOptions = {};
if (options) {
return p.then(null, function(err) {
return Q.reject('git is not installed (or not available on your PATH). Please install it from http://git-scm.com');
});
});