When using a Writer with format N-Triples and adding quads that include a graph, the writer will output in N-Quads format.
Code (using N3.js version 1.0.4):
var N3 = require('../N3');
const writer = new N3.Writer({ format:'N-Triples' });
writer.addQuad(
N3.DataFactory.namedNode('http://example.org/cartoons#Tom'),
N3.DataFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
N3.DataFactory.namedNode('http://example.org/cartoons#Cat'),
N3.DataFactory.namedNode('http://example.org/cartoons#Graph')
);
writer.end((error, result) => console.log(result));
Output:
<http://example.org/cartoons#Tom> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/cartoons#Cat> <http://example.org/cartoons#Graph> .
I would expect the writer to ignore the graph when I ask for the N-Triples format.