Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parseName(fullName) {
const nameParts = fullName.split(":");
const type = nameParts[0];
let fullNameWithoutType = nameParts[1];
const namespace = get(this, "namespace");
const root = namespace;
return {
fullName,
type,
fullNameWithoutType,
name: fullNameWithoutType,
root,
resolveMethodName: "resolve" + classify(type),
};
}
const modelFixtureTree = APP_MODULES.reduce((result, moduleReference) => {
if (/\/memserver\/fixtures/g.test(moduleReference)) {
const modelName = classify(singularize(moduleReference.split('/').slice(-1)[0]));
const fixtures = require(moduleReference, null, null, true).default;
if (!fixtures) {
throw new Error(`[MemServer] ${moduleReference} cannot be loaded, please check if you are exporting an array!`)
}
result[modelName] = Object.assign(result[modelName] || {}, { fixtures: fixtures });
} else if (/\/memserver\/models/g.test(moduleReference)) {
const modelName = classify(moduleReference.split('/').slice(-1)[0]);
const model = require(moduleReference, null, null, true).default;
if (!model) {
throw new Error(`[MemServer] ${moduleReference} cannot be loaded, please check if you are the model correctly!`)
}
result[modelName] = Object.assign(result[modelName] || {}, { model: model });
}
return result;
}, {});
sizeClassName: computed('size', function() {
const size = this.get('size');
return `Polaris-DisplayText--size${classify(size)}`;
}).readOnly(),
});
imageClasses: computed('size', function() {
let classes = ['Polaris-DropZone-FileUpload__Image'];
let size = this.get('size');
if (['extraLarge', 'large'].includes(size)) {
classes.push(`Polaris-DropZone-FileUpload--size${classify(size)}`);
}
return classes.join(' ');
}).readOnly(),
});
export default Component.extend({
layout,
tagName: '',
projectVersion: service(),
projectHref,
latestVersionName,
didInsertElement() {
this._super(...arguments);
this.get('projectVersion').loadAvailableVersions();
},
logo: classify(addonLogo(projectName)),
/**
The prefix of your project, typically "Ember", "EmberCLI" or "EmberData".
By default the prefix will be autodiscovered from the `name` field of your addon's package.json.
```hbs
{{docs-header prefix='EmberData'}}
```
@argument prefix
@type String?
*/
prefix: addonPrefix(projectName),
/**
actionHint: computed('type', function() {
let type = this.get('type');
return fileUploadStrings[`actionHint${classify(type)}`];
}),
styleClass: computed('nameString', function() {
let nameString = this.get('nameString');
let styleIndex = isEmpty(nameString)
? 0
: nameString.charCodeAt(0) % styleClasses.length;
let style = styleClasses[styleIndex];
return `Polaris-Avatar--style${classify(style)}`;
}).readOnly(),
Object.keys(breakpoints).forEach((name) => {
const cpName = `is${classify(name)}`;
defineProperty(this, cpName, computed('matches.[]', function () {
return this.get('matches').indexOf(name) > -1;
}));
defineProperty(this, name, computed(cpName, function () {
return this.get(cpName);
}));
this.match(name, breakpoints[name]);
});
}
spacingClassName: computed('spacing', function() {
const spacing = this.get('spacing');
if (isBlank(spacing)) {
return null;
}
return `Polaris-Stack--spacing${classify(spacing)}`;
}).readOnly(),
Object.keys(defaults).map((key: keyof ResizeDefaults) => {
const classifiedKey = classify(key);
const defaultKey = `default${classifiedKey}`;
return set(this as any, defaultKey, defaults[key]);
});
}