New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rdf-ext

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdf-ext - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

3

lib/BlankNode.js

@@ -0,1 +1,2 @@

const termToNTriples = require('@rdfjs/to-ntriples').termToNTriples
const BlankNode = require('@rdfjs/data-model/lib/blank-node')

@@ -5,3 +6,3 @@

toCanonical () {
return '_:' + this.value // TODO: escape special chars
return termToNTriples(this)
}

@@ -8,0 +9,0 @@

const normalize = require('rdf-normalize')
const quadToNTriples = require('@rdfjs/to-ntriples').quadToNTriples
const Dataset = require('rdf-dataset-simple')

@@ -19,9 +20,7 @@ const Quad = require('./Quad')

toString () {
return this._quads.map((quad) => {
return Quad.prototype.toString.call(quad) + '\n'
}).join('')
return this.toArray().map(quad => `${quadToNTriples(quad)}\n`).join('')
}
toJSON () {
return this._quads.map((quad) => { return quad.toJSON() })
return this.toArray().map(quad => Quad.prototype.toJSON.call(quad))
}

@@ -28,0 +27,0 @@ }

@@ -0,1 +1,2 @@

const termToNTriples = require('@rdfjs/to-ntriples').termToNTriples
const DefaultGraph = require('@rdfjs/data-model/lib/default-graph')

@@ -5,7 +6,7 @@

toCanonical () {
return ''
return termToNTriples(this)
}
toString () {
return ''
return this.toCanonical()
}

@@ -12,0 +13,0 @@

@@ -0,31 +1,7 @@

const termToNTriples = require('@rdfjs/to-ntriples').termToNTriples
const Literal = require('@rdfjs/data-model/lib/literal')
const NamedNode = require('./NamedNode')
const echarRegEx = new RegExp('["\\\\\n\r]') // eslint-disable-line no-control-regex
const echarRegExAll = new RegExp('["\\\\\n\r]', 'g') // eslint-disable-line no-control-regex
const echarReplacement = {
'"': '\\"',
'\\': '\\\\',
'\n': '\\n',
'\r': '\\r'
}
function echarReplacer (char) {
return echarReplacement[char]
}
class LiteralExt extends Literal {
toCanonical () {
const escapedValue = LiteralExt.escapeValue(this.value)
if (this.datatype.value === 'http://www.w3.org/2001/XMLSchema#string') {
return '"' + escapedValue + '"'
}
if (this.datatype.value === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#langString') {
return '"' + escapedValue + '"@' + this.language
}
return '"' + escapedValue + '"^^' + NamedNode.prototype.toCanonical.call(this.datatype)
return termToNTriples(this)
}

@@ -45,12 +21,4 @@

}
static escapeValue (value) {
if (echarRegEx.test(value)) {
return value.replace(echarRegExAll, echarReplacer)
} else {
return value
}
}
}
module.exports = LiteralExt

@@ -0,1 +1,2 @@

const termToNTriples = require('@rdfjs/to-ntriples').termToNTriples
const NamedNode = require('@rdfjs/data-model/lib/named-node')

@@ -5,3 +6,3 @@

toCanonical () {
return '<' + this.value + '>' // TODO: escape special chars
return termToNTriples(this)
}

@@ -8,0 +9,0 @@

@@ -0,1 +1,2 @@

const quadToNTriples = require('@rdfjs/to-ntriples').quadToNTriples
const Quad = require('@rdfjs/data-model/lib/quad')

@@ -5,8 +6,3 @@

toCanonical () {
var graphString = this.graph.toCanonical()
return this.subject.toCanonical() + ' ' +
this.predicate.toCanonical() + ' ' +
this.object.toCanonical() +
(graphString ? (' ' + graphString) : '') + ' .'
return quadToNTriples(this)
}

@@ -13,0 +9,0 @@

@@ -0,1 +1,2 @@

const termToNTriples = require('@rdfjs/to-ntriples').termToNTriples
const Variable = require('@rdfjs/data-model/lib/variable')

@@ -5,3 +6,3 @@

toCanonical () {
return '?' + this.value // TODO: escape special chars
return termToNTriples(this)
}

@@ -8,0 +9,0 @@

{
"name": "rdf-ext",
"version": "1.1.1",
"version": "1.1.2",
"description": "Extended Linked Data module",

@@ -26,2 +26,3 @@ "main": "rdf-ext.js",

"@rdfjs/data-model": "^1.1.0",
"@rdfjs/to-ntriples": "^1.0.1",
"rdf-dataset-simple": "^1.0.0",

@@ -28,0 +29,0 @@ "rdf-normalize": "^1.0.0"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc