0.0.1 • Published 3 years ago

narwhal-js v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

narwhal-js

Build Status npm version Node.js Version

Extract different types of text in a localized string

Installation

npm i narwhal-js

Usage

import { parseString } from 'narwhal-js';

parseString('[button]<<Click>> me to [bold]<<Sign in>>');
/**
  [
    {
      type: 'button',
      value: 'Click',
    },
    {
      type: '',
      value: ' me to ',
    },
    {
      type: 'bold',
      value: 'Sign in',
    },
  ]
*/

parseString('[button]<<点>>我[bold]<<登录>>');
/**
  [
    {
      type: 'button',
      value: '点',
    },
    {
      type: '',
      value: '我',
    },
    {
      type: 'bold',
      value: '登录',
    },
  ]
*/
0.0.1

3 years ago