How to use fn-name - 3 common examples

To help you get started, we’ve selected a few fn-name 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 object-layer / document-store / src / index-class.js View on Github external
properties = properties.map(property => {
      if (typeof property === 'string') { // simple index
        return { key: property, value: true };
      } else if (typeof property === 'function') { // computed index
        let key = fnName(property);
        if (!key) throw new Error('Invalid index definition: computed index function cannot be anonymous. Use a named function or set the displayName function property.');
        return { key, value: property };
      } else {
        throw new Error('Invalid index definition');
      }
    });
    return properties;
github liaisonjs / liaison / packages / model / src / validation.js View on Github external
export function runValidators(value, validators) {
  let failedValidators;
  for (const validator of validators) {
    if (!validator(value)) {
      if (!failedValidators) {
        failedValidators = [];
      }
      failedValidators.push(fnName(validator));
    }
  }
  return failedValidators;
}
github jquense / bill / src / compiler.js View on Github external
let name = type => typeof type === 'string'
  ? type : type.displayName || fnName(type) || ''

fn-name

Get the name of a named function

MIT
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis

Popular fn-name functions