Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Berners-Lee committed Aug 9, 2016
2 parents 436a486 + 3482d14 commit c04068e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
14 changes: 10 additions & 4 deletions dist/rdflib.js
Original file line number Diff line number Diff line change
Expand Up @@ -22727,7 +22727,10 @@ var Literal = function (_Node) {
}, {
key: 'fromValue',
value: function fromValue(value) {
if (!value || value instanceof Node) {
if (value instanceof Node) {
return value;
}
if (typeof value === 'undefined' || value === null) {
return value;
}
switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) {
Expand All @@ -22736,9 +22739,9 @@ var Literal = function (_Node) {
return Literal.fromDate(value);
}
case 'boolean':
return new Literal.fromBoolean(value);
return Literal.fromBoolean(value);
case 'number':
return new Literal.fromNumber(value);
return Literal.fromNumber(value);
case 'string':
return new Literal(value);
}
Expand Down Expand Up @@ -24456,7 +24459,10 @@ module.exports = Node;
Node.fromValue = function fromValue(value) {
var Collection = require('./collection');
var Literal = require('./literal');
if (!value || value instanceof Node || value instanceof Collection) {
if (value instanceof Node || value instanceof Collection) {
return value;
}
if (typeof value === 'undefined' || value === null) {
return value;
}
if (Array.isArray(value)) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rdflib",
"description": "an RDF library for node.js. Suitable for client and server side.",
"version": "0.8.1",
"version": "0.9.0",
"engines": {
"node": "^6.0"
},
Expand Down
5 changes: 4 additions & 1 deletion src/literal.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ class Literal extends Node {
* @return {Literal}
*/
static fromValue (value) {
if (!value || value instanceof Node) {
if (value instanceof Node) {
return value
}
if (typeof value === 'undefined' || value === null) {
return value
}
switch (typeof value) {
Expand Down
5 changes: 4 additions & 1 deletion src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ module.exports = Node
Node.fromValue = function fromValue (value) {
const Collection = require('./collection')
const Literal = require('./literal')
if (!value || value instanceof Node || value instanceof Collection) {
if (value instanceof Node || value instanceof Collection) {
return value
}
if (typeof value === 'undefined' || value === null) {
return value
}
if (Array.isArray(value)) {
Expand Down

0 comments on commit c04068e

Please sign in to comment.