Releases: aspectran/apon.js
apon.js-1.1.0
This release introduces major new features and performance improvements, enhancing flexibility and reliability.
✨ New Features & Enhancements
-
Root-Level Array and Object Support in
APON.parse()- The parser can now handle APON documents that start with a root-level array (
[...]) or a braced object ({...}), in addition to the traditional compact style. - This improves compatibility with JSON-like structures and aligns
apon.jsmore closely with its Java counterpart (AponParser).
- The parser can now handle APON documents that start with a root-level array (
-
Root-Level Array Support in
APON.stringify()APON.stringify()now accepts arrays as root-level input, allowing for the direct conversion of JavaScript arrays into APON array format.- Previously, providing an array would result in an error.
-
Performance-Optimized Stringification
- The internal implementation of
APON.stringify()has been refactored. It now uses anarray-joinpattern instead of repeated string concatenation. - This significantly improves performance and reduces memory overhead when stringifying large or complex objects and arrays.
- The internal implementation of
-
Improved Parsing Robustness
- Error handling in the parser has been made more robust to correctly report unexpected content after a root element has been closed.
apon.js-1.0.1
This release is a patch that includes several important bug fixes to improve the accuracy and reliability of APON parsing and stringifying.
🐞 Bug Fixes
-
Correctly Handles Type Hints During Parsing
- The
APON.parse()function now correctly processes type hints in parameter names (e.g.,(string),(number)). It ensures that values are cast to the specified type. - Example:
port(string): 8080is now correctly parsed as{ "port": "8080" }.
- The
-
Preserves Data Types During Stringifying
- The
APON.stringify()function has been improved to prevent data type loss. It now adds quotes to string values that look like numbers, booleans, or null. - Example:
{ "port": "8080" }is now correctly converted toport: "8080", notport: 8080.
- The
-
Refined Whitespace Handling in Strings
- The quoting logic in
APON.stringify()has been refined. It no longer adds unnecessary quotes to strings containing only internal spaces. - Quotes are now correctly applied only when necessary to preserve leading or trailing spaces.
- Example:
key: hello world(no quotes), butkey: " hello world "(quotes preserved).
- The quoting logic in
-
Improved Escaping for Special Characters
- Fixed a bug where
APON.stringify()failed to quote strings containing backslashes (\), resulting in invalid APON output. - Strings with backslashes are now correctly escaped and quoted.
- Example: A string value of
C:\Usersis now correctly converted to"C:\\Users".
- Fixed a bug where
apon.js-1.0.0
APON.js v1.0.0 - Initial Release
We are excited to announce the first official release of APON.js v1.0.0!
APON.js is a lightweight, zero-dependency JavaScript library that brings the power and readability of APON (Aspectran Parameters Object Notation) to the web and Node.js environments. Now you can seamlessly parse and create APON-formatted strings in your JavaScript projects.
This release is the culmination of our efforts to build a robust and easy-to-use tool for the Aspectran community and beyond.
✨ Key Features
APON.parse(text): A powerful parser that converts APON strings into standard JavaScript objects. It correctly handles nested objects, arrays, comments, multi-line text blocks, and various data types.APON.stringify(object): A flexible stringifier that converts JavaScript objects into clean, human-readable APON strings. It automatically handles quoting and indentation.- Zero-Dependency: Written in pure JavaScript (ES6) with no external dependencies, ensuring a small footprint and maximum compatibility.
- Browser & Node.js Support: Works seamlessly in both modern web browsers and Node.js environments.
- Well-Tested: Comes with a full test suite (using Jest) to ensure reliability and stability.
- Automated Workflows: Integrated with GitHub Actions for automated testing and deployment of the live demo page, ensuring continuous quality.
🚀 Getting Started
To install apon.js via npm, run:
npm install aponBasic Usage
const APON = require('apon');
// 1. Parse an APON string
const aponText = `
name: apon.js
version: 1.0.0
stable: true
`;
const myObject = APON.parse(aponText);
console.log(myObject.name); // "apon.js"
// 2. Stringify a JavaScript object
const newObject = {
author: "The Aspectran Project",
license: "Apache-2.0"
};
const newAponText = APON.stringify(newObject);
console.log(newAponText);
// author: "The Aspectran Project"
// license: Apache-2.0🌐 Live Demo
You can try apon.js right now in your browser with our interactive demo:
https://aspectran.github.io/apon.js/
Acknowledgements
A big thank you to Juho Jeong for leading the project and providing invaluable guidance throughout the development process.
We look forward to seeing what you build with APON.js!