Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function scaffold(type, subModule, name, createNewSubModule, cb) {
var componentPath = type + 's/' + subModule + '/' + name;
var ops = {
name: name,
type: type,
subModule: subModule,
camel: changeCase.camel(name)
};
if (createNewSubModule) {
fs.mkdirSync('src/' + type + 's/' + subModule);
}
// certain types need special variables
switch (type) {
case 'directive':
ops.camel = 'li' + changeCase.pascalCase(subModule) + changeCase.pascalCase(name);
ops.markup = 'li:' + [subModule, name].join('-');
ops.cssClass = ['lia', subModule, name].join('-');
break;
case 'service':
ops.camel = '$li' + changeCase.pascalCase(name);
break;
function link ($scope, $element, $attrs) {
if (_.isUndefined($scope.stepInput.model)) {
throw new Error('The "tractor-step-input" directive requires a "model" attribute.');
}
if (_.isUndefined($scope.stepInput.label)) {
throw new Error('The "tractor-step-input" directive requires a "label" attribute.');
}
if (_.isUndefined($attrs.form)) {
throw new Error('The "tractor-step-input" directive requires a "form" attribute.');
}
$scope.stepInput.form = $scope.$parent[$attrs.form];
$scope.stepInput.id = Math.floor(Math.random() * Date.now());
$scope.stepInput.property = camelcase($scope.stepInput.label);
$scope.handleKeyDown = function (event) {
if (event.keyCode === 40) {
event.preventDefault();
if ($scope.selectedIndex !== $scope.stepInput.items.length - 1) {
$scope.selectedIndex += 1;
}
}
else if (event.keyCode === 38) {
event.preventDefault();
if ($scope.selectedIndex !== 0) {
$scope.selectedIndex -= 1;
}
}
else if (event.keyCode === 27) {
$scope.stepInput.isOpen = false;
);
this.fs.copyTpl(
this.templatePath('template/test_tsconfig.json'),
this.destinationPath('test/tsconfig.json'),
{
sourceMain: this.props.sourceMain
}
);
if (~this.props.sourceUsages.indexOf('commonjs')) {
this.fs.write('test/test.ts',
[
`import test = require('${this.props.testFramework}');`,
'',
`import ${changeCase.camel(this.props.sourceDeliveryPackageName)} = require('${this.props.sourceDeliveryPackageName}');`,
''
].join('\n'));
}
else if (~this.props.sourceUsages.indexOf('esm')) {
this.fs.write('test/test.ts',
[
`import test = require('${this.props.testFramework}');`,
'',
`import ${changeCase.camel(this.props.sourceDeliveryPackageName)} from '${this.props.sourceDeliveryPackageName}';`,
''
].join('\n'));
}
else if (~this.props.sourceUsages.indexOf('amd')) {
this.fs.write('test/test.ts',
[
'define((require, module, exports) => {',
get: function () {
return camel(this.name);
}
},
function link ($scope, $element, $attrs) {
if (_.isUndefined($scope.model)) {
throw new Error('The "tractor-select" directive requires a "model" attribute.');
}
if (_.isUndefined($scope.label)) {
throw new Error('The "tractor-select" directive requires a "label" attribute.');
}
$scope.property = camelcase($scope.label);
$scope.selectOptions = getOptionsFromProperty($scope);
if (_.isUndefined($scope.selectOptions) && _.isUndefined($scope.options)) {
throw new Error('The "tractor-select" directive requires an "options" attribute, or a "label" attribute that matches a set of options on the "model".');
}
$scope.$watchCollection('options', function () {
$scope.selectOptions = $scope.options || getOptionsFromProperty($scope);
});
$scope.form = $scope.$parent[$attrs.form] || $scope.$parent.$ctrl[$attrs.form];
$scope.id = Math.floor(Math.random() * Date.now());
}
function link ($scope) {
if (_.isUndefined($scope.model)) {
throw new Error('The "tractor-checkbox" directive requires a "model" attribute.');
}
if (_.isUndefined($scope.label)) {
throw new Error('The "tractor-checkbox" directive requires an "label" attribute.');
}
$scope.property = camelcase($scope.label);
}
};
forecasts = forecasts.map(function(forecast) {
return {
icon: changeCase.camel(forecast.icon),
time: forecast.time,
summary: forecast.summary,
humidity: Math.ceil(forecast.humidity * 100),
temperatureLow: Math.ceil(forecast.temperatureLow),
temperatureHigh: Math.ceil(forecast.temperatureHigh),
precipitationIntensity: Math.ceil(forecast.precipIntensity * 1000),
precipitationProbability: Math.ceil(forecast.precipProbability * 100)
};
});
get: function () {
return camel(this.mockData.name);
}
},
.then(() => transforms.transformIdentifiers(file, changeCase.camel(oldName), changeCase.camel(newName)))
.then(() => transforms.transformMetadata(file, null, oldName, newName))
return helpers.processObjectKeys(response, key => { return camel(key); });
},