How to use the timm.addDefaults function in timm

To help you get started, we’ve selected a few timm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github guigrpa / concise / packages / concise / src / preprocessSchema.js View on Github external
const idField = relatedModel.fields.id;
      if (!idField) {
        throw new Error(
          `ID_FIELD_NOT_FOUND ${modelName}/${relationName}/${relatedModelName}`
        );
      }
      relation.type = idField.type;

      // Create inverse relation, if needed
      const { inverse } = relation;
      if (inverse !== false) {
        let inverseRelation =
          inverse == null || inverse === true
            ? {} // inverse shorthand
            : omit(clone(inverse), ['name']);
        inverseRelation = addDefaults(inverseRelation, {
          model: modelName,
          isPlural: true,
          isInverse: true,
          inverseName: relationName,
        });
        const idField2 = models[modelName].fields.id;
        inverseRelation.type = idField2 ? idField2.type : undefined;
        const { isPlural: isInversePlural } = inverseRelation;
        const inverseName =
          (inverse && inverse.name) ||
          (isInversePlural ? pluralize(modelName) : modelName);
        const inverseFkName = getFkName(
          inverseName,
          isInversePlural != null ? isInversePlural : true
        );
        inverseRelation.fkName = inverseFkName;
github guigrpa / storyboard / packages / storyboard-extension-chrome / src / components / __tests__ / jestQuery.js View on Github external
const $ = (root, options0, fnMatch0) => {
  let options = options0;
  let fnMatch = fnMatch0;
  if (_.isFunction(options0) || _.isString(options0)) {
    options = {};
    fnMatch = options0;
  }
  options = addDefaults(options, {
    fIncludeTextElements: false,
    fLog: false,
  });
  if (_.isString(fnMatch)) fnMatch = getMatcher(fnMatch);
  return visitElement(root, options, fnMatch);
};
github guigrpa / storyboard / packages / storyboard-extension-chrome / src / components / __tests__ / fixtures.js View on Github external
export const buildLogRecord = (options = {}) => addDefaults(options, {
  id: 'id1',
  hubId: 'hubId1',
  version: 3,
  fStory: false,
  fServer: false,
  storyId: 'story1',
  t: 0,
  src: 'main',
  level: 30,
  msg: 'Example message',
});
github guigrpa / mady / src / client / components / __tests__ / jestQuery.js View on Github external
const $ = (root, options0, fnMatch0) => {
  let options = options0;
  let fnMatch = fnMatch0;
  if (isFunction(options0) || isString(options0)) {
    options = {};
    fnMatch = options0;
  }
  options = addDefaults(options, {
    fIncludeTextElements: false,
    fLog: false,
  });
  if (isString(fnMatch)) fnMatch = getMatcher(fnMatch);
  return visitElement(root, options, fnMatch);
};
github guigrpa / storyboard / packages / storyboard-listener-browser-extension / src / index.js View on Github external
const create = (userConfig, context) =>
  new BrowserExtensionListener(addDefaults(userConfig, DEFAULT_CONFIG), context);
create.requiredCoreVersion = REQUIRED_CORE_VERSION;
github guigrpa / concise / packages / concise / src / preprocessSchema.js View on Github external
const preprocess = (schema0: Schema): ProcessedSchema => {
  const schema = addDefaults(cloneDeep(schema0), {
    models: {},
    authRules: [],
  });
  addModelDefaults(schema.models);
  processIncludes(schema.models);
  addFieldDefaults(schema.models);
  processRelations(schema.models);
  return schema;
};
github guigrpa / oao / src / utils / parallelConsoleListener.js View on Github external
const create = (userConfig, context) =>
  new ParallelConsoleListener(addDefaults(userConfig, DEFAULT_CONFIG), context);
create.requiredCoreVersion = REQUIRED_CORE_VERSION;
github guigrpa / mady / src / server / db.js View on Github external
function initConfig(): boolean {
  _configPath = path.join(_localeDir, 'config.json');
  let fMigrated = false;
  try {
    mainStory.info('db', `Reading file ${chalk.cyan.bold(_configPath)}...`);
    fs.statSync(_configPath);
    readConfig();
    if (_config.dbVersion !== DB_VERSION) {
      migrateDatabase(_config.dbVersion);
      _config.dbVersion = DB_VERSION;
      fMigrated = true;
    }
    _config = addDefaults(_config, DEFAULT_CONFIG);
    saveConfig();
    return fMigrated;
  } catch (err) {
    mainStory.error('db', `Error reading config: ${err.message}`, {
      attach: err,
      attachLevel: 'trace',
    });
    _config = DEFAULT_CONFIG;
    saveConfig();
    return fMigrated;
  }
}
github guigrpa / storyboard / packages / storyboard-listener-ws-client / src / index.js View on Github external
const create = (userConfig, context) =>
  new WsClientListener(addDefaults(userConfig, DEFAULT_CONFIG), context);
create.requiredCoreVersion = REQUIRED_CORE_VERSION;