opensearch-browser
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -232,3 +232,3 @@ 'use strict'; | ||
value: function parseMedia(node) { | ||
return (0, _utils.xPathArray)(node, 'media:content').map(function (mediaNode) { | ||
return (0, _utils.xPathArray)(node, 'media:group/media:content|media:content').map(function (mediaNode) { | ||
return { | ||
@@ -235,0 +235,0 @@ url: mediaNode.getAttribute('url'), |
@@ -275,6 +275,6 @@ 'use strict'; | ||
var mandatory = node.hasAttribute('minimum') ? node.getAttribute('minimum') !== '0' : undefined; | ||
var minExclusive = node.hasAttribute('minExclusive') ? parseInt(node.getAttribute('minExclusive')) : null; | ||
var maxExclusive = node.hasAttribute('maxExclusive') ? parseInt(node.getAttribute('maxExclusive')) : null; | ||
var minInclusive = node.hasAttribute('minInclusive') ? parseInt(node.getAttribute('minInclusive')) : null; | ||
var maxInclusive = node.hasAttribute('maxInclusive') ? parseInt(node.getAttribute('maxInclusive')) : null; | ||
var minExclusive = node.hasAttribute('minExclusive') ? parseInt(node.getAttribute('minExclusive')) : undefined; | ||
var maxExclusive = node.hasAttribute('maxExclusive') ? parseInt(node.getAttribute('maxExclusive')) : undefined; | ||
var minInclusive = node.hasAttribute('minInclusive') ? parseInt(node.getAttribute('minInclusive')) : undefined; | ||
var maxInclusive = node.hasAttribute('maxInclusive') ? parseInt(node.getAttribute('maxInclusive')) : undefined; | ||
var optionNodes = (0, _utils.xPathArray)(node, 'parameters:Option', _utils.resolver); | ||
@@ -281,0 +281,0 @@ var options = void 0; |
@@ -345,3 +345,8 @@ 'use strict'; | ||
var parameters = (0, _parameter.parseTemplateParameters)(templateUrl); | ||
var parsed = (0, _urlParse2.default)(templateUrl, true); | ||
var parameters = Object.keys(parsed.query).map(function (name) { | ||
return _parameter.OpenSearchParameter.fromKeyValuePair(name, parsed.query[name]); | ||
}).filter(function (parameter) { | ||
return parameter; | ||
}); | ||
return new OpenSearchUrl(type, templateUrl, parameters, method, enctype); | ||
@@ -348,0 +353,0 @@ } |
{ | ||
"name": "opensearch-browser", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "An OpenSearch client supporting the geo and time extensions.", | ||
@@ -49,3 +49,3 @@ "main": "dist/index.js", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^3.0.1", | ||
"eslint-plugin-jsx-a11y": "^2.2.3", | ||
"eslint-plugin-react": "^6.7.1", | ||
@@ -52,0 +52,0 @@ "fetch-mock": "^5.5.0", |
@@ -202,3 +202,3 @@ import { xPath, xPathArray } from '../utils'; | ||
parseMedia(node) { | ||
return xPathArray(node, 'media:content').map(mediaNode => ({ | ||
return xPathArray(node, 'media:group/media:content|media:content').map(mediaNode => ({ | ||
url: mediaNode.getAttribute('url'), | ||
@@ -205,0 +205,0 @@ category: xPath(mediaNode, 'media:category/text()'), |
@@ -231,9 +231,9 @@ import { stringify } from 'wellknown'; | ||
const minExclusive = node.hasAttribute('minExclusive') | ||
? parseInt(node.getAttribute('minExclusive')) : null; | ||
? parseInt(node.getAttribute('minExclusive')) : undefined; | ||
const maxExclusive = node.hasAttribute('maxExclusive') | ||
? parseInt(node.getAttribute('maxExclusive')) : null; | ||
? parseInt(node.getAttribute('maxExclusive')) : undefined; | ||
const minInclusive = node.hasAttribute('minInclusive') | ||
? parseInt(node.getAttribute('minInclusive')) : null; | ||
? parseInt(node.getAttribute('minInclusive')) : undefined; | ||
const maxInclusive = node.hasAttribute('maxInclusive') | ||
? parseInt(node.getAttribute('maxInclusive')) : null; | ||
? parseInt(node.getAttribute('maxInclusive')) : undefined; | ||
const optionNodes = xPathArray(node, 'parameters:Option', resolver); | ||
@@ -240,0 +240,0 @@ let options; |
import parse from 'url-parse'; | ||
import { xPathArray, resolver, namespaces, getAttributeNS } from './utils'; | ||
import { OpenSearchParameter, parseTemplateParameters } from './parameter'; | ||
import { OpenSearchParameter } from './parameter'; | ||
@@ -275,5 +275,8 @@ | ||
enctype = 'application/x-www-form-urlencoded') { | ||
const parameters = parseTemplateParameters(templateUrl); | ||
const parsed = parse(templateUrl, true); | ||
const parameters = Object.keys(parsed.query) | ||
.map(name => OpenSearchParameter.fromKeyValuePair(name, parsed.query[name])) | ||
.filter(parameter => parameter); | ||
return new OpenSearchUrl(type, templateUrl, parameters, method, enctype); | ||
} | ||
} |
@@ -0,1 +1,3 @@ | ||
/* eslint-disable no-unused-expressions */ | ||
import { expect } from 'chai'; | ||
@@ -2,0 +4,0 @@ import { OpenSearchParameter } from '../src/parameter.js'; |
import { expect } from 'chai'; | ||
import { OpenSearchUrl } from '../src/url.js'; | ||
import { OpenSearchParameter } from '../src/parameter.js'; | ||
import { parseXml } from '../src/utils.js'; | ||
@@ -18,4 +19,4 @@ | ||
expect(url.parameters).to.deep.equal([ | ||
{ name: 'q', type: 'searchTerms', mandatory: true }, | ||
{ name: 'start', type: 'startIndex', mandatory: false }, | ||
new OpenSearchParameter('searchTerms', 'q', true), | ||
new OpenSearchParameter('startIndex', 'start', false), | ||
]); | ||
@@ -53,5 +54,5 @@ }); | ||
expect(url.parameters).to.deep.equal([ | ||
{ name: 'q', type: 'searchTerms', mandatory: true, options: undefined }, | ||
{ name: 'count', type: 'itemsPerPage', mandatory: false, options: undefined }, | ||
{ name: 'start', type: 'startIndex', mandatory: false, options: undefined }, | ||
new OpenSearchParameter('searchTerms', 'q', true), | ||
new OpenSearchParameter('itemsPerPage', 'count', false), | ||
new OpenSearchParameter('startIndex', 'start', false), | ||
]); | ||
@@ -58,0 +59,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1332276
3706