From 8e75710159847f4bebbc42d0cbe5cce6f55ee64a Mon Sep 17 00:00:00 2001 From: Edward Nutting Date: Tue, 5 Dec 2017 20:11:05 +0000 Subject: [PATCH 1/2] Fix issue #45 --- lib/client.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/client.js b/lib/client.js index c767373..7c6ea1a 100644 --- a/lib/client.js +++ b/lib/client.js @@ -4,19 +4,19 @@ const errors = require('./errors') const transports = require('./transports') const utils = require('./utils') -function lookupLink (node, keys) { - for (let key of keys) { +function lookupLink (node, schema_keys) { + for (let key of schema_keys) { if (node instanceof document.Document) { node = node.content[key] } else { node = node[key] } if (node === undefined) { - throw new errors.LinkLookupError(`Invalid link lookup: ${JSON.stringify(keys)}`) + throw new errors.LinkLookupError(`Invalid link lookup: ${JSON.stringify(schema_keys)}`) } } if (!(node instanceof document.Link)) { - throw new errors.LinkLookupError(`Invalid link lookup: ${JSON.stringify(keys)}`) + throw new errors.LinkLookupError(`Invalid link lookup: ${JSON.stringify(schema_keys)}`) } return node } @@ -34,8 +34,8 @@ class Client { this.transports = options.transports || [new transports.HTTPTransport(transportOptions)] } - action (document, keys, params = {}) { - const link = lookupLink(document, keys) + action (document, schema_keys, params = {}) { + const link = lookupLink(document, schema_keys) const transport = utils.determineTransport(this.transports, link.url) return transport.action(link, this.decoders, params) } From 97bd4f7d9c39ad7b16f3fffbf0d24fdd6ebe8fdc Mon Sep 17 00:00:00 2001 From: Edward Nutting Date: Tue, 5 Dec 2017 20:18:15 +0000 Subject: [PATCH 2/2] Apply Camel Case to fix build. --- lib/client.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/client.js b/lib/client.js index 7c6ea1a..42714e2 100644 --- a/lib/client.js +++ b/lib/client.js @@ -4,19 +4,19 @@ const errors = require('./errors') const transports = require('./transports') const utils = require('./utils') -function lookupLink (node, schema_keys) { - for (let key of schema_keys) { +function lookupLink (node, schemaKeys) { + for (let key of schemaKeys) { if (node instanceof document.Document) { node = node.content[key] } else { node = node[key] } if (node === undefined) { - throw new errors.LinkLookupError(`Invalid link lookup: ${JSON.stringify(schema_keys)}`) + throw new errors.LinkLookupError(`Invalid link lookup: ${JSON.stringify(schemaKeys)}`) } } if (!(node instanceof document.Link)) { - throw new errors.LinkLookupError(`Invalid link lookup: ${JSON.stringify(schema_keys)}`) + throw new errors.LinkLookupError(`Invalid link lookup: ${JSON.stringify(schemaKeys)}`) } return node } @@ -34,8 +34,8 @@ class Client { this.transports = options.transports || [new transports.HTTPTransport(transportOptions)] } - action (document, schema_keys, params = {}) { - const link = lookupLink(document, schema_keys) + action (document, schemaKeys, params = {}) { + const link = lookupLink(document, schemaKeys) const transport = utils.determineTransport(this.transports, link.url) return transport.action(link, this.decoders, params) }