npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dbtosb

v1.2.3

Published

Convert double byte width digit and english letter into single byte

Downloads

5

Readme

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] [-o OutputFilePath ] [-f EncodingOfInput] [-t EncodingOfOutput] [-s StyleName] [-e ExtendList] [-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"