How to use the emojibase/package.json.version function in emojibase

To help you get started, we’ve selected a few emojibase 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 milesj / interweave / packages / emoji / src / withEmojiData.tsx View on Github external
emojis: CanonicalEmoji[];
  source: Source;
}

// Share between all instances
const loaded: Set = new Set();
const promise: Map> = new Map();

export function resetLoaded() {
  if (__DEV__) {
    loaded.clear();
    promise.clear();
  }
}

const EMOJIBASE_LATEST_VERSION = require('emojibase/package.json').version;

export default function withEmojiData(options: WithEmojiDataOptions = {}) /* infer */ {
  const { alwaysRender = false, compact = false, emojis = [], throwErrors = true } = options;

  return function withEmojiDataFactory(
    Component: React.ComponentType,
  ): React.ComponentType {
    const baseName = Component.displayName || Component.name;

    class WithEmojiData extends React.PureComponent<
      Props & WithEmojiDataWrapperProps,
      WithEmojiDataState
    > {
      static displayName = `withEmojiData(${baseName})`;

      static defaultProps: any = {