Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hanzenkaku

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hanzenkaku

Hankaku-Zenkaku Translator in JS

  • 0.8.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.2K
decreased by-5.89%
Maintainers
1
Weekly downloads
 
Created
Source

hanzenkaku.js

A Hankaku-Zenkaku translator in JavaScript.

SYNOPSIS

FUNCTIONAL INTERFACE

All functions are under the HanZenKaku namespace.

HanZenKaku.h2z('コガイダン');            // コガイダン
HanZenKaku.z2h('コガイダン');         // コガイダン
HanZenKaku.hw2fw('dankogai');         // dankogai
HanZenKaku.fw2hw('dankogai'); // dankogai
HanZenKaku.fs2hs('dan kogai');       // dan kogai
HanZenKaku.hs2fs('dan kogai');        // dan kogai
HanZenKaku.h2k('こがいだん');         // コガイダン
HanZenKaku.k2h('コガイダン');         // こがいだん

OO INTERFACE

If your environment supports ECMASCript 5, `String.prototype' is exteneded as follows:

'コガイダン'.toZenkaku();            // HanZenKaku.h2z('コガイダン')
'コガイダン'.toHankaku();         // HanZenKaku.z2h('コガイダン')
'dankogai'.toFullwidth();         // HanZenKaku.hw2fw('dankogai')
'dankogai'.toHalfwidth(); // HanZenKaku.fw2hw('dankogai')
'dan kogai'.toHalfwidthSpace();  // HanZenKaku.fs2hs('dan kogai')
'dan kogai'.toFullwidthSpace();   // HanZenKaku.hs2fs('dan kogai')
'こがいだん'.toKatakana();        // HanZenKaku.h2k('こがいだん')
'コガイダン'.toHiragana();        // HanZenKaku.k2h('コガイダン')

This is more convenient than the functional version since you can take advantage of the method chain like:

'dan kogai'.toHalfwidth().toHalfwidthSpace();

ES5 is required to prevent from String.prototype from being enumerated so built-in objects like String are safely extended.

Keywords

FAQs

Package last updated on 23 Aug 2012

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc