Socket
Book a DemoInstallSign in
Socket

cjkspace

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cjkspace

Add space between CJK character and western character

latest
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

cjkspace

Add space between CJK character and western character.

Install

npm install cjkspace --save

Usage

Using tagged template:

import cjkspace from 'cjkspace'

const name = 'Kiki'

cjkspace`喵喵和${name}赞同了你` // space around Latin character
// => '喵喵和 Kiki 赞同了你'

cjkspace`(${'Black Mirror'})` // no space around punctuation
// => '(Black Mirror)'

cjkspace`a  ${' b '}  c` // preserves space, no side-effect
// => 'a   b   c'

Using React component:

import {CJKSpace} from 'cjkspace/react'

const name = 'Kiki'

// element and text
<CJKSpace>
  {name}<strong>赞同了</strong>{'Coco'}的回答
</CJKSpace>
// => Kiki <strong>赞同了</strong> Coco 的回答

// custom component, depends on static analysis of children
<CJKSpace>
  <Link>{name}</Link>
  赞同了{'Coco'}的回答
</CJKSpace>
// => <a>Kiki</a> 赞同了 Coco 的回答

Keywords

CJK

FAQs

Package last updated on 10 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts