-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Side effects: STATE is no longer exported. This is not a "breaking change" properly speaking because it was never advertized formally as part of the API. BREAKING CHANGE: It is no longer possible to load the library as-is through a ``script`` element. It needs building. The library now assumes a modern runtime. It no longer contains any code to polyfill what's missing. It is up to developers using this code to deal with polyfills as needed.
- Loading branch information
Showing
52 changed files
with
3,934 additions
and
3,364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
extends: [ | ||
"lddubeau-base", | ||
], | ||
env: { | ||
node: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,42 @@ | ||
var fs = require('fs'), | ||
util = require('util'), | ||
path = require('path'), | ||
xml = fs.readFileSync(path.join(__dirname, 'test.xml'), 'utf8'), | ||
saxes = require('../lib/saxes'), | ||
parser = saxes.parser(), | ||
inspector = function (ev) { return function (data) { | ||
console.error('%s %s %j', this.line + ':' + this.column, ev, data) | ||
"use strict"; | ||
|
||
/* eslint-disable no-console */ | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
const saxes = require("../lib/saxes"); | ||
|
||
const parser = saxes.parser(); | ||
|
||
function inspector(ev) { | ||
return function handler(data) { | ||
console.error("%s %s %j", `${this.line}:${this.column}`, ev, data); | ||
if (ev === "error") { | ||
parser.resume() | ||
parser.resume(); | ||
} | ||
}} | ||
|
||
saxes.EVENTS.forEach(function (ev) { | ||
parser['on' + ev] = inspector(ev) | ||
}) | ||
parser.onend = function () { | ||
console.error('end') | ||
console.error(parser) | ||
}; | ||
} | ||
|
||
// do this in random bits at a time to verify that it works. | ||
(function () { | ||
saxes.EVENTS.forEach((ev) => { | ||
parser[`on${ev}`] = inspector(ev); | ||
}); | ||
|
||
parser.onend = () => { | ||
console.error("end"); | ||
console.error(parser); | ||
}; | ||
|
||
let xml = fs.readFileSync(path.join(__dirname, "test.xml"), "utf8"); | ||
function processChunk() { | ||
if (xml) { | ||
var c = Math.ceil(Math.random() * 1000) | ||
parser.write(xml.substr(0, c)) | ||
xml = xml.substr(c) | ||
process.nextTick(arguments.callee) | ||
} else parser.close() | ||
}()) | ||
const c = Math.ceil(Math.random() * 1000); | ||
parser.write(xml.substr(0, c)); | ||
xml = xml.substr(c); | ||
process.nextTick(processChunk); | ||
} | ||
else { | ||
parser.close(); | ||
} | ||
} | ||
|
||
processChunk(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
extends: "../.eslintrc.js", | ||
rules: { | ||
"no-continue": "off", | ||
}, | ||
} |
Oops, something went wrong.