diff --git a/lib/client.js b/lib/client.js index c767373..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, keys) { - for (let key of 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(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(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, keys, params = {}) { - const link = lookupLink(document, 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) }