Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* @property _supportedMethods
* @type Array
* @private
* @default [ 'head', 'get', 'post' ]
*/
this._supportedMethods = [ 'head', 'get', 'post' ];
// Default all .pages() requests to assume a query against the WP API v2 endpoints
this.namespace( 'wp/v2' );
}
inherit( PagesRequest, CollectionRequest );
// Mixins
extend( PagesRequest.prototype, pick( filters, [
// Specify that we are requesting a page by its path
'path'
] ) );
/**
* A hash table of path keys and regex validators for those path elements
*
* @property _pathValidators
* @type Object
* @private
*/
PagesRequest.prototype._pathValidators = {
// No validation on "id", since it can be a string path OR a numeric ID
/**
var extend = require('node.extend'),
fs = require('fs'),
crypto = require('crypto'),
base = require('../../base/controller.js');
// inherit from base controller
var Controller = extend({
serviceName: 'socrata',
register: function(req, res){
if ( !req.body.host ){
res.send('Must provide a host to register:', 500);
} else {
Socrata.register( req.body.id, req.body.host, function(err, id){
if (err) {
res.send( err, 500);
} else {
res.json({ 'serviceId': id });
}
});
}
},
var passiveCmp = this._emitValueChange('state.mode.passive', true,
oldSensorData, newSensorData, 'mode:passive');
var safeCmp = this._emitValueChange('state.mode.safe', true,
oldSensorData, newSensorData, 'mode:safe');
var fullCmp = this._emitValueChange('state.mode.full', true,
oldSensorData, newSensorData, 'mode:full');
var data = null;
if ((offCmp.changed && offCmp.value) ||
(passiveCmp.changed && passiveCmp.value) ||
(safeCmp.changed && safeCmp.value) ||
(fullCmp.changed && fullCmp.value)) {
data = extend({}, newSensorData.state.mode);
this.emit('mode', data);
}
return data;
};
arg = req.url.split( '?' ),
path = arg.shift( ),
query = qs.parse( arg.pop( ) ),
target = query.$url || '',
key,
self = this;
delete query.$url;
req.url = ( path !== '/' ? path : '' ) + ( Object.keys( query ).length ? ( '?' + qs.stringify( query ) ) : '' );
req._target = target;
var settings = this._getSettings( req._target + req.url );
req._settings = settings;
if(settings.params && Object.keys( settings.params ).length) {
query = extend( true, {},
settings.params, query );
req.url += req.url.indexOf('?') > -1 ? '&' : '?';
req.url += qs.stringify( settings.params );
}
query = sortObject( query );
key = settings.getKey( req._target + req.url, query );
if ( req.method.toLowerCase() === 'options' ) {
if ( self.options.onOptions ) {
self.options.onOptions( req, res );
return;
}
}
function clone(obj) {
return extend(true, Array.isArray(obj) ? [] : {}, obj);
}
function Animation(opts) {
extend(this, opts);
}
var regexp = /^(\d+)s(\d+)r$/g,
result = regexp.exec(str);
if (result.length < 3) {
return null;
}
return {
sets: parseInt(result[1], 10),
reps: parseInt(result[2], 10)
};
};
var setsAndReps = getSetsAndReps(projInfo[1].trim());
if (setsAndReps === null) {
msg.warn('Sport item record is wrong:' + proj + 'in ' +
day.date);
}
return extend({
name: projInfo[0].trim()
}, setsAndReps);
}
});
const renderCategory = function (category, args) {
let items = '';
for (const i in category.categoryItems) {
const categoryItem = category.categoryItems[i];
const item = category.library.getItemById(categoryItem.itemId);
extend(item, categoryItem);
items += renderItem(item, args);
}
category.calculateSubtotal();
category.subtotalWeightDisplay = weightUtils.MgToWeight(category.subtotalWeight, args.totalUnit);
category.subtotalPriceDisplay = category.subtotalPrice ? category.subtotalPrice.toFixed(2) : '0.00';
let temp = Vue.util.extend({}, category);
temp = Vue.util.extend(temp, {
items, subtotalUnit: args.totalUnit, currencySymbol: args.currencySymbol, showPrices: args.showPrices,
});
return Mustache.render(args.categoryTemplate, temp);
};
app.post("/api/report", function (req, res, next) {
res.setTimeout((reporter.options.express || {}).renderTimeout || (20 * 60 * 1000));
req.template = req.body.template;
req.data = req.body.data;
req.options = req.body.options || {};
extend(true, req.headers, req.body.headers);
if (!req.template)
return next("Could not parse report template, aren't you missing content type?");
reporter.render(req).then(function (response) {
//copy headers to the final response
if (response.headers) {
for (var key in response.headers) {
if (response.headers.hasOwnProperty(key))
res.setHeader(key, response.headers[key]);
}
}
if (!response.headers["Content-Disposition"] && !req.options["Content-Disposition"]) {
res.setHeader("Content-Disposition", (req.options.preview ? "inline" : "attachment") + ";filename=report." + response.headers["File-Extension"]);
}
ClientWrapper.prototype.setCredentials = function (new_creds) {
this.credentials = extend(true, this.credentials, new_creds || {});
};