Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var wrapper = function() {
var context = this;
var last;
for (last = arguments.length - 1; last >= 0; last--) {
var arg = arguments[last];
if (is.undefined(arg)) {
continue; // skip trailing undefined.
}
if (!is.fn(arg)) {
break; // non-callback last argument found.
}
return originalMethod.apply(context, arguments);
}
// peel trailing undefined.
var args = slice.call(arguments, 0, last + 1);
var PromiseCtor = Promise;
// Because dedupe will likely create a single install of
static encodeValue_(value) {
if (is.undefined(value) || is.null(value)) {
return null;
}
if (value instanceof Buffer) {
return value.toString('base64');
}
if (value instanceof Big) {
return value.toFixed();
}
const customTypeConstructorNames = [
'BigQueryDate',
'BigQueryDatetime',
'BigQueryTime',
'BigQueryTimestamp',
middlewareOrder.forEach(function useMiddleware(name) {
const middleware = self.module.middleware[name];
assert(is.undefined(middleware) === false, `[middleware] ${name} is not found`);
if (isFn(middleware)) {
self.use(middleware, name);
}
});
this.prettyLog(JSON.stringify(utils_1.filterBuiltInModule('middleware', middlewareOrder)), {
constructor(value) {
if (arguments.length > 1) {
throw new TypeError([
'The spanner.date function accepts a Date object or a',
'single argument parseable by Date\'s constructor.',
].join(' '));
}
if (is.undefined(value)) {
value = new Date();
}
this.value = new Date(value).toJSON().replace(/T.+/, '');
}
}
static setDefaultValues (obj: Parse.Object, defaultValues: any): Parse.Object {
const object = obj.clone();
for (const key of Object.keys(defaultValues)) {
if (is.undefined(object.get(key))) {
object.set(key, defaultValues[key]);
}
}
return object;
}
function keyToKeyProto(key) {
if (is.undefined(key.kind)) {
throw new InvalidKeyError({
code: 'MISSING_KIND'
});
}
var keyProto = {
path: []
};
if (key.namespace) {
keyProto.partitionId = {
namespaceId: key.namespace
};
}
var numKeysWalked = 0;
return this.match(function(state, text) {
var block = {};
var match = re.exec(text);
if (!match) return null;
if (propsFn) block = propsFn.call(null, state, match);
if (!block) return null;
if (is.array(block)) return block;
block.raw = is.undefined(block.raw)? match[0] : block.raw;
return block;
});
};
static checkAndCorrectMinimumValues (
object: Parse.Object,
minimumValues: {[key: string]: number} = {},
): Parse.Object {
const obj = object.clone();
for (const key in minimumValues) {
if (is.undefined(obj.get(key)) || (obj.get(key) < minimumValues[key])) {
obj.set(key, minimumValues[key]);
}
}
return obj;
}
ObjectToStructConverter.prototype.convert = function(obj) {
var convertedObject = {
fields: {}
};
this.seenObjects.add(obj);
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
var value = obj[prop];
if (is.undefined(value)) {
continue;
}
convertedObject.fields[prop] = this.encodeValue_(value);
}
}
this.seenObjects.delete(obj);
return convertedObject;
};
Rule.prototype.option = function option(key, value) {
if (is.undefined(value)) return this.opts[key];
this.opts[key] = value;
return this;
};