How to use the numeral.options function in numeral

To help you get started, we’ve selected a few numeral 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 getredash / redash / client / app / lib / value-format.js View on Github external
import moment from 'moment/moment';
import numeral from 'numeral';
import { isString, isArray, isUndefined, isFinite, isNil, toString } from 'lodash';

numeral.options.scalePercentBy100 = false;

// eslint-disable-next-line
const urlPattern = /(^|[\s\n]|)((?:https?|ftp):\/\/[\-A-Z0-9+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi;

const hasOwnProperty = Object.prototype.hasOwnProperty;

export function createTextFormatter(highlightLinks) {
  if (highlightLinks) {
    return (value) => {
      if (isString(value)) {
        value = value.replace(urlPattern, '$1<a href="$2">$2</a>');
      }
      return toString(value);
    };
  }
  return value =&gt; toString(value);