Gathering detailed insights and metrics for moddle
Gathering detailed insights and metrics for moddle
Gathering detailed insights and metrics for moddle
Gathering detailed insights and metrics for moddle
npm install moddle
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
102 Stars
209 Commits
33 Forks
16 Watchers
7 Branches
16 Contributors
Updated on Jun 28, 2025
Latest Version
7.2.0
Package Id
moddle@7.2.0
Unpacked Size
279.27 kB
Size
48.95 kB
File Count
13
NPM Version
10.8.2
Node Version
20.18.1
Published on
Dec 20, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
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:
1{ 2 "$schema": "https://unpkg.com/moddle/resources/schema/moddle.json", 3 "name": "Cars", 4 "uri": "http://cars", 5 "prefix": "c", 6 "types": [ 7 { 8 "name": "Base", 9 "properties": [ 10 { "name": "id", "type": "String", "isAttr": true } 11 ] 12 }, 13 { 14 "name": "Root", 15 "superClass": [ "Base" ], 16 "properties": [ 17 { "name": "cars", "type": "Car", "isMany": true } 18 ] 19 }, 20 { 21 "name": "Car", 22 "superClass": [ "Base" ], 23 "properties": [ 24 { "name": "name", "type": "String", "isAttr": true, "default": "No Name" }, 25 { "name": "power", "type": "Integer", "isAttr": true }, 26 { "name": "similar", "type": "Car", "isMany": true, "isReference": true }, 27 { "name": "trunk", "type": "Element", "isMany": true } 28 ] 29 } 30 ] 31}
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:
1import { Moddle } from 'moddle'; 2 3var cars = new Moddle([ carsJSON ]);
Use a moddle instance to create objects of your defined types:
1var taiga = cars.create('c:Car', { name: 'Taiga' }); 2 3console.log(taiga); 4// { $type: 'c:Car', name: 'Taiga' }; 5 6 7var cheapCar = cars.create('c:Car'); 8 9console.log(cheapCar.name); 10// "No Name" 11 12 13// really? 14cheapCar.get('similar').push(taiga);
Then again, given the knowledge moddle has, you can perform deep introspection:
1var carDescriptor = cheapCar.$descriptor; 2 3console.log(carDescriptor.properties); 4// [ { name: 'id', type: 'String', ... }, { name: 'name', type: 'String', ...} ... ]
moddle is friendly towards extensions and keeps unknown any properties around:
1taiga.set('specialProperty', 'not known to moddle'); 2 3console.log(taiga.get('specialProperty')); 4// 'not known to moddle'
It also allows you to create any elements for namespaces that you did not explicitly define:
1var screwdriver = cars.createAny('tools:Screwdriver', 'http://tools', { 2 make: 'ScrewIt!' 3}); 4 5car.trunk.push(screwdriver);
Have a look at our test coverage to learn about everything that is currently supported.
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
4 existing vulnerabilities detected
Details
Reason
Found 7/13 approved changesets -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More