How to use the timm.addLast 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 / jest-html / src / server / extractor.js View on Github external
) => {
  story.info('extractor', `Processing ${chalk.cyan.bold(filePath)}...`);
  const absPath = path.resolve(process.cwd(), filePath);
  const rawSnapshots = loadSnapshot(absPath);
  const suiteCss = getSuiteCss(filePath, story);
  const finalFilePath = `-/${filePath.normalize()}`;
  const prevSuite = _snapshotSuiteDict[finalFilePath];
  // $FlowFixMe
  const suite: SnapshotSuiteT = {};
  let suiteDirty = false;
  const nextIds = Object.keys(rawSnapshots);
  for (let i = 0; i < nextIds.length; i++) {
    const id = nextIds[i];
    const rawSnapshot = rawSnapshots[id];
    const [snap, html] = rawSnapshot.split(HTML_PREVIEW_SEPARATOR);
    const css = suiteCss != null ? addLast(commonCss, suiteCss) : commonCss;
    const snapshot: SnapshotT = {
      id,
      snap,
      html,
      css,
      dirty: false,
      deleted: false,
    };
    if (prevSuite && prevSuite[id]) {
      const prevSnapshot = prevSuite[id];
      const prevBaseline = prevSnapshot.baseline;
      // Copy the previous baseline, if any
      if (prevBaseline != null) {
        snapshot.baseline = prevBaseline;
        snapshot.dirty =
          html !== prevBaseline.html || snap !== prevBaseline.snap;
github guigrpa / jest-html / src / server / extractor.js View on Github external
Object.keys(_snapshotSuiteDict).forEach(filePath => {
    const suite = _snapshotSuiteDict[filePath];
    const suiteCss = getSuiteCss(filePath, story);
    const css = suiteCss != null ? addLast(commonCss, suiteCss) : commonCss;
    forEachSnapshot(suite, snapshot => {
      snapshot.css = css; // eslint-disable-line no-param-reassign
    });
  });
};
github guigrpa / mady / src / client / components / adTranslator.js View on Github external
onAddLang = () => {
    const prevLangs = this.state.langs;
    const availableLangs = this.props.viewer.config.langs;
    const newLang = availableLangs.find(o => prevLangs.indexOf(o) < 0);
    if (newLang == null) return;
    const nextLangs = timm.addLast(prevLangs, newLang);
    this.updateLangs(nextLangs);
  };
github guigrpa / mady / src / client / components / aeSettings.js View on Github external
onCreateListItem = (ev: SyntheticEvent) => {
    if (!(ev.currentTarget instanceof HTMLElement)) return;
    const { id } = ev.currentTarget;
    const newList = timm.addLast(this.state[id], '');
    this.setState({ [id]: newList });
  };
github ThemeFuse / Brizy / public / editor-src / editor / js / editorComponents / Form / Input / types / Select.jsx View on Github external
handleOptionsAdd = () => {
    const options = addLast(this.props.options, this.state.newItemValue);
    this.setState({ newItemValue: "" });
    this.props.onChange({ options });
  };
  handleOptionsRemove = index => {
github guigrpa / concise / packages / concise-sequelize / src / index.js View on Github external
definitionOptions,
  modelName,
  options,
  context
) => {
  const extensions =
    options && options.extensions && options.extensions[modelName];
  if (!extensions) return;
  if (extensions.validate) {
    definitionOptions.validate = merge(
      definitionOptions.validate,
      extensions.validate(context)
    );
  }
  if (extensions.indexes) {
    definitionOptions.indexes = addLast(
      definitionOptions.indexes,
      extensions.indexes(context)
    );
  }
  if (extensions.hooks) {
    definitionOptions.hooks = merge(
      definitionOptions.hooks,
      extensions.hooks(context)
    );
  }
};
github guigrpa / mady / src / server / importData.js View on Github external
const diveProcess = (err, filePath) => {
    const finalFilePath = path.normalize(filePath);
    story.info('importData', `Processing ${chalk.cyan.bold(finalFilePath)}...`);
    const lang = path.basename(filePath, '.json').replace(/_/gi, '-');
    if (outLangs.indexOf(lang) < 0) {
      outLangs = timm.addLast(outLangs, lang);
    }
    const js = JSON.parse(fs.readFileSync(finalFilePath));
    let numNewK = 0;
    let numNewT = 0;
    Object.keys(js).forEach(keyId => {
      const newTranslation = js[keyId];
      const {
        fTranslated,
        context,
        original: text,
        translation,
        firstUsed,
        unusedSince,
        sources,
      } = newTranslation;