Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const inferredElements = getElementsFromRecords(
[record],
showFieldTypes
);
const inferredChild = new InferredElement(
showFieldTypes.show,
null,
inferredElements
);
process.env.NODE_ENV !== 'production' // eslint-disable-line
// eslint-disable-next-line no-console
&& console.log(
`Guessed Show:
export const ${inflection.capitalize(
inflection.singularize(resource)
)}Show = props => (
${inferredChild.getRepresentation()}
);`
);
this.setState({ inferredChild: inferredChild.getElement() }); // eslint-disable-line
}
}
' }',
' ))',
'}'
];
var consumerkey = 'consumerKey';
var consumersec = 'consumerSecret';
if (auth === 'facebook' || auth === 'github') {
consumerkey = 'clientID';
consumersec = 'clientSecret';
}
var authStrategy = [
'',
' // use '+ auth +' strategy',
' passport.use(new '+ inflection.capitalize(auth) +'Strategy({',
' '+ consumerkey +': config.'+ auth +'.clientID,',
' '+ consumersec +': config.'+ auth +'.clientSecret,',
' callbackURL: config.'+ auth +'.callbackURL',
' },',
' function(token, tokenSecret, profile, done) {',
' User.findOne({ \''+ auth +'.id\': profile.id }, function (err, user) {',
' if (err) { return done(err) }',
' if (!user) {',
' user = new User({',
' name: profile.displayName,',
' username: profile.username,',
' provider: \''+ auth +'\',',
' '+ auth +': profile._json',
' })',
' user.save(function (err, user) {',
' if (err) console.log(err)',
name: { type: 'string', set: function (v) {
return inflection.capitalize(v);
}}
});
var buildStateGetter = function (state) {
state = 'is'+inflection.capitalize(state);
return function (path) {
if(/\./.test(path) && this.constructor.validatePath(path)) {
var parts = path.split('.');
path = parts[0];
var newPath = _.last(parts, parts.length-1).join('.');
var subdoc = this.get(path);
if (subdoc instanceof Document) {
return subdoc[state](newPath);
}
}
return this.pathStates[state](path);
};
};
} else {
switch (method) {
case 'get':
fn = 'getOne';
break;
case 'post':
fn = 'update';
break;
case 'delete':
fn = 'destroy';
break;
}
controllerName = './' + inflection.capitalize(controller) + 'Controller';
}
controllerLibrary = require(controllerName);
try {
if (typeof controllerLibrary[fn] === 'function') {
controllerLibrary[fn](req, res, next);
} else {
console.log(controllerName + " not a function");
res.send(404);
}
} catch (error) {
console.log(error);
res.send(404);
}
public get stateName() {
return inflection.capitalize(this.state);
}
}
function model (name, fields) {
name = inflection.capitalize(name)
var model = [
'',
'/**',
' * Module dependencies',
' */',
'',
'var mongoose = require(\'mongoose\')',
' , Schema = mongoose.Schema',
'',
'var '+ name +'Schema = new Schema({'
];
var last = '';
var schema = fields.map(function (field, index) {
last = index == (fields.length - 1) ? '' : ',';
const formatSymbol = compose(str => str + capitalize(type), formatName)
public get stateName() {
return inflection.capitalize(this.state);
}
}