
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
nativemodels
Advanced tools
Native Models provides a way to map objects and arrays of objects in a clean and typed way. The main goal is to ensure runtime type checking and consistent models for APIs.
import { arrayModel, objectModel } from 'nativemodels';
import { boolean, computed, date, int, string } from 'nativemodels/datatypes';
const schema = {
firstName: string().required(),
lastName: string().required(),
fullName: computed((record) => `${record.firstName} ${record.lastName}`),
typeID: int().default(2),
isAdmin: boolean().default(false),
accountID: int().nullable(),
created: date().default(new Date()),
updated: date().default(new Date()),
};
const userModel = objectModel(schema);
const johnSmith = userModel({
firstName: 'John',
lastName: 'Smith',
});
// => { firstName: 'John', lastName: 'Smith', fullName: 'John Smith', ...}
const usersModel = arrayModel(schema);
const users = usersModel([
{
firstName: 'John',
lastName: 'Smith',
},
{
firstName: 'Jane',
lastName: 'Doe',
},
]);
const janeDoe = userModel({
...johnSmith,
firstName: 'Jane',
lastName: 'Doe',
});
// => { firstName: 'Jane', lastName: 'Doe', fullName: 'Jane Doe', ...}
Datatype methods that can be called or extended.
Sets a default value if no value is set
Allows the value set to be null (useful for database models)
Parses the value being set. Used to extend base datatype
Forces the value to be required. Is ignored if default value is set
FAQs
Native Models for Javascript
The npm package nativemodels receives a total of 64 weekly downloads. As such, nativemodels popularity was classified as not popular.
We found that nativemodels 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.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.