function validateNumber(subject, schema, context) {
	if(typeof subject !== 'number') {
		context.addError('Failed type:number criteria', subject, schema);
		return false;
	}

	return true;
}

function validateInteger(subject, schema, context) {
	if(typeof subject !== 'number' || subject !== Math.round(subject)) {
		context.addError('Failed type:integer criteria', subject, schema);
		return false;
	}

	return true;
}

function minimum(subject, schema, context) {
	var valid = (schema.exclusiveMinimum)
		? subject > schema.minimum
		: subject >= schema.minimum;

	if(!valid) context.addError('Failed "minimum" criteria', subject, schema);

	return valid;
}

function maximum(subject, schema, context) {
	var valid = (schema.exclusiveMaximum)
		? subject < schema.maximum
		: subject <= schema.maximum;

	if(!valid) context.addError('Failed "maximum" criteria', subject, schema);

	return valid;
}

function multipleOf(key, subject, schema, context) {
	var valid = !(subject / schema[key] % 1);

	if(!valid) context.addError('Failed "' + key + '" criteria', subject, schema);

	return valid;
}



module.exports = function(subject, schema, context) {
	var valid = true, isType = true;

	if(schema.type === 'number') isType = validateNumber(subject, schema, context);
	if(schema.type === 'integer') isType = validateInteger(subject, schema, context);
	if(isType && 'minimum' in schema) valid = minimum(subject, schema, context) && valid;
	if(isType && 'maximum' in schema) valid = maximum(subject, schema, context) && valid;
	if(isType && schema.multipleOf) valid = multipleOf('multipleOf', subject, schema, context) && valid;
	if(isType && schema.divisibleBy) valid = multipleOf('divisibleBy', subject, schema, context) && valid;

	return isType && valid;
};

@@ -918,13 +918,8 @@
 eOf(
-key, 
 subj
@@ -930,32 +930,37 @@
  schema, context
+, key
 ) %7B%0A%09var valid =
@@ -1164,17 +1164,19 @@
  = true,
- 
+%0A%09%09
 isType =
@@ -1535,23 +1535,17 @@
 Type && 
-schema.
+'
 multiple
@@ -1546,16 +1546,27 @@
 ltipleOf
+' in schema
 ) valid 
@@ -1582,22 +1582,8 @@
 eOf(
-'multipleOf', 
 subj
@@ -1594,32 +1594,46 @@
  schema, context
+, 'multipleOf'
 ) && valid;%0A%09if(
@@ -1642,23 +1642,17 @@
 Type && 
-schema.
+'
 divisibl
@@ -1654,16 +1654,27 @@
 isibleBy
+' in schema
 ) valid 
@@ -1690,23 +1690,8 @@
 eOf(
-'divisibleBy', 
 subj
@@ -1702,32 +1702,47 @@
  schema, context
+, 'divisibleBy'
 ) && valid;%0A%0A%09re

standardize number