Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// Extend the base object
for (name in options) {
src = getProperty(target, name);
copy = getProperty(options, name);
// Prevent never-ending loop
if (target === copy) {
continue;
}
// Recurse if we're merging plain objects or arrays
if (deep && copy && (is.hash(copy) || (copyIsArray = is.array(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && is.array(src) ? src : [];
} else {
clone = src && is.hash(src) ? src : {};
}
// Never move original objects, clone them
setProperty(target, name, extend(deep, clone, copy));
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
setProperty(target, name, copy);
}
}
}
}
// Return the modified object
function preEncode(value) {
const numberShouldBeStringified =
(!(value instanceof Float) && is.integer(value)) ||
value instanceof Int || is.infinite(value) || Number.isNaN(value);
if (is.date(value)) {
value = value.toJSON();
} else if (
value instanceof SpannerDate || value instanceof Float ||
value instanceof Int) {
value = value.value;
} else if (Buffer.isBuffer(value)) {
value = value.toString('base64');
} else if (Struct.isStruct(value)) {
value = value.map(field => preEncode(field.value));
} else if (is.array(value)) {
value = value.map(preEncode);
} else if (is.object(value) && is.fn(value.hasOwnProperty)) {
for (const prop in value) {
if (value.hasOwnProperty(prop)) {
value[prop] = preEncode(value[prop]);
}
}
}
if (numberShouldBeStringified) {
value = value.toString();
}
return value;
}
// tslint:disable-next-line no-any
}, function(err, status) {
assert.ifError(err);
assert.strictEqual(is.array(status), true);
done();
});
});
var tag = function tag(tagName, attrsMap, content, contentIsEscaped) {
var safeTagName = htmlEscape(tagName);
var attrsHTML = !is.array(attrsMap) ? attrs(attrsMap) : reduce(attrsMap, function (html, map) {
return html + attrs(map);
}, '');
var safeContent = contentIsEscaped ? content : htmlEscape(content);
return '<' + safeTagName + attrsHTML + (isSelfClosing(safeTagName) ? ' />' : '>' + safeContent + '');
};
extractParams ( destinations, onProgress, options ) {
if ( destinations && !is.string( destinations ) && !is.array( destinations ) && !( destinations instanceof Stream ) ) {
options = onProgress;
onProgress = destinations;
destinations = [];
}
if ( is.object( onProgress ) ) {
options = onProgress;
onProgress = null;
}
if ( destinations && !is.array( destinations ) ) {
destinations = [ destinations ];
} else if ( !destinations ) {
destinations = [];
}
destinations = destinations.map( destination => {
if ( is.string( destination ) ) {
destination = fs.createWriteStream( destination );
}
return destination;
} );
return [ destinations, onProgress, options ];
}
function RulesList(rules) {
if (rules instanceof Rule) {
return new Immutable.List([rules]);
}
if (is.array(rules)) {
return new Immutable.List(rules);
}
if (rules instanceof RulesSet) {
return rules.getRules();
}
return rules || new Immutable.List();
}
contentId: sender.url( 'video', urlParams ),
contentType: 'video/mp4',
tracks: null,
metadata: {
type: 0,
metadataType: 0,
itemId: media.id,
title: media.title,
images: [
{ url: media.cover }
]
}
};
if ( media.subtitles ) {
if ( !is.array( media.subtitles ) ) {
media.subtitles = [ media.subtitles ];
}
let tracks = [];
for ( let [ index, subtitles ] of media.subtitles.entries() ) {
if ( is.string( subtitles ) ) {
subtitles = {
source: subtitles
};
}
tracks.push( {
trackId: subtitles.id || index,
type: 'TEXT',
trackContentId: sender.url( 'subtitles', urlParams ),
trackContentType: subtitles.type || 'text/vtt',
*/
if (hasAncestors) {
ancestors = ancestors.slice();
}
let path;
if (id) {
path = hasAncestors ? ancestors.concat([self.entityKind, id]) : [self.entityKind, id];
} else {
if (hasAncestors) {
ancestors.push(self.entityKind);
}
path = hasAncestors ? ancestors : self.entityKind;
}
if (namespace && !is.array(path)) {
path = [path];
}
return namespace ? self.gstore.ds.key({ namespace, path }) : self.gstore.ds.key(path);
}
function getScopeForDeleteHooks() {
const id = is.object(args[0]) && {}.hasOwnProperty.call(args[0], '__override')
? arrify(args[0].__override)[0]
: args[0];
if (is.array(id)) {
return null;
}
let ancestors;
let namespace;
let key;
if (hookType === 'post') {
({ key } = args);
if (is.array(key)) {
return null;
}
} else {
({
1: ancestors,
2: namespace,