Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
javascript-orm-mapper
Advanced tools
Readme
This library provides a simple way to map data from json to javascript objects that use multiple data types, including relational data types, for example: OneToMany
$ npm i javascript-orm-mapper
$ npm test
You can define models just like normal classes. There are no limits, you can define own methods, getters properties and whatever you want. All you have to do to make your class mappable is describing properties with type annotations
// Create database
const database = new Database()
// Post
@Entity({
name: 'post',
database: database
})
class Post extends Model {
@Id()
@String()
id: string = ''
@String()
name: string = ''
@OneToMany('comment')
comments: Comment[] = []
}
// Comment
@Entity({
name: 'comment',
database: database
})
class Comment extends Model {
@Id()
@String()
id: string = ''
@String()
content: string = ''
@ManyToOne('post')
post: Post = null
}
let post = <Post>ModelMapper.persist({
id: 1,
name: 123,
comments: [
{
id: 1,
content: "Lorem ipsum",
post: {
id: 1,
name: "New name"
}
}
]
}, Post)
// Result
// Post {
// __orm_uid: "bf9929cb-f852-43a0-9260-2e3fb89833b7",
// id: "1",
// name: "New name",
// comments: [
// Comment {
// __orm_uid: "6599f446-fb0d-4194-abbd-659d40d5c9fb",
// content: "Lorem ipsum",
// post: Post {
// __orm_uid: "bf9929cb-f852-43a0-9260-2e3fb89833b7",
// id: "1",
// name: "New name",
// comments: [
// [Circural]
// ]
// }
// }
// ]
// }
FAQs
Javascript orm mapper
The npm package javascript-orm-mapper receives a total of 11 weekly downloads. As such, javascript-orm-mapper popularity was classified as not popular.
We found that javascript-orm-mapper 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.