Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return navItems.map((nav) => {
let sectionKey = localizationPrefix + camelize(nav.title).toLowerCase();
let navTranslated = intl.t(sectionKey);
set(nav, 'localizedTitle', navTranslated);
// Map all of the sub navs, too
set(nav, 'subnav', nav.subnav.map((sub) => {
let subItemKey = `${localizationPrefix}subnav.${camelize(sub.title)}`;
let subTranslated = intl.t(subItemKey);
set(sub, 'localizedTitle', subTranslated);
return sub;
}));
return nav;
});
}),
function getFieldEditorSectionElement(name) {
return find(`[data-test-field-name="${camelize(name)}"]`);
}
contentOuterSize() {
return this.contentElement[camelize(`outer-${this.sizeAttr}`)]();
}
export default function metaForField(content, fieldName) {
if (!content) {
return;
}
fieldName = camelize(fieldName);
try {
return content.constructor.metaForProperty(fieldName);
} catch (err) {
return;
}
}
_normalizeFlag(flag) {
return camelize(flag);
},
get displayedItems() {
if (!this.currentFolder) {
return [];
}
let sortedItems: File[] = this.currentFolder.files.toArray();
if (this.sort) {
const regex = /^(-?)([-\w]+)/;
const groups = regex.exec(this.sort)!;
groups.shift();
const [reverse, sortKey] = groups.slice(0, 2);
sortedItems = sortedItems.sortBy(camelize(sortKey));
if (reverse) {
sortedItems = sortedItems.reverse();
}
sortedItems = sortedItems.slice(0, this.maxFilesDisplayed);
}
return [
...this.lastUploaded,
...sortedItems.filter(item => !this.lastUploaded.includes(item)),
];
}
const collectionNameForType = (type: any) => pluralize(camelize(typeof(type) === 'string' ? type : type.modelName));
export const rootCollection = (adapter: RealtimeDatabaseAdapter, type: any) => databaseInstance(adapter).then(database => database.ref([get(adapter, 'namespace'), collectionNameForType(type)].join('/')));
function getParamValue(obj, paramName, optional){
var camelizedName = camelize(paramName),
value = get(obj, camelizedName);
if (!optional) {
if ( !isValue(value) && isValue(get(obj, paramName))) {
throw new Error(
'Use camelized versions of url params. (Did not find ' +
'"' + camelizedName + '" property but did find ' +
'"' + paramName + '".');
}
if (!isValue(value)) {
throw new Error(
'Missing url param: "'+paramName+'". (Looked for: property named "' +
camelizedName + '".'
);
}
error.payload.errors.forEach((error) => {
let {message, property = ''} = error;
property = camelize(property);
if (property && attrs.includes(property)) {
this.webhook.errors.add(property, message);
this.webhook.hasValidated.pushObject(property);
} else {
this.set('error', `Error: ${message}`);
}
});
import { serviceLinks } from 'ember-osf-web/const/service-links';
import { layout } from 'ember-osf-web/decorators/component';
import styles from './styles';
import template from './template';
const { featureFlagNames: { ABTesting } } = config;
@layout(template, styles)
@tagName('')
export default class HomeHeroBanner extends Component {
@service features!: Features;
@alias(`features.${camelize(ABTesting.homePageHeroTextVersionB)}`)
shouldShowVersionB!: boolean;
@action
search(query: string) {
const { search } = serviceLinks;
window.location.href = `${search}?q=${query}&page=1`;
}
}