Skip to content

Commit

Permalink
Literal type improvements linkeddata#355
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Oct 18, 2019
1 parent 1dbc29b commit e7f423e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/literal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ export default class Literal extends Node implements RDFJSLiteral {
/**
* The literal's datatype as a named node
*/
datatype: RDFJSNamedNode
datatype: NamedNode

/**
* Initializes this literal
* @param value The literal's lexical value
* @param language The language for the literal. Defaults to ''.
* @param datatype The literal's datatype as a named node. Defaults to xsd:string.
*/
constructor (value: string, language?: string | null, datatype?: NamedNode) {
constructor (value: string, language?: string | null, datatype?: RDFJSNamedNode) {
super()
this.termType = TermType.Literal
this.value = value
Expand All @@ -48,7 +48,7 @@ export default class Literal extends Node implements RDFJSLiteral {
if (isNamedNode(datatype)) {
this.datatype = datatype
}
this.datatype = NamedNode.fromValue(datatype)
this.datatype = NamedNode.fromValue(datatype) as NamedNode
}
}

Expand All @@ -70,9 +70,9 @@ export default class Literal extends Node implements RDFJSLiteral {

return (this.termType === other.termType) &&
(this.value === other.value) &&
(this.language === other.language) &&
((!this.datatype && !other.datatype) ||
(this.datatype && this.datatype.equals(other.datatype)))
(this.language === (other as Literal).language) &&
((!this.datatype && !(other as Literal).datatype) ||
(this.datatype && this.datatype.equals((other as Literal).datatype)))
}
/**
* The language for the literal
Expand Down

0 comments on commit e7f423e

Please sign in to comment.