How to use the intl-messageformat/core.IntlMessageFormat.__parse function in intl-messageformat

To help you get started, we’ve selected a few intl-messageformat 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 formatjs / react-intl / test / setup.js View on Github external
import {configure} from 'enzyme';
import * as React from 'react';
import 'intl-pluralrules';
import '@formatjs/intl-relativetimeformat/polyfill-locales';
import {parse} from 'intl-messageformat-parser';
import {IntlMessageFormat} from 'intl-messageformat/core';
IntlMessageFormat.__parse = parse;

let reactMajorVersion = Number.parseInt(React.version.slice(0, 2));
if (reactMajorVersion === 0) {
  reactMajorVersion = React.version.slice(2, 4);
}
const Adapter = require(`enzyme-adapter-react-${reactMajorVersion}`);

configure({adapter: new Adapter()});

function toBeA(received, typeNameOrObj) {
  let pass;
  if (typeof typeNameOrObj === 'string') {
    pass = typeof received === typeNameOrObj;
  } else {
    pass = received instanceof typeNameOrObj;
  }

intl-messageformat

Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.

BSD-3-Clause
Latest version published 13 days ago

Package Health Score

100 / 100
Full package analysis