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

buffer-apg-js

v4.2.0

Published

JavaScript APG, an ABNF Parser Generator

Downloads

27

Readme

This is a fork of JavaScript APG library, with the addition of 'safer-buffer' to replace usage of Node's Buffer API.

JavaScript APG

What's New

apg-js obsoletes apg-js2, apg-js2-lib, apg-js2-exp, apg-js2-api, apg-conv and apg-conv-api. It changes them in two significant ways.

  • It fixes a major problem in the attributes algorithm. Previous versions could fail on large grammars with many or large sets of mutually-recursive rules.
  • It combines all of those packages into a single, easier to manage and maintain package.

In version 4.1.0 and higher, all files have been updated for compliance with ESLint using the airbnb + prettier configurations. Use:

npm install --production apg-js

to prevent installation of ESLint development and configuration modules.

Version 4.1.2 simply replaces five instances of "module.exports = function exports(" with "module.exports = function exfn(". ESLint requires a name here but the name "exports" causes conflicts in some bundlers.

Overview

apg-js is the JavaScript version of APG, an ABNF Parser Generator. APG generates recursive-descent parsers directly from a superset of ABNF (SABNF). Visit the APG website for a complete overview of APG and SABNF.

Documentation

This package is meant to assist other parsing applications and is normally not installed by itself, rather installed along with those other applications. For details and many examples of using of the libraries, both in node.js and browser applications, see apg-js-examples at GitHub or npmjs. However, it does provide access to two, node.js applications, apg and apg-conv.

Applications

apg is the parser generator. To see its usage run,

npm run apg

apg-conv is a data conversion application. To see its usage run,

npm run apg-conv

Libraries

This package also contains four libraries that can be used in either node.js or browser applications. The libraries depend upon one another and the dependency tree looks like so:

apg-exp
|- apg-api
|-|- apg-lib
|-|-|- apg-conv-api

Each of the libraries is bundled for browser use along with some special styles. Each bundle contains all of its dependencies explicitly. That is, if a browser application needs both apg-api and apg-lib, only the apg-api bundle need be scripted into the page.

The library and css bundles are in the ./dist directory.

./dist/apg-exp-bundle.js
./dist/apg-api-bundle.js
./dist/apg-lib-bundle.js
./dist/apg-conv-api-bundle.js
./dist/apg-lib-bundle.css

The bundles can all be regenerated with:

npm install -g [email protected]
npm install -g [email protected]
npm install -g [email protected]
npm run bundle-apg-conv-api
npm run bundle-apg-lib
npm run bundle-apg-api
npm run bundle-apg-exp
npm run bundle-apg-lib-css

Code Documentation

The code documentation is in docco format and can be generated with:

npm install -g [email protected]
./bin/docco-gen.sh

(Higher versions of docco may work, but some lower versions definitely do not.) The documentation is then at ./docs/index.html or see it here at the APG website.