@abcnews/base-36-text 中文文档教程
base-36-text
用于将文本编码/解码为 base36 字符串的工具。
Usage
As a CLI
使用 npm i -g @abcnews/base-36-text
全局安装以使用 b36t
可执行文件,或使用 npx:
npx @abcnews/base-36-text encode 'example text'
> 31ltulurfcfzwo4gm7o
npx @abcnews/base-36-text decode 31ltulurfcfzwo4gm7o
> example text
As a library (node or browser)
npm i @abcnews/base-36-text
import { encode, decode } from '@abcnews/base-36-text';
encode('example text');
// > 31ltulurfcfzwo4gm7o
decode('31ltulurfcfzwo4gm7o');
// > 'example text'
此项目包含一个浏览器使用示例。 尝试一下:
git clone https://github.com/abcnews/base-36-text
cd base-36-text
npm run example
...然后在打开的浏览器窗口中打开控制台,然后尝试 b36t.encode()
和 b36t.decode()
。
base-36-text
Tools for encoding / decoding text to / from base36 strings.
Usage
As a CLI
Install globally with npm i -g @abcnews/base-36-text
to use the b36t
executable, or use npx:
npx @abcnews/base-36-text encode 'example text'
> 31ltulurfcfzwo4gm7o
npx @abcnews/base-36-text decode 31ltulurfcfzwo4gm7o
> example text
As a library (node or browser)
npm i @abcnews/base-36-text
import { encode, decode } from '@abcnews/base-36-text';
encode('example text');
// > 31ltulurfcfzwo4gm7o
decode('31ltulurfcfzwo4gm7o');
// > 'example text'
A browser usage example is included with this project. To try it:
git clone https://github.com/abcnews/base-36-text
cd base-36-text
npm run example
…then open the console in the browser window that opens, and try out b36t.encode()
and b36t.decode()
.