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.
@jaysalvat/smart-model
Advanced tools
Javascript object model.
Works on modern browsers. Check if tests pass on your browser.
npm install @jaysalvat/smart-model
import SmartModel from '@jaysalvat/smart-model'
import SmartModel from 'https://unpkg.com/@jaysalvat/smart-model@latest/build/smart-model.esm.min.js'
<script src="https://unpkg.com/@jaysalvat/smart-model@latest/build/smart-model.min.js"></script>
Better documentation soon...
function readingtime(text) { /*...*/ }
const Post = SmartModel.create('Post', {
title: {
required: true,
type: String,
},
body: {
required: true,
type: String,
rule: {
'tooShort': (calue) => value.length < 100,
'tooLong': (calue) => value.length > 1000,
}
},
createdAt: {
type: Date,
default: new Date(),
transform: (value) => new Date(value),
format: (value) => value.toLocaleString()
},
updatedAt: {
type: Date,
default: new Date(),
transform: (value) => new Date(value),
format: (value) => value.toLocaleString()
},
// Nested model
author: {
required: true,
type: {
firstname: {
required: true,
type: String
},
lastname: {
type: String
}
}
},
// Virtual properties
bodyLength: (post) => post.body.length,
readingTime: (post) => readingTime(post.body)
},
// Settings
{
strict: false,
exceptions: true
}
// Events
{
onUpdate() {
this.updatedAt = new Date()
}
}
)
const post = new Post({
title: 'my new post',
body: 'lorem ipsum...'
})
Dev mode
npm run dev
Build
npm run build
Lint
npm run lint
Fix lint errors
npm run lint:fix
Tests
npm run test
npm run test:watch
npm run test:browser
Bump version and publish to NPM
npm run release
npm run release:patch
npm run release:minor
npm run release:major
FAQs
SmartModel is a fun experiment over Javascript Proxy. It tends to bring useful tools and best practices to data objects.
The npm package @jaysalvat/smart-model receives a total of 3 weekly downloads. As such, @jaysalvat/smart-model popularity was classified as not popular.
We found that @jaysalvat/smart-model 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.