1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-13 03:02:49 +00:00

updated bunch of file paths and changed the way posts are loaded

This commit is contained in:
2016-01-05 12:28:04 -06:00
parent 4bb8cae81e
commit 6ab45fe935
13249 changed files with 317868 additions and 2101398 deletions

View File

@@ -1,12 +1,14 @@
/* eslint no-empty: 1 */
/*!
* Module dependencies.
*/
var SchemaType = require('../schematype')
, CastError = SchemaType.CastError
, oid = require('../types/objectid')
, utils = require('../utils')
, Document
var SchemaType = require('../schematype'),
CastError = SchemaType.CastError,
oid = require('../types/objectid'),
utils = require('../utils'),
Document;
/**
* ObjectId SchemaType constructor.
@@ -17,7 +19,7 @@ var SchemaType = require('../schematype')
* @api private
*/
function ObjectId (key, options) {
function ObjectId(key, options) {
SchemaType.call(this, key, options, 'ObjectID');
}
@@ -42,10 +44,10 @@ ObjectId.prototype.constructor = ObjectId;
* @return {SchemaType} this
*/
ObjectId.prototype.auto = function (turnOn) {
ObjectId.prototype.auto = function(turnOn) {
if (turnOn) {
this.default(defaultId);
this.set(resetId)
this.set(resetId);
}
return this;
@@ -57,7 +59,7 @@ ObjectId.prototype.auto = function (turnOn) {
* @api private
*/
ObjectId.prototype.checkRequired = function checkRequired (value, doc) {
ObjectId.prototype.checkRequired = function checkRequired(value, doc) {
if (SchemaType._isRef(this, value, doc, true)) {
return null != value;
} else {
@@ -74,7 +76,7 @@ ObjectId.prototype.checkRequired = function checkRequired (value, doc) {
* @api private
*/
ObjectId.prototype.cast = function (value, doc, init) {
ObjectId.prototype.cast = function(value, doc, init) {
if (SchemaType._isRef(this, value, doc, init)) {
// wait! we may need to cast this to a document
@@ -121,7 +123,7 @@ ObjectId.prototype.cast = function (value, doc, init) {
if (value._id.toString instanceof Function) {
try {
return oid.createFromHexString(value._id.toString());
} catch(e) {}
} catch (e) {}
}
}
@@ -140,27 +142,16 @@ ObjectId.prototype.cast = function (value, doc, init) {
* ignore
*/
function handleSingle (val) {
function handleSingle(val) {
return this.cast(val);
}
function handleArray (val) {
var self = this;
return val.map(function (m) {
return self.cast(m);
});
}
ObjectId.prototype.$conditionalHandlers =
utils.options(SchemaType.prototype.$conditionalHandlers, {
'$all': handleArray,
'$gt': handleSingle,
'$gte': handleSingle,
'$in': handleArray,
'$lt': handleSingle,
'$lte': handleSingle,
'$ne': handleSingle,
'$nin': handleArray
'$lte': handleSingle
});
/**
@@ -171,7 +162,7 @@ ObjectId.prototype.$conditionalHandlers =
* @api private
*/
ObjectId.prototype.castForQuery = function ($conditional, val) {
ObjectId.prototype.castForQuery = function($conditional, val) {
var handler;
if (arguments.length === 2) {
handler = this.$conditionalHandlers[$conditional];
@@ -187,11 +178,11 @@ ObjectId.prototype.castForQuery = function ($conditional, val) {
* ignore
*/
function defaultId () {
function defaultId() {
return new oid();
};
}
function resetId (v) {
function resetId(v) {
this.$__._id = null;
return v;
}