1.2.3 • Published 7 years ago

dbtosb v1.2.3

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

Objective

Convert double byte english letters, digit and some control characeter (全形) into single byte ascii letter (半形). For example: "Regular Expression 01" is converted into "Regular Expression 01"

The mapping can be viewed at github, the default style is programmer. You can choose the style you like, and you can also provide extend list of ignore list if the default style doesn't quite fit your need.

Install

npm install -g dbtosb

API

Default Style(programmer), No Extend and No Ignore List

var dbtosb = require("./dbtosb.js");
var result = dbtosb.convert("QWERTYUIOPASDFGHJKLZXCVBNM");

Only Convert Digit, Extend to Convert n and Ignore to Convert 1

var ignore = dbtosb.convert("regular expression 01", "digit", "n", "1");
var expected = "regular expression 01"
console.log(expected == ignore);

Command Line

dbtosb InputFilePath -f EncodingOfInput -s StyleName -i IgnoreList

  • By default, the output go to standard output.
  • If InputFilePath do not exist, It reads from the standard input.
  • -o: Path of output file
  • -f: Encoding of input
  • -t: Encoding of output
  • -s: Style Name of the mapping: "programmer","all","digit","letter","digitLetter","space", default is "programmer"
  • -e: Extend List of conversion
  • -i: Ignore List of conversion

Standard Input to Standard Output

> dbtosb < "../test.txt"

QWERTYUIOPASDFGHJKLZXCVBNM

qwertyuiopasdfghjklzxcvbnm

0123456789

Read from file and write to a file

dbtosb "dbtosb.js" -o "out.txt"

Specify the encoding of input

dbtosb -f utf8 < "Text.txt"

Specify the encoding of both input and output

dbtosb -f utf8 -t utf8 < "Text.txxt"

Specify Style

dbtosb -s "digit" < "Text.txxt"

Specify Digit Style, Extend List and Convert List

This example only Converts Digit, Extend to Convert n and Ignore to Convert 1.

dbtosb -s "digit" -e "n" -i "1" < "Text.txxt"

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago