Socket
Socket
Sign inDemoInstall

@tpluscode/rdf-string

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tpluscode/rdf-string - npm Package Compare versions

Comparing version 0.2.10 to 0.2.11

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [0.2.11](https://github.com/tpluscode/rdf-string/compare/v0.2.10...v0.2.11) (2020-04-18)
### Bug Fixes
* properly escape multiple literals and sepcial chars ([eb420cc](https://github.com/tpluscode/rdf-string/commit/eb420cc3869861844a49b0518589feb9f884c48b))
### [0.2.10](https://github.com/tpluscode/rdf-string/compare/v0.2.9...v0.2.10) (2020-04-08)

@@ -7,0 +14,0 @@

1

lib/syntax/ntriples.d.ts
import { BlankNode, Literal, NamedNode } from 'rdf-js';
export declare function blankNode(term: BlankNode): string;
export declare function namedNode(term: NamedNode): string;
export declare function literalValue(term: Literal): string;
export declare function literal(term: Literal): string;
//# sourceMappingURL=ntriples.d.ts.map
import xsd from './xsd';
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];
}
function escapeValue(value) {
if (echarRegEx.test(value)) {
return value.replace(echarRegExAll, echarReplacer);
}
return value;
}
export function blankNode(term) {

@@ -8,4 +25,7 @@ return `_:${term.value}`;

}
export function literalValue(term) {
return `"${escapeValue(term.value)}"`;
}
export function literal(term) {
const value = `"${term.value}"`;
const value = literalValue(term);
if (term.language) {

@@ -12,0 +32,0 @@ return `${value}@${term.language}`;

2

lib/syntax/turtle.js

@@ -38,3 +38,3 @@ import { shrink } from '@zazuko/rdf-vocabularies';

return {
value: `"${term.value}"^^${datatypeResult.value}`,
value: `${ntriples.literalValue(term)}^^${datatypeResult.value}`,
prefixes: datatypeResult.prefixes,

@@ -41,0 +41,0 @@ };

{
"name": "@tpluscode/rdf-string",
"version": "0.2.10",
"version": "0.2.11",
"description": "Simplifies creating of RDF strings using ECMAscript templates",

@@ -5,0 +5,0 @@ "main": "main.js",

Sorry, the diff of this file is not supported yet

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