Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .eslintrc

This file was deleted.

5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module.exports = {
commonjs: true,
node: true
},
extends: 'eslint-config-digitalbazaar',
extends: [
'eslint-config-digitalbazaar',
'eslint-config-digitalbazaar/jsdoc',
],
root: true
};
12 changes: 6 additions & 6 deletions lib/IdentifierIssuer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = class IdentifierIssuer {
* Creates a new IdentifierIssuer. A IdentifierIssuer issues unique
* identifiers, keeping track of any previously issued identifiers.
*
* @param prefix the prefix to use ('<prefix><counter>').
* @param prefix - The prefix to use ('<prefix><counter>').
*/
constructor(prefix) {
this.prefix = prefix;
Expand All @@ -21,7 +21,7 @@ module.exports = class IdentifierIssuer {
/**
* Copies this IdentifierIssuer.
*
* @return a copy of this IdentifierIssuer.
* @return A copy of this IdentifierIssuer.
*/
clone() {
const copy = new IdentifierIssuer(this.prefix);
Expand All @@ -34,9 +34,9 @@ module.exports = class IdentifierIssuer {
* Gets the new identifier for the given old identifier, where if no old
* identifier is given a new identifier will be generated.
*
* @param [old] the old identifier to get the new identifier for.
* @param [old] - The old identifier to get the new identifier for.
*
* @return the new identifier.
* @return The new identifier.
*/
getId(old) {
// return existing old identifier
Expand All @@ -60,9 +60,9 @@ module.exports = class IdentifierIssuer {
* Returns true if the given old identifer has already been assigned a new
* identifier.
*
* @param old the old identifier to check.
* @param old - The old identifier to check.
*
* @return true if the old identifier has been assigned a new identifier,
* @return True if the old identifier has been assigned a new identifier,
* false if not.
*/
hasId(old) {
Expand Down
30 changes: 15 additions & 15 deletions lib/NQuads.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ module.exports = class NQuads {
/**
* Parses RDF in the form of N-Quads.
*
* @param input the N-Quads input to parse.
* @param input - The N-Quads input to parse.
*
* @return an RDF dataset (an array of quads per http://rdf.js.org/).
* @return An RDF dataset (an array of quads per http://rdf.js.org/).
*/
static parse(input) {
// build RDF dataset
Expand Down Expand Up @@ -178,9 +178,9 @@ module.exports = class NQuads {
/**
* Converts an RDF dataset to N-Quads.
*
* @param dataset (array of quads) the RDF dataset to convert.
* @param dataset - (array of quads) the RDF dataset to convert.
*
* @return the N-Quads string.
* @return The N-Quads string.
*/
static serialize(dataset) {
if(!Array.isArray(dataset)) {
Expand All @@ -196,9 +196,9 @@ module.exports = class NQuads {
/**
* Converts an RDF quad to an N-Quad string (a single quad).
*
* @param quad the RDF quad convert.
* @param quad - The RDF quad convert.
*
* @return the N-Quad string.
* @return The N-Quad string.
*/
static serializeQuad(quad) {
const s = quad.subject;
Expand Down Expand Up @@ -250,17 +250,17 @@ module.exports = class NQuads {
* Converts a legacy-formatted dataset to an array of quads dataset per
* http://rdf.js.org/.
*
* @param dataset the legacy dataset to convert.
* @param dataset - The legacy dataset to convert.
*
* @return the array of quads dataset.
* @return The array of quads dataset.
*/
static legacyDatasetToQuads(dataset) {
const quads = [];

const termTypeMap = {
'blank node': 'BlankNode',
'IRI': 'NamedNode',
'literal': 'Literal'
IRI: 'NamedNode',
literal: 'Literal'
};

for(const graphName in dataset) {
Expand Down Expand Up @@ -313,10 +313,10 @@ module.exports = class NQuads {
/**
* Compares two RDF triples for equality.
*
* @param t1 the first triple.
* @param t2 the second triple.
* @param t1 - The first triple.
* @param t2 - The second triple.
*
* @return true if the triples are the same, false if not.
* @return True if the triples are the same, false if not.
*/
function _compareTriples(t1, t2) {
for(const k in t1) {
Expand All @@ -336,7 +336,7 @@ function _compareTriples(t1, t2) {

const _escapeRegex = /["\\\n\r]/g;
/**
* Escape string to N-Quads literal
* Escape string to N-Quads literal.
*/
function _escape(s) {
return s.replace(_escapeRegex, function(match) {
Expand All @@ -352,7 +352,7 @@ function _escape(s) {
const _unescapeRegex =
/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;
/**
* Unescape N-Quads literal to string
* Unescape N-Quads literal to string.
*/
function _unescape(s) {
return s.replace(_unescapeRegex, function(match, code, u, U) {
Expand Down
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ api.canonize = util.callbackify(async function(dataset, options) {
/**
* Synchronously canonizes an RDF dataset.
*
* @param dataset the dataset to canonize.
* @param options the options to use:
* @param dataset - The dataset to canonize.
* @param options The options to use:
* algorithm the canonicalization algorithm to use: `URDNA2015`.
*
* @return the RDF dataset in canonical form.
* @return The RDF dataset in canonical form.
*/
api.canonizeSync = function(dataset, options) {
// back-compat with legacy dataset
Expand Down
12 changes: 6 additions & 6 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ api.setImmediate = _setImmediate ? _delay : api.nextTick;
* Clones an object, array, or string/number. If a typed JavaScript object
* is given, such as a Date, it will be converted to a string.
*
* @param value the value to clone.
* @param value - The value to clone.
*
* @return the cloned value.
* @return The cloned value.
*/
api.clone = function(value) {
if(value && typeof value === 'object') {
Expand All @@ -57,18 +57,18 @@ api.clone = function(value) {
/**
* Returns true if the given value is an Object.
*
* @param v the value to check.
* @param v - The value to check.
*
* @return true if the value is an Object, false if not.
* @return True if the value is an Object, false if not.
*/
api.isObject = v => Object.prototype.toString.call(v) === '[object Object]';

/**
* Returns true if the given value is undefined.
*
* @param v the value to check.
* @param v - The value to check.
*
* @return true if the value is undefined, false if not.
* @return True if the value is undefined, false if not.
*/
api.isUndefined = v => typeof v === 'undefined';

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"commander": "^2.19.0",
"eslint": "^5.14.1",
"eslint-config-digitalbazaar": "^1.6.0",
"eslint-plugin-jsdoc": "^4.6.0",
"mocha": "^5.2.0",
"uuid": "^3.3.2"
},
Expand Down