comparison examples/blog/src/lib/Post.luan @ 1164:1f9d34a6f308

remove assertions
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 07 Feb 2018 17:36:38 -0700
parents bae2d0c2576c
children 4721c482c86b
comparison
equal deleted inserted replaced
1163:fef8f0742da9 1164:1f9d34a6f308
1 local Luan = require "luan:Luan.luan" 1 local Luan = require "luan:Luan.luan"
2 local error = Luan.error 2 local error = Luan.error
3 local ipairs = Luan.ipairs or error() 3 local ipairs = Luan.ipairs or error()
4 local assert_string = Luan.assert_string or error() 4 local type = Luan.type or error()
5 local Time = require "luan:Time.luan" 5 local Time = require "luan:Time.luan"
6 local now = Time.now or error() 6 local now = Time.now or error()
7 local String = require "luan:String.luan" 7 local String = require "luan:String.luan"
8 local trim = String.trim or error() 8 local trim = String.trim or error()
9 local Db = require "site:/lib/Db.luan" 9 local Db = require "site:/lib/Db.luan"
19 date = doc.date 19 date = doc.date
20 } 20 }
21 end 21 end
22 22
23 function Post.new(this) 23 function Post.new(this)
24 assert_string(this.subject) 24 type(this.subject)=="string" or error "subject must be string"
25 assert_string(this.content) 25 type(this.content)=="string" or error "content must be string"
26 this.date = this.date or now() 26 this.date = this.date or now()
27 27
28 function this.save() 28 function this.save()
29 local doc = { 29 local doc = {
30 type = "post" 30 type = "post"