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

puppy-lang

v1.0.7

Published

A language of Puppy.

Downloads

12

Readme

fork from miao-lang

狗语言(Puppy-lang)

这是一个可以将人类语言翻译为狗狗语言的程序。

特性

  • 可以将任意文本转为由若干“汪”组成的喵语言,且这个过程是可逆的
  • 支持网页、微信等常见应用,将喵语言复制到这些应用并发送不会损失信息

安装

npm install puppy-lang

使用方法

import Puppy from 'puppy-lang'

let human_msg = 'Hello 喵星人!'
let puppy_msg = Puppy.encode(human_msg)

console.log(puppy_msg) // 喵​‍‍‌‌‌​‌‍‍‌‌​‍‍‌‍‍​‍‍‍‌​‍‌‍​‌‍‍‌‌​‌‍‌​‌‌‍‌​‍‍喵​‍‍‍‍‍​‍‌‌​‍​‍‍​‍‌‍‍​‌‍‌‌​‌‌‌‍​‍‍​‍‌‌‌‍​‍‍‌‌​‌喵‌‌​‌‌‍​‌‌‍​‌‌‍‌‌​‌‌‍‍‍喵。

let msg2 = Puppy.decode(puppy_msg)

console.log(msg2) // Hello 喵星人!
console.log(msg2 === human_msg) // true

API

  • Puppy.encode(t: string, options?: Human2puppyOptions): string 将普通文本转为喵语言
  • Puppy.decode(t: string): string 将喵语言转为普通文本
  • Puppy.isPuppy(t: string): string 判断输入的文本是否为喵语言

Types

  • Human2puppyOptions
    • calls: string 动物叫声, 如: , ,
    • halfwidthSymbol: boolean 是否使用半角符号,如,.?!

多种族化

示例:

import Puppy from 'puppy-lang'

let human_msg = 'Hello 鸽子精!'
let gu_msg = Puppy.encode(human_msg, { calls: '咕' })

console.log(gu_msg) // 咕咕咕咕。

国际化

示例:

import Puppy from 'puppy-lang'

let human_msg = 'Hello Guys.'
let msg = Puppy.encode(human_msg, { calls: 'Meow ', halfwidthSymbol: true})

console.log(msg) // Meow ​‍‍‌‌‌​‌‍‍‌‌​‍‍‌‍‍​‍‍‍‌​‍‌‍​‌‍‍‌‌​‌‍‌​‌‌‍‌​‍‌Meow ‍‍‍​‌‍​‍‍‌‍‍​‍‍​‍‍‌​‌‌‍‌‌​‍‌​‌‌‌‌‍‌Meow .

工作原理

喵语言本质上是一种文本编码、解码算法,其原理为使用零宽字符将原文编码,并隐藏于若干“喵”之中。

其中编码流程如下:

  1. 生成 Base64 字符与零宽字符的对照表;
  2. 将原文转为 Base64 编码;
  3. 使用对照表将 Base64 编码后的内容转为由零宽字符组成的不可见的新编码;
  4. 根据一定规则,在新编码的最前、最后以及中间位置,插入若干“喵”以及标点符号;
  5. 完成。

解码过程则是以上流程的逆运算。