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

aton

v0.0.4

Published

AT Object Notation

Downloads

13

Readme

ATON

ATON stands for "AT Object Notation." It functions in a similar manner to JSON, the main difference being that property values are allowed to contain unescaped line breaks in ATON. Property keys are indicated by starting a line with the "@" symbol, followed by the property name, then a colon (:) and then the property value. Here is a simple example of an ATON file:

More examples of the ATON syntax can be found on the ATON website. ATON content is converted from a string into a JavaScript object with the .parse() method. The process can be reversed by using the .stringify() method.

Using in Node applications

This module can be installed for use in node by installing globally with the command:

$ npm install -g aton

If you want to use only locally within a node project, then install as a package dependency with the command:

$ npm install --save aton

Here is an example of loading the module into a node script and processing an ATON string. This string contains many of the capabilities of ATON, including type-casting and property hierarchies.

  • key1 is a single-line value.
  • key2 has a multi-line value, containing a literal newline.
  • key3 has an object as its value.
  • key3b is a floating-point number.
  • key3c has three integer values which are packed into a JavaScript array.
var aton = require('aton');
var ATON = new aton();

var atonString = '';
atonString += '@@type:key3c:Integer\n';
atonString += '@@type:key3b:Number\n';
atonString += '@key1: value1\n';
atonString += '@key2: value2\n';
atonString += 'value2 continued\n';
atonString += '@@begin: key3\n';
atonString += '@key3a: value3a\n';
atonString += 'value3a continued\n';
atonString += 'value3a continued further\n';
atonString += '@key3b: 2.71828\n';
atonString += '@key3c: 1\n';
atonString += '@key3c: -45\n';
atonString += '@key3c: 3.14\n';
atonString += '@@end: value3\n';
atonString += '@key4: value4\n';
console.log(atonString);
var obj = ATON.parse(atonString);
console.log('\n', obj);

The above code should output the following text to the console:

@@type:key3c:Integer
@@type:key3b:Number
@key1: value1
@key2: value2
value2 continued
@@begin: key3
@key3a: value3a
value3a continued
value3a continued further
@key3b: 2.71828
@key3c: 1
@key3c: -45
@key3c: 3.14
@@end: value3
@key4: value4

 { key1: 'value1',
  key2: 'value2\nvalue2 continued',
  key3:
   { key3a: 'value3a\nvalue3a continued\nvalue3a continued further',
     key3b: 2.71828,
     key3c: [ 1, -45, 3 ] },
  key4: 'value4' }

Whitespace before and after a parameter value is removed automatically during the conversion process. Also notice that multi-line values contain an escaped newline character in the translation to a JavaScript object. Meta entries starting with "@@TYPE" set the data type for parameters with a given name, such as "Number" to parse the property value as a number and "Integer" to parse as an integer.

Using in a web browser

The JavaScript files for ATON can also be used within a webpage by including the main JavaScript file for ATON:

<script src="aton.js"></script>

Visit the ATON homepage to try an online demo of ATON parser running within a webpage.

Testing the code

Input and output from the code can be tested using mocha and the JavaScript files in the test directory. To test from a node installation:

$ npm install   # to download mocha dependency if necessary
$ npm test

Website

The website for ATON documentation is http://aton.sapp.org.

And the corresponding GitHub repository is https://github.com/craigsapp/aton.