mrcsparker / mash

JSON object mash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mash

Create javascript models easily using JSON

not much to see here right now

license

MIT

written in

coffeescript

example

Examples are in coffeescript right now.

class Vendor extends Mash.Model
	hasMany: -> [
		Product
	]
	
	fullName: ->
		this.name + ' : ' + this.address

class Product extends Mash.Model
	belongsTo: -> [
		Vendor
	]
	
	fullPrice: ->
		this.quantity * this.unit_price	

product = new Product()
product.json jsonText

console.log product.vendor.fullName()

vendor = new Vendor()
vendor.json jsonText

console.log vendor.products[0].fullPrice()

Also check out

About

JSON object mash

License:MIT License


Languages

Language:CoffeeScript 89.3%Language:Shell 6.0%Language:JavaScript 4.7%