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

angelmarkup

v1.6.0

Published

Simple data storage with no drama in Javascript.

Downloads

198

Readme

ANGELMARKUP.JS :performing_arts: :guitar: :ribbon:

GitHub CI

Simple data storage with no drama in Javascript. :performing_arts: :guitar: :ribbon:

ABOUT :books:

I needed a data format that permits comments for some projects I was working on. Everything else seemed too complicated, so I wrote a compiler and parser for my own data format, called Angel Markup. I iplemented the compiler once in Rust and once in Javascript. This is the Javascript implementation. :heart:

USAGE :hammer:

Use Angelmarkup.js in a Node.js project

To use Angelmarkup.js in a Node.js project, run this command in your project's root directory:

$ npm install --save-dev angelmarkup

Be sure to also add the "type":"module" flag to your project's manifest, package.json.

APIs

Angelmarkup.js offers the following functions:

  • toYAML(subject, filler): Converts a map into a YAML string and joins each line with "filler".
  • toTOML(subject, filler): Converts a map into a TOML string and joins each line with "filler".
  • toAML(subject, filler): Converts a map into an AML string and joins each line with "filler".
  • toJSON(subject): Converts a map into a JSON string.
  • hasIndex(subject, index): Checks if the list "subject" has the index "index".
  • class Token(name, value): A class to represent a token. name represents the token's name and value represents the parsed string slice corresponding to a regular expression for that type of token.
  • patternPool(): A function that holds the regular expression patterns that represent statements Angelmarkup.js understands.
  • lexSrc(source, pool): A lexing function to take a string, run my algorithm for lexing, and return a list of tokens. (I deliberately made the arguments customizable for easy re-use.)
  • serializeAML: A function that parses Angel Markup statements and serializes them into a map.
  • testAll(): Tests all of the above.

Angel Markup Syntax

Angel Markup is very simple. It is similar to JSON and only recognizes one data type. This data type is a string. Here's a small example.

# This is a comment.
# Assigns the "name" field, the value "max".
'name' => 'max'

Example

Here's a small example:

  • 1.) Initialize a new Node.js project with the following command in a directory of your choosing:
$ npm init -y 
  • 2.) Install Angelmarkup.js as a dependency:
$ npm install --save-dev angelmarkup
  • 3.) Be sure to add this line to your project's package.json:
"type":"module",
  • 4.) Create your index.js file and put the following code inside it:
// index.js
import * as angelmarkup from 'angelmarkup';

function main(){
  // A string of an AML key-value pair.
  var amlTestString = "'name' => 'aml'";
  // The parsed string as a map.
  var serialized = angelmarkup.serializeAML(amlTestString);
  // Printing out the resulting map.
  console.log(serialized);
}

// Calling the "main" function.
main();
  • 5.) Run the project:
$ node .
  • 6.) Should print out this:
Map(1) { 'name' => 'aml' }
  • 7.) If you're still not sure how to use this, check out the example project in the example folder.

CHANGELOG :black_nib:

Version 1.0.0

  • Initial release.
  • Upload to GitHub.
  • Upload to NPM.

Version 1.1.0

  • Minor fixes.
  • Fixed typos.
  • Updated documentation.

Version 1.2.0

  • Updated documentation.
  • Fixed ALL typos.
  • VASTLY improved the lexer and parser.
  • Fixed the "messy string" bug.

Version 1.3.0

  • Updated documentation.
  • Added a toJSON method.
  • Updated methods for the other formats.

Version 1.4.0

  • Updated documentation.
  • Published and uploaded under my new name.

Version 1.5.0

  • Fixed typos and dead links.

Version 1.6.0

  • Fixed some administrative issues.
  • Fixed some formatting issues.

NOTE :scroll:

  • Angelmarkup.js :performing_arts: :guitar: :ribbon: by Alexander Abraham :black_heart: a.k.a. "Angel Dollface" :dolls: :ribbon:
  • Licensed under the MIT license.