From 46acfbbd947fe100ee3d6642d0afdbffe50848b1 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Tue, 7 Jan 2025 12:50:48 +0100 Subject: [PATCH] Add optional direction for literals (#38) * Add optional direction for literals * Add changeset * Also allow null directions --- .changeset/famous-parrots-rush.md | 5 +++++ data-model.d.ts | 28 ++++++++++++++++++++-------- rdf-js-tests.ts | 7 +++++++ 3 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 .changeset/famous-parrots-rush.md diff --git a/.changeset/famous-parrots-rush.md b/.changeset/famous-parrots-rush.md new file mode 100644 index 0000000..61eaa41 --- /dev/null +++ b/.changeset/famous-parrots-rush.md @@ -0,0 +1,5 @@ +--- +"@rdfjs/types": minor +--- + +Add optional direction for literals diff --git a/data-model.d.ts b/data-model.d.ts index 50ca6d5..3ecb7d6 100644 --- a/data-model.d.ts +++ b/data-model.d.ts @@ -73,6 +73,10 @@ export interface Literal { * @link http://tools.ietf.org/html/bcp47 */ language: string; + /** + * the direction of the language-tagged string. + */ + direction?: 'ltr' | 'rtl' | '' | null; /** * A NamedNode whose IRI represents the datatype of the literal. */ @@ -81,7 +85,7 @@ export interface Literal { /** * @param other The term to compare with. * @return True if and only if other has termType "Literal" - * and the same `value`, `language`, and `datatype`. + * and the same `value`, `language`, `direction`, and `datatype`. */ equals(other: Term | null | undefined): boolean; } @@ -254,16 +258,19 @@ export interface DataFactory {};