summaryrefslogtreecommitdiff
path: root/node_modules/json-schema/lib/links.js
diff options
context:
space:
mode:
authorLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 23:08:57 +0300
committerLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 23:08:57 +0300
commit726b81b19251674e149ccfbb1abacbd837fc6db0 (patch)
treefbdbb227dc01357eb76e8222d76185bc124c5ca6 /node_modules/json-schema/lib/links.js
parent34f0890e175698940d49238097579f44e4d78c89 (diff)
downloadFlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.gz
FlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.zst
Removed files that should not have been included in git
Diffstat (limited to 'node_modules/json-schema/lib/links.js')
-rw-r--r--node_modules/json-schema/lib/links.js66
1 files changed, 0 insertions, 66 deletions
diff --git a/node_modules/json-schema/lib/links.js b/node_modules/json-schema/lib/links.js
deleted file mode 100644
index 8a87f02..0000000
--- a/node_modules/json-schema/lib/links.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * JSON Schema link handler
- * Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
- * Licensed under the MIT (MIT-LICENSE.txt) license.
- */
-(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},
- // {links:[{rel:"brother", href:"Brother/{brother_id}"}]}) ->
- // "Brother/33"
- var links = schema.__linkTemplates;
- if(!links){
- links = {};
- var schemaLinks = schema.links;
- if(schemaLinks && schemaLinks instanceof Array){
- schemaLinks.forEach(function(link){
- /* // TODO: allow for multiple same-name relations
- if(links[link.rel]){
- if(!(links[link.rel] instanceof Array)){
- links[link.rel] = [links[link.rel]];
- }
- }*/
- links[link.rel] = link.href;
- });
- }
- if(exports.cacheLinks){
- schema.__linkTemplates = links;
- }
- }
- var linkTemplate = links[relation];
- return linkTemplate && exports.substitute(linkTemplate, instance);
-};
-
-exports.substitute = function(linkTemplate, instance){
- return linkTemplate.replace(/\{([^\}]*)\}/g, function(t, property){
- var value = instance[decodeURIComponent(property)];
- if(value instanceof Array){
- // the value is an array, it should produce a URI like /Table/(4,5,8) and store.get() should handle that as an array of values
- return '(' + value.join(',') + ')';
- }
- return value;
- });
-};
-return exports;
-})); \ No newline at end of file