aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib')
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/links.js28
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/validate.js27
2 files changed, 41 insertions, 14 deletions
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/links.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/links.js
index 5b1bbbfdd6..2ef3f9fb7d 100644
--- a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/links.js
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/links.js
@@ -1,21 +1,35 @@
-/**
+/**
* JSON Schema link handler
* Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
* Licensed under the MIT (MIT-LICENSE.txt) license.
*/
-({define:typeof define!="undefined"?define:function(deps, factory){module.exports = factory();}}).
-define([], function(){
+(function (root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define([], function () {
+ return factory();
+ });
+ } else if (typeof module === 'object' && module.exports) {
+ // Node. Does not work with strict CommonJS, but
+ // only CommonJS-like environments that support module.exports,
+ // like Node.
+ module.exports = factory();
+ } else {
+ // Browser globals
+ root.jsonSchemaLinks = factory();
+ }
+}(this, function () {// setup primitive classes to be JSON Schema types
var exports = {};
exports.cacheLinks = true;
exports.getLink = function(relation, instance, schema){
// gets the URI of the link for the given relation based on the instance and schema
// for example:
// getLink(
- // "brother",
- // {"brother_id":33},
+ // "brother",
+ // {"brother_id":33},
// {links:[{rel:"brother", href:"Brother/{brother_id}"}]}) ->
// "Brother/33"
- var links = schema.__linkTemplates;
+ var links = schema.__linkTemplates;
if(!links){
links = {};
var schemaLinks = schema.links;
@@ -49,4 +63,4 @@ exports.substitute = function(linkTemplate, instance){
});
};
return exports;
-}); \ No newline at end of file
+})); \ No newline at end of file
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/validate.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/validate.js
index 97cbbf6fa3..4b6108800a 100644
--- a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/validate.js
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/validate.js
@@ -13,10 +13,23 @@ empty list will be returned. A validation error will have two properties:
"property" which indicates which property had the error
"message" which indicates what the error was
*/
-({define:typeof define!="undefined"?define:function(deps, factory){module.exports = factory();}}).
-define([], function(){
-var exports = validate;
-// setup primitive classes to be JSON Schema types
+(function (root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define([], function () {
+ return factory();
+ });
+ } else if (typeof module === 'object' && module.exports) {
+ // Node. Does not work with strict CommonJS, but
+ // only CommonJS-like environments that support module.exports,
+ // like Node.
+ module.exports = factory();
+ } else {
+ // Browser globals
+ root.jsonSchema = factory();
+ }
+}(this, function () {// setup primitive classes to be JSON Schema types
+var exports = validate
exports.Integer = {type:"integer"};
var primitiveConstructors = {
String: String,
@@ -194,8 +207,8 @@ var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*O
if(typeof instance != 'object' || instance instanceof Array){
errors.push({property:path,message:"an object is required"});
}
-
- for(var i in objTypeDef){
+
+ for(var i in objTypeDef){
if(objTypeDef.hasOwnProperty(i)){
var value = instance[i];
// skip _not_ specified properties
@@ -257,4 +270,4 @@ exports.mustBeValid = function(result){
}
return exports;
-});
+}));