Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (defaultValue && opt.setDefaults) {
pathO.options.default = defaultValue;
if (type.type == 'date') {
pathO.options.default = pathO.options.default.toISOString();
}
}
// TODO: Check if fullpath is undefined. If it is, attach it to options
if (fullPath) {
pathO.arraypath = fullPath + '.' + pathString;
}
addCustomOptions(pathO);
_.extend(obj[path], convertTypeOptions(type.type, pathO.options), type);
} else if (type.type == 'array') {
obj[path] = type;
// Humanize array title
var sentenceCased = changeCase.sentenceCase(path);
var titleCased = changeCase.titleCase(sentenceCased);
obj[path].title = titleCased;
if (type.items.type == 'object') {
// TODO: Pass to the the parseSchema the current path
parseSchema(pathO.schema, obj[path].items.properties, pathO.path);
} else {
type = getType(pathString, pathO.caster.instance);
if (_.isFunction(pathO.options.default)) {
type.default = pathO.options.default();
}
if (defaultValue && opt.setDefaults) {
pathO.options.default = defaultValue;
if (type.type == 'date') {
pathO.options.default = pathO.options.default.toISOString();
}
method.call(sendParams).then((result) => {
let time = Math.ceil((Date.now() - startTime) / 1000.0)
if (result) {
const resp: TestResultInterface = {
type: 'testPass',
value: changeCase.sentenceCase(func.name),
time: time,
context: testName
}
testCallback(undefined, resp)
passingNum += 1
timePassed += time
} else {
const resp: TestResultInterface = {
type: 'testFailure',
value: changeCase.sentenceCase(func.name),
time: time,
errMsg: 'function returned false',
context: testName
}
testCallback(undefined, resp)
failureNum += 1
sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
sc.options["x-schema-form"]["disableSuccessState"] = true;
}*/
if (fullKey == modelConfig.id) {
//set unique index
var sc = getElementSchema(Model.schema.paths, fullKey);
if (sc) {
//Here we should unregister and register the model again (only for set the unique index to true
sc.options.unique = true;
}
}
//Enable pretty title if possible
if (!field.title) {
var sentenceCased = changeCase.sentenceCase(key);
var titleCased = changeCase.titleCase(sentenceCased);
var sc = getElementSchema(Model.schema.paths, fullKey);
if (sc) {
sc.options.title = titleCased;
}
}
if (field.class) {
var sc = getElementSchema(Model.schema.paths, fullKey);
if (sc) {
sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
sc.options["x-schema-form"]["htmlClass"] = field.class;
}
}
if (field.fieldClass) {
function StatusLabel(props) {
const { state, mini, className, ...rest } = props;
return (
<label>
{sentenceCase(state).toUpperCase() || 'UNKNOWN'}
</label>
);
}
const icons = Object.keys(iconsGroupedByName).map(key => {
const iconIsCategorized =
categoryInformation[key] && categoryInformation[key].subcategory;
const group = iconsGroupedByName[key];
const savedIcon = metadata.icons.find(({ name }) => name === key);
const icon = {
name: key,
friendly_name: savedIcon ? savedIcon.friendly_name : sentenceCase(key),
usage: savedIcon ? savedIcon.usage : 'This is a description for usage',
categories: iconIsCategorized
? [
{
name: categoryInformation[key].category,
subcategory: categoryInformation[key].subcategory,
},
]
: [],
aliases: savedIcon ? savedIcon.aliases : [key],
};
if (group.icon) {
icon.sizes = [group.icon.size];
} else if (group.icons) {
icon.sizes = group.icons.map(icon => icon.size);
const headers = fields.map(field => changeCase.sentenceCase(field));
_prettyName(name) {
name = changeCase.sentenceCase(name);
name = changeCase.titleCase(name);
return name;
}
default: data => `${sentenceCase(data.name)} component.`
},