Skip to content

Commit 9897205

Browse files
committed
Make Term properties enumerable.
1 parent 7a23893 commit 9897205

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lib/N3DataFactory.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ function Term(id) {
1919
Term.subclass = function subclass(Type, name) {
2020
Type.prototype = Object.create(this.prototype, {
2121
constructor: { value: Type },
22-
termType: { value: name || Type.name },
22+
termType: {
23+
enumerable: true,
24+
value: name,
25+
},
2326
});
2427
Type.subclass = subclass;
2528
};
@@ -103,6 +106,7 @@ Term.subclass(NamedNode, 'NamedNode');
103106

104107
// ### The IRI of this named node
105108
Object.defineProperty(NamedNode.prototype, 'value', {
109+
enumerable: true,
106110
get: function () { return this.id; },
107111
});
108112

@@ -117,6 +121,7 @@ Term.subclass(BlankNode, 'BlankNode');
117121

118122
// ### The name of this blank node
119123
Object.defineProperty(BlankNode.prototype, 'value', {
124+
enumerable: true,
120125
get: function () { return this.id.substr(2); },
121126
});
122127

@@ -131,6 +136,7 @@ Term.subclass(Variable, 'Variable');
131136

132137
// ### The name of this variable
133138
Object.defineProperty(Variable.prototype, 'value', {
139+
enumerable: true,
134140
get: function () { return this.id.substr(1); },
135141
});
136142

@@ -145,13 +151,15 @@ Term.subclass(Literal, 'Literal');
145151

146152
// ### The text value of this literal
147153
Object.defineProperty(Literal.prototype, 'value', {
154+
enumerable: true,
148155
get: function () {
149156
return this.id.substring(1, this.id.lastIndexOf('"'));
150157
},
151158
});
152159

153160
// ### The language of this literal
154161
Object.defineProperty(Literal.prototype, 'language', {
162+
enumerable: true,
155163
get: function () {
156164
// Find the last quotation mark (e.g., '"abc"@en-us')
157165
var id = this.id, atPos = id.lastIndexOf('"') + 1;
@@ -162,13 +170,15 @@ Object.defineProperty(Literal.prototype, 'language', {
162170

163171
// ### The datatype IRI of this literal
164172
Object.defineProperty(Literal.prototype, 'datatype', {
173+
enumerable: true,
165174
get: function () {
166175
return new NamedNode(this.datatypeString);
167176
},
168177
});
169178

170179
// ### The datatype string of this literal
171180
Object.defineProperty(Literal.prototype, 'datatypeString', {
181+
enumerable: true,
172182
get: function () {
173183
// Find the last quotation mark (e.g., '"abc"^^http://ex.org/types#t')
174184
var id = this.id, dtPos = id.lastIndexOf('"') + 1, ch;
@@ -215,7 +225,10 @@ DEFAULTGRAPH = new DefaultGraph();
215225
DEFAULTGRAPH.id = '';
216226

217227
// ### The empty string
218-
Object.defineProperty(DefaultGraph.prototype, 'value', { value: '' });
228+
Object.defineProperty(DefaultGraph.prototype, 'value', {
229+
enumerable: true,
230+
value: '',
231+
});
219232

220233
// ### Returns whether this object represents the same term as the other
221234
DefaultGraph.prototype.equals = function (other) {

0 commit comments

Comments
 (0)