
Security Fundamentals
Turtles, Clams, and Cyber Threat Actors: Shell Usage
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.
A utility library for working with meta-model based data structures.
moddle offers you a concise way to define meta models in JavaScript. You can use these models to consume documents, create model elements, and perform model validation.
You start by creating a moddle schema. It is a JSON file which describes types, their properties, and relationships:
{
"$schema": "https://unpkg.com/moddle/resources/schema/moddle.json",
"name": "Cars",
"uri": "http://cars",
"prefix": "c",
"types": [
{
"name": "Base",
"properties": [
{ "name": "id", "type": "String", "isAttr": true }
]
},
{
"name": "Root",
"superClass": [ "Base" ],
"properties": [
{ "name": "cars", "type": "Car", "isMany": true }
]
},
{
"name": "Car",
"superClass": [ "Base" ],
"properties": [
{ "name": "name", "type": "String", "isAttr": true, "default": "No Name" },
{ "name": "power", "type": "Integer", "isAttr": true },
{ "name": "similar", "type": "Car", "isMany": true, "isReference": true },
{ "name": "trunk", "type": "Element", "isMany": true }
]
}
]
}
You may attach the provided JSON schema to get your moddle descriptor validated by code editor.
You can instantiate a moddle instance with a set of defined schemas:
import { Moddle } from 'moddle';
var cars = new Moddle([ carsJSON ]);
Use a moddle instance to create objects of your defined types:
var taiga = cars.create('c:Car', { name: 'Taiga' });
console.log(taiga);
// { $type: 'c:Car', name: 'Taiga' };
var cheapCar = cars.create('c:Car');
console.log(cheapCar.name);
// "No Name"
// really?
cheapCar.get('similar').push(taiga);
Then again, given the knowledge moddle has, you can perform deep introspection:
var carDescriptor = cheapCar.$descriptor;
console.log(carDescriptor.properties);
// [ { name: 'id', type: 'String', ... }, { name: 'name', type: 'String', ...} ... ]
moddle is friendly towards extensions and keeps unknown any properties around:
taiga.set('specialProperty', 'not known to moddle');
console.log(taiga.get('specialProperty'));
// 'not known to moddle'
It also allows you to create any elements for namespaces that you did not explicitly define:
var screwdriver = cars.createAny('tools:Screwdriver', 'http://tools', {
make: 'ScrewIt!'
});
car.trunk.push(screwdriver);
Have a look at our test coverage to learn about everything that is currently supported.
MIT
7.2.0
FEAT
: expose moddle schema via well-known folder (#64)DOCS
: simplify $schema
related documentationFAQs
A library for importing meta-model based file formats into JS
The npm package moddle receives a total of 101,958 weekly downloads. As such, moddle popularity was classified as popular.
We found that moddle demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security Fundamentals
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.
Security News
At VulnCon 2025, NIST scrapped its NVD consortium plans, admitted it can't keep up with CVEs, and outlined automation efforts amid a mounting backlog.
Product
We redesigned our GitHub PR comments to deliver clear, actionable security insights without adding noise to your workflow.