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
Meta-model based data structures for those who need it
npm install moddle
Typescript
Module System
Node Version
NPM Version
92.4
Supply Chain
99.6
Quality
92.6
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
12,253,394
Last Day
13,881
Last Week
85,336
Last Month
400,409
Last Year
4,188,830
92 Stars
206 Commits
33 Forks
17 Watching
7 Branches
15 Contributors
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
Publised On
20 Dec 2024
Cumulative downloads
Total Downloads
Last day
-19%
13,881
Compared to previous day
Last week
-6%
85,336
Compared to previous week
Last month
2.7%
400,409
Compared to previous month
Last year
44.9%
4,188,830
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
Found 7/13 approved changesets -- score normalized to 5
Reason
6 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 5
Reason
8 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
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 2024-12-16
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