Skip to content

Commit 4968c78

Browse files
committed
[Feature] WOQLQuery.prototype.label/description: accept 'woql:Datatype' objects #32
1 parent 54cd803 commit 4968c78

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

lib/query/woqlBuilder.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,8 @@ WOQLQuery.prototype.domain = function(d) {
245245
}
246246

247247
WOQLQuery.prototype.label = function(l, lang) {
248-
if (typeof l !== 'string' && l['@value'] != null) {
249-
lang = l['@language']
250-
l = l['@value']
251-
}
252248
lang = lang ? lang : 'en'
253-
if (l.substring(0, 2) == 'v:') {
249+
if (typeof l === 'object' || l.substring(0, 2) == 'v:') {
254250
var d = l
255251
} else {
256252
var d = {'@value': l, '@type': 'xsd:string', '@language': lang}
@@ -259,12 +255,8 @@ WOQLQuery.prototype.label = function(l, lang) {
259255
}
260256

261257
WOQLQuery.prototype.description = function(c, lang) {
262-
if (typeof c !== 'string' && c['@value'] != null) {
263-
lang = c['@language']
264-
c = c['@value']
265-
}
266258
lang = lang ? lang : 'en'
267-
if (c.substring(0, 2) == 'v:') {
259+
if (typeof c === 'object' || c.substring(0, 2) == 'v:') {
268260
var d = c
269261
} else {
270262
var d = {'@value': c, '@type': 'xsd:string', '@language': lang}

0 commit comments

Comments
 (0)