Skip to content

Commit

Permalink
fix non-ES5 syntax, run build on test
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Oct 11, 2019
1 parent 60ce82e commit 02d1c75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var SHIFT_LEFT_32 = (1 << 16) * (1 << 16),

// Threshold chosen based on both benchmarking and knowledge about browser string
// data structures (which currently switch structure types at 12 bytes or more)
const TEXT_DECODER_MIN_LENGTH = 12;
const utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');
var TEXT_DECODER_MIN_LENGTH = 12;
var utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');

Pbf.prototype = {

Expand Down Expand Up @@ -117,8 +117,8 @@ Pbf.prototype = {
},

readString: function() {
const end = this.readVarint() + this.pos;
const pos = this.pos;
var end = this.readVarint() + this.pos;
var pos = this.pos;
this.pos = end;

if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"jsdelivr": "dist/pbf.js",
"scripts": {
"bench": "node bench/bench.js",
"test": "eslint index.js compile.js test/*.js bench/bench-tiles.js bin/pbf && tap test/*.test.js",
"test": "eslint index.js compile.js test/*.js bench/bench-tiles.js bin/pbf && tap test/*.test.js && npm run build-min",
"cov": "tap test/*.test.js --cov --coverage-report=html",
"build-min": "mkdirp dist && browserify index.js -s Pbf | uglifyjs -c warnings=false -m > dist/pbf.js",
"build-dev": "mkdirp dist && browserify index.js -d -s Pbf > dist/pbf-dev.js",
Expand Down

0 comments on commit 02d1c75

Please sign in to comment.