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

explainprint

v1.0.9

Published

解析打印小票内容

Downloads

25

Readme

explainprint

NPM version

Install

$ npm i explainprint --save

Usage

let opts = {
    format: 'ESC',
    splitStr: '\n', //分行字符串
    payKeyWord: '应收', //支付金额前的关键字
    formatProducts: {
        fields: ['商品', '单价', '数量', '小计'], // 小票上商品的栏目
        startString: '-', // 小票商品开始的字符行
        endString: '-', // 小票商品结束的字符行,
        splitMiniLength: 5, // 小票商品分隔符最小长度
        priceOnLine: 'first' // 如果换行的时候,价格在首行还是第二行 first、second
    },
    posSoftware: '',//产生小票的POS软件
    softType: 'retail', // 软件类型:零售、餐饮……
    ticketSize: 58, //小票的尺寸,普遍是 80 或者 58
}
const explainPrint = require('explainprint')
const piao = new explainPrint(opts,source)

Example

const explainPrint = require('explainprint')
// hex for printer data
let source = '20202020202020202020202020D0A1D3A3CCD2BDF8BFDAB3ACCAD0CAD5D2F8D0A1C6B10A1C211B21CAD5D2F8D4B1A3BA31303031A3A831303031290ACFFBB7D1C1F7CBAEA3BA3230313931313238313733373030373736303030320AC5C6BAC5A3BA303030320AB4F2D3A1CAB1BCE4A3BA323031392D31312D32382031373A33373A30310A2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D0AC9CCC6B7C3FBB3C6202020202020202020202020202020202020202020B5A5BCDB2020CAFDC1BF2020D0A1BCC60AD2BBC9FAD2BBCBAE0A2020202020202020202020202020202020202020202020202020202020202020202020322020202020302E30340A2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D0AD7DCBCC6A3BA302E30342020202020202020202020202020202020202020D6A7B8B6B7BDCABDA3BACFD6BDF03A302E30340AD3A6CAD5A3BA302E30340ACAB5CAD5A3BA302E30342020202020202020202020202020202020202020D5D2C1E3A3BA300A0A0A0A0A0A1D56011B420201'
const piao = new explainPrint({},source)
console.log(piao)
console.log(piao.payMoney)
console.log(piao.getProducts())

Questions & Suggestions

这是一个解析小票打印的工具包,包含功能获取小票支付金额、商品等 Any questions, please send email to [email protected]

License

MIT