openrosa-xpath-evaluator
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -6,2 +6,6 @@ # Change Log | ||
## [3.1.0] - 2024-07-12 | ||
- Add multi-argument support to distance function (#1328) | ||
## [3.0.0] - 2023-10-30 | ||
@@ -8,0 +12,0 @@ |
{ | ||
"name": "openrosa-xpath-evaluator", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Wrapper for browsers' XPath evaluator with added support for OpenRosa extensions.", | ||
@@ -22,7 +22,6 @@ "homepage": "https://enketo.org", | ||
"type": "git", | ||
"url": "https://github.com/enketo/openrosa-xpath-evaluator" | ||
"url": "https://github.com/enketo/enketo" | ||
}, | ||
"author": "Alex", | ||
"license": "Apache-2.0", | ||
"bugs": "https://github.com/enketo/openrosa-xpath-evaluator/issues", | ||
"bugs": "https://github.com/enketo/enketo/issues", | ||
"devDependencies": { | ||
@@ -38,8 +37,8 @@ "lodash": "^4.17.21", | ||
"npm": "please-use-yarn", | ||
"yarn": ">= 1.22.19 <2" | ||
"yarn": ">= 1.22.22 <2" | ||
}, | ||
"volta": { | ||
"node": "20.5.1", | ||
"yarn": "1.22.19" | ||
"node": "20.15.1", | ||
"yarn": "1.22.22" | ||
} | ||
} |
@@ -127,7 +127,12 @@ const EARTH_EQUATORIAL_RADIUS_METERS = 6378100; | ||
function asGeopoints(r) { | ||
if (r.t === 'arr' && r.v.length > 1) { | ||
return r.v.map(asString); | ||
function asGeopoints(...r) { | ||
if (r.length > 1) { | ||
return r.map(asString); | ||
} | ||
return asString(r).split(';'); | ||
if (r[0].t === 'arr' && r[0].v.length > 1) { | ||
return r[0].v.map(asString); | ||
} | ||
return asString(r[0]).split(';'); | ||
} |
@@ -253,5 +253,5 @@ const { BlankDate, getTimezoneOffsetAsTime } = require('./date-extensions'); | ||
}, | ||
distance(r) { | ||
distance(...r) { | ||
if (arguments.length === 0) throw TOO_FEW_ARGS; | ||
return XPR.number(distance(asGeopoints(r))); | ||
return XPR.number(distance(asGeopoints(...r))); | ||
}, | ||
@@ -258,0 +258,0 @@ exp(r) { |
@@ -17,3 +17,4 @@ const { | ||
'date("not a date")', | ||
'date("opv_3")', | ||
'date("opv3")', | ||
// TODO 'date("opv_3")' once https://bugzilla.mozilla.org/show_bug.cgi?id=1881930 is addressed | ||
'date(true())', | ||
@@ -20,0 +21,0 @@ // TODO "date(convertible())" |
@@ -26,3 +26,10 @@ const { assert } = require('chai'); | ||
}); | ||
it(`should handle multiple arguments`, () => { | ||
assert.deepEqual( | ||
asGeopoints(wrapVal('1'), wrapVal('2'), wrapVal('3')), | ||
['1', '2', '3'] | ||
); | ||
}); | ||
}); | ||
}); |
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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
456830
11354
0
2