Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
model-json-js
Advanced tools
A JavaScript Model class that implements a serializable solution for data modeling on the client and/or server.
A JavaScript Model class designed to serialize and transfer structured data within the services/apps you build or across networks. It is paired with Schema(JSON)js to provide structure and validation capabilities to your data model.
Motivations behind the project:
Install using npm
:
npm install --save model-json-js
Below are a few examples on how to use the Model and Schema classes. For the sake of the following examples, here is a sample Schema we'll reference with all the examples.
// JSON Schema
const TestSchema = {
title: 'Test',
$id: 'https://hiveframework.io/api/v1/models/Test',
type: 'object',
properties: {
test: {
type: 'string'
},
another: {
type: 'string'
}
},
required: ['test']
}
// model FSA
const testData = {
type: 'Test',
payload: { test: 'object' }
}
An example Model initialized with raw data and schema.
const model = await new Model(testData, TestSchema)
An example Model initialized with a cached JSON Schema references defined.
const testSchema = await new Schema(TestSchema)
// ...
const model = await new Model(testData, testSchema)
An example immutable Model initialized with raw data and schema.
const model = await new Model(testData, TestSchema, { immutable: true })
Validate the entire Model.
const isValid = Model.validate(model)
Validate a single property of the model
const isValid = Model.validate(model.test, Model.schema(model).test)
Serialize the Model with JSON stringify.
const json = JSON.stringify(model)
We are currently drafting our contributing guide in the new monorepo!
FAQs
A JavaScript Model class that implements a serializable solution for data modeling on the client and/or server.
The npm package model-json-js receives a total of 7 weekly downloads. As such, model-json-js popularity was classified as not popular.
We found that model-json-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.