@morphql/core
v0.1.20
Published
A high-performance, isomorphic Query-to-Code engine for structural data transformations.
Maintainers
Readme
@morphql/core
A high-performance, isomorphic Query-to-Code engine. It provides the Morph Query Language (MorphQL) to transform structural data (JSON, XML, or Objects) by compiling queries into specialized, pure JavaScript functions.
Key Features
- 🚀 Performance: Compiles DSL to native JS for maximum execution speed.
- 🌐 Isomorphic: Runs seamlessly in Node.js and the Browser.
- 🧩 Format Agnostic: Built-in support for JSON, XML, CSV, EDIFACT, Plaintext, and raw Objects.
- ➗ Expressions: Support for arithmetic, string concatenation, and unary minus.
- 🔀 Conditional Logic:
iffunction with comparison and logical operators. - 🔄 Structural Mapping: Easy handling of nested objects and arrays (
multiple).
Installation
npm install @morphql/coreUsage
import { compile, morphQL } from '@morphql/core';
const query = morphQL`
from object to json
transform
set fullName = firstName + " " + lastName
set isAdult = age >= 18
`;
const engine = await compile(query);
const result = engine({ firstName: 'John', lastName: 'Doe', age: 30 });
// → '{"fullName":"John Doe","isAdult":true}'Learn More
License
MIT
