Skip to content
Browse files

moved sub modules into lilmodel dir

  • Loading branch information...
1 parent 71d7419 commit 30082f00ca0c2fc5bf72edd7bc64eeb3b7ccf787 @gushov committed Nov 15, 2012
View
16 dist/lilmodel.js
@@ -1,4 +1,4 @@
-/*! lilmodel - v0.0.0 - 2012-11-12
+/*! lilmodel - v0.0.0 - 2012-11-15
* Copyright (c) 2012 August Hovland <gushov@gmail.com>; Licensed MIT */
(function (ctx) {
@@ -316,7 +316,7 @@ module.exports = validate;
}, true);
-provide('collection', function (require, module, exports) {
+provide('lilmodel/collection', function (require, module, exports) {
/*jshint curly:true, eqeqeq:true, immed:true, latedef:true,
newcap:true, noarg:true, sub:true, undef:true, boss:true,
@@ -363,8 +363,9 @@ module.exports = LilObj.extend({
});
+
}, true);
-provide('model', function (require, module, exports) {
+provide('lilmodel/model', function (require, module, exports) {
/*jshint curly:true, eqeqeq:true, immed:true, latedef:true,
newcap:true, noarg:true, sub:true, undef:true, boss:true,
@@ -474,7 +475,7 @@ module.exports = LilObj.extend({
}, true);
-provide('syncr', function (require, module, exports) {
+provide('lilmodel/syncr', function (require, module, exports) {
/*jshint curly:true, eqeqeq:true, immed:true, latedef:true,
newcap:true, noarg:true, sub:true, undef:true, boss:true,
@@ -499,14 +500,15 @@ provide('lilmodel', function (require, module, exports) {
newcap:true, noarg:true, sub:true, undef:true, boss:true,
strict:false, eqnull:true, browser:true, node:true */
-var syncr = require('./syncr');
-var model = require('./model');
-var collection = require('./collection');
+var syncr = require('./lilmodel/syncr');
+var model = require('./lilmodel/model');
+var collection = require('./lilmodel/collection');
module.exports = {
syncr: syncr,
model: model,
collection: collection
};
+
}, true);
View
4 dist/lilmodel.min.js
@@ -1,3 +1,3 @@
-/*! lilmodel - v0.0.0 - 2012-11-12
+/*! lilmodel - v0.0.0 - 2012-11-15
* Copyright (c) 2012 August Hovland <gushov@gmail.com>; Licensed MIT */
-(function(e){"use strict";function r(e,t){if(t.indexOf(".")===-1)return t;t=t.split("/"),e=e?e.split("/"):[],e.pop(),t[0]==="."&&t.shift();while(t[0]==="..")t.shift(),e.pop();return e.concat(t).join("/")}var t={},n={};e.provide=function(e,r,i){return i?t[e]=r:n[e]=r},e.require=function(i,s){var o,u,a=s||i;return n[a]?n[a]:(o=n[a]={},u={exports:o},t[a](function(t){return e.require(t,r(a,t))},u,o),n[a]=u.exports)}})(this),provide("lil_",function(e,t,n){t.exports={typeOf:function(e){var t=typeof e;return t==="object"&&(t=Array.isArray(e)?"array":t,t=e===null?"null":t),t},each:function(e,t,n){e&&e.length&&e.forEach(t,n)},every:function(e,t,n){return e&&e.length?e.every(t,n):!1},map:function(e,t,n){return e&&e.length?e.map(t,n):[]},eachIn:function(e,t,n){var r=e?Object.keys(e):[];r.forEach(function(r,i){t.call(n,r,e[r],i)})},mapIn:function(e,t,n){var r={};return this.eachIn(e,function(e,n,i){r[e]=t.call(this,e,n,i)},n),r},extend:function(e,t){this.eachIn(t,function(t,n){var r=this.typeOf(n);switch(r){case"object":e[t]=e[t]||{},this.extend(e[t]||{},n);break;case"boolean":e[t]=e[t]&&n;break;default:e[t]=n}return e},this)},defaults:function(e,t){return this.eachIn(t,function(t,n){e[t]||(e[t]=n)}),e},pick:function(e,t){var n={};return t=this.typeOf(t)==="array"?t:Object.keys(t),this.each(t,function(t){n[t]=e&&e[t]}),n},pushOn:function(e,t,n){e[t]&&typeof e[t].push=="function"?e[t].push(n):typeof e[t]=="undefined"&&(e[t]=[n])}}},!0),provide("lilobj",function(e,t,n){var r=e("lil_");t.exports={extend:function(e){var t=Object.create(this);return r.eachIn(e,function(e,n){t[e]=n}),t},create:function(){var e=Object.create(this);return e.construct!==undefined&&e.construct.apply(e,arguments),e}}},!0),provide("vladiator",function(e,t,n){var r=e("lil_"),i={required:function(e){return typeof e!="undefined"&&e!==null},array:function(e){return Array.isArray(e)},number:function(e){return typeof e=="number"},string:function(e){return typeof e=="string"},length:function(e,t,n){var r=!t||e.length>=t,i=!n||e.length<=n;return r&&i},gte:function(e,t,n){return t<n}},s=function(e,t){var n={isValid:!0};return(e[0]==="required"||i.required(t))&&r.every(e,function(e){var r,s=[];return typeof e!="string"?(r=e[0],s=e.slice(1)):r=e,s.unshift(t),i[r].apply(null,s)?!0:(n.isValid=!1,n.error=r,!1)}),n.$=t,n};t.exports=s},!0),provide("collection",function(e,t,n){var r=e("lilobj"),i=e("lil_"),s=e("./syncr");t.exports=r.extend({construct:function(e){this.$=[],i.each(e,function(e){this.$.push(this.model.create(e))},this),this.validate()},validate:function(){var e={isValid:!0,error:[]};return i.each(this.$,function(t){var n=t.validate();e.error.push(n.error),e.isValid=e.isValid&&n.isValid}),e},find:function(e){var t=s();t("find",this,e)}})},!0),provide("model",function(e,t,n){var r=e("lilobj"),i=e("lil_"),s=e("vladiator"),o=e("./syncr");t.exports=r.extend({construct:function(e){this.$={};var t=i.mapIn(this.rules,function(e,t){return{enumerable:!0,get:function(){return this.$[e]},set:function(t){var n=this.children&&this.children[e];n&&n.create&&typeof t=="object"?this.$[e]=n.create(t):n&&typeof t=="object"?this.$[e]=this.create(t):n||(this.$[e]=t)}}},this);Object.defineProperties(this,t),e=i.pick(e,this.rules),i.defaults(e,this.defaults),i.eachIn(e,function(e,t){this[e]=t},this),this.validate()},validate:function(){var e={isValid:!0,error:{}};return i.eachIn(this.rules,function(t,n){var r=this[t],i;r&&r.validate?i=r.validate():(i=s(n,r),r=i.$),e.error[t]=i.error,e.isValid=e.isValid&&i.isValid},this),e},save:function(e){var t=o(),n=this.$._id?"update":"create",r=this.validate();r.isValid?t(n,this,e):e(r.error,this)},fetch:function(e){var t=o();t("fetch",this,e)},destroy:function(e){var t=o();t("delete",this,e)}})},!0),provide("syncr",function(e,t,n){var r=function(e,t,n){n(null,t)};t.exports=function(e){return e&&(r=e),r}},!0),provide("lilmodel",function(e,t,n){var r=e("./syncr"),i=e("./model"),s=e("./collection");t.exports={syncr:r,model:i,collection:s}},!0);
+(function(e){"use strict";function r(e,t){if(t.indexOf(".")===-1)return t;t=t.split("/"),e=e?e.split("/"):[],e.pop(),t[0]==="."&&t.shift();while(t[0]==="..")t.shift(),e.pop();return e.concat(t).join("/")}var t={},n={};e.provide=function(e,r,i){return i?t[e]=r:n[e]=r},e.require=function(i,s){var o,u,a=s||i;return n[a]?n[a]:(o=n[a]={},u={exports:o},t[a](function(t){return e.require(t,r(a,t))},u,o),n[a]=u.exports)}})(this),provide("lil_",function(e,t,n){t.exports={typeOf:function(e){var t=typeof e;return t==="object"&&(t=Array.isArray(e)?"array":t,t=e===null?"null":t),t},each:function(e,t,n){e&&e.length&&e.forEach(t,n)},every:function(e,t,n){return e&&e.length?e.every(t,n):!1},map:function(e,t,n){return e&&e.length?e.map(t,n):[]},eachIn:function(e,t,n){var r=e?Object.keys(e):[];r.forEach(function(r,i){t.call(n,r,e[r],i)})},mapIn:function(e,t,n){var r={};return this.eachIn(e,function(e,n,i){r[e]=t.call(this,e,n,i)},n),r},extend:function(e,t){this.eachIn(t,function(t,n){var r=this.typeOf(n);switch(r){case"object":e[t]=e[t]||{},this.extend(e[t]||{},n);break;case"boolean":e[t]=e[t]&&n;break;default:e[t]=n}return e},this)},defaults:function(e,t){return this.eachIn(t,function(t,n){e[t]||(e[t]=n)}),e},pick:function(e,t){var n={};return t=this.typeOf(t)==="array"?t:Object.keys(t),this.each(t,function(t){n[t]=e&&e[t]}),n},pushOn:function(e,t,n){e[t]&&typeof e[t].push=="function"?e[t].push(n):typeof e[t]=="undefined"&&(e[t]=[n])}}},!0),provide("lilobj",function(e,t,n){var r=e("lil_");t.exports={extend:function(e){var t=Object.create(this);return r.eachIn(e,function(e,n){t[e]=n}),t},create:function(){var e=Object.create(this);return e.construct!==undefined&&e.construct.apply(e,arguments),e}}},!0),provide("vladiator",function(e,t,n){var r=e("lil_"),i={required:function(e){return typeof e!="undefined"&&e!==null},array:function(e){return Array.isArray(e)},number:function(e){return typeof e=="number"},string:function(e){return typeof e=="string"},length:function(e,t,n){var r=!t||e.length>=t,i=!n||e.length<=n;return r&&i},gte:function(e,t,n){return t<n}},s=function(e,t){var n={isValid:!0};return(e[0]==="required"||i.required(t))&&r.every(e,function(e){var r,s=[];return typeof e!="string"?(r=e[0],s=e.slice(1)):r=e,s.unshift(t),i[r].apply(null,s)?!0:(n.isValid=!1,n.error=r,!1)}),n.$=t,n};t.exports=s},!0),provide("lilmodel/collection",function(e,t,n){var r=e("lilobj"),i=e("lil_"),s=e("./syncr");t.exports=r.extend({construct:function(e){this.$=[],i.each(e,function(e){this.$.push(this.model.create(e))},this),this.validate()},validate:function(){var e={isValid:!0,error:[]};return i.each(this.$,function(t){var n=t.validate();e.error.push(n.error),e.isValid=e.isValid&&n.isValid}),e},find:function(e){var t=s();t("find",this,e)}})},!0),provide("lilmodel/model",function(e,t,n){var r=e("lilobj"),i=e("lil_"),s=e("vladiator"),o=e("./syncr");t.exports=r.extend({construct:function(e){this.$={};var t=i.mapIn(this.rules,function(e,t){return{enumerable:!0,get:function(){return this.$[e]},set:function(t){var n=this.children&&this.children[e];n&&n.create&&typeof t=="object"?this.$[e]=n.create(t):n&&typeof t=="object"?this.$[e]=this.create(t):n||(this.$[e]=t)}}},this);Object.defineProperties(this,t),e=i.pick(e,this.rules),i.defaults(e,this.defaults),i.eachIn(e,function(e,t){this[e]=t},this),this.validate()},validate:function(){var e={isValid:!0,error:{}};return i.eachIn(this.rules,function(t,n){var r=this[t],i;r&&r.validate?i=r.validate():(i=s(n,r),r=i.$),e.error[t]=i.error,e.isValid=e.isValid&&i.isValid},this),e},save:function(e){var t=o(),n=this.$._id?"update":"create",r=this.validate();r.isValid?t(n,this,e):e(r.error,this)},fetch:function(e){var t=o();t("fetch",this,e)},destroy:function(e){var t=o();t("delete",this,e)}})},!0),provide("lilmodel/syncr",function(e,t,n){var r=function(e,t,n){n(null,t)};t.exports=function(e){return e&&(r=e),r}},!0),provide("lilmodel",function(e,t,n){var r=e("./lilmodel/syncr"),i=e("./lilmodel/model"),s=e("./lilmodel/collection");t.exports={syncr:r,model:i,collection:s}},!0);
View
6 lib/lilmodel.js
@@ -2,9 +2,9 @@
newcap:true, noarg:true, sub:true, undef:true, boss:true,
strict:false, eqnull:true, browser:true, node:true */
-var syncr = require('./syncr');
-var model = require('./model');
-var collection = require('./collection');
+var syncr = require('./lilmodel/syncr');
+var model = require('./lilmodel/model');
+var collection = require('./lilmodel/collection');
module.exports = {
syncr: syncr,
View
0 lib/collection.js → lib/lilmodel/collection.js
File renamed without changes.
View
0 lib/model.js → lib/lilmodel/model.js
File renamed without changes.
View
0 lib/syncr.js → lib/lilmodel/syncr.js
File renamed without changes.
View
6 package.json
@@ -21,11 +21,7 @@
"optionalDependencies": {
"lilprovider": ">= 0.0.x"
},
- "licenses": [
- {
- "type": "MIT"
- }
- ],
+ "licenses": [{ "type": "MIT" }],
"main": "lib/lilmodel.js",
"scripts": {
"test": "grunt buster"

0 comments on commit 30082f0

Please sign in to comment.
Something went wrong with that request. Please try again.