plist 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +30 -2
- package/History.md +9 -0
- package/Makefile +33 -1
- package/README.md +3 -1
- package/dist/plist-build.js +942 -884
- package/dist/plist-parse.js +238 -179
- package/dist/plist.js +1013 -904
- package/package.json +5 -4
- package/.zuul.yml +0 -18
package/dist/plist-parse.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.plist=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);
|
|
1
|
+
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.plist=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
2
2
|
(function (Buffer){
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Module dependencies.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
var deprecate =
|
|
9
|
-
var DOMParser =
|
|
8
|
+
var deprecate = require('util-deprecate');
|
|
9
|
+
var DOMParser = require('xmldom').DOMParser;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Module exports.
|
|
@@ -201,8 +201,8 @@ function parsePlistXML (node) {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
}).call(this,
|
|
205
|
-
},{"buffer":3,"util-deprecate":5,"xmldom":6}],2:[function(
|
|
204
|
+
}).call(this,require("buffer").Buffer)
|
|
205
|
+
},{"buffer":3,"util-deprecate":5,"xmldom":6}],2:[function(require,module,exports){
|
|
206
206
|
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
207
207
|
|
|
208
208
|
;(function (exports) {
|
|
@@ -325,7 +325,7 @@ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
|
325
325
|
module.exports.fromByteArray = uint8ToBase64
|
|
326
326
|
}())
|
|
327
327
|
|
|
328
|
-
},{}],3:[function(
|
|
328
|
+
},{}],3:[function(require,module,exports){
|
|
329
329
|
/*!
|
|
330
330
|
* The buffer module from node.js, for the browser.
|
|
331
331
|
*
|
|
@@ -333,8 +333,8 @@ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
|
333
333
|
* @license MIT
|
|
334
334
|
*/
|
|
335
335
|
|
|
336
|
-
var base64 =
|
|
337
|
-
var ieee754 =
|
|
336
|
+
var base64 = require('base64-js')
|
|
337
|
+
var ieee754 = require('ieee754')
|
|
338
338
|
|
|
339
339
|
exports.Buffer = Buffer
|
|
340
340
|
exports.SlowBuffer = Buffer
|
|
@@ -342,22 +342,35 @@ exports.INSPECT_MAX_BYTES = 50
|
|
|
342
342
|
Buffer.poolSize = 8192
|
|
343
343
|
|
|
344
344
|
/**
|
|
345
|
-
* If `
|
|
345
|
+
* If `TYPED_ARRAY_SUPPORT`:
|
|
346
346
|
* === true Use Uint8Array implementation (fastest)
|
|
347
|
-
* === false Use Object implementation (compatible
|
|
347
|
+
* === false Use Object implementation (most compatible, even IE6)
|
|
348
|
+
*
|
|
349
|
+
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
350
|
+
* Opera 11.6+, iOS 4.2+.
|
|
351
|
+
*
|
|
352
|
+
* Note:
|
|
353
|
+
*
|
|
354
|
+
* - Implementation must support adding new properties to `Uint8Array` instances.
|
|
355
|
+
* Firefox 4-29 lacked support, fixed in Firefox 30+.
|
|
356
|
+
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
|
357
|
+
*
|
|
358
|
+
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
|
359
|
+
*
|
|
360
|
+
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
|
361
|
+
* incorrect length in some situations.
|
|
362
|
+
*
|
|
363
|
+
* We detect these buggy browsers and set `TYPED_ARRAY_SUPPORT` to `false` so they will
|
|
364
|
+
* get the Object implementation, which is slower but will work correctly.
|
|
348
365
|
*/
|
|
349
|
-
|
|
350
|
-
// Detect if browser supports Typed Arrays. Supported browsers are IE 10+, Firefox 4+,
|
|
351
|
-
// Chrome 7+, Safari 5.1+, Opera 11.6+, iOS 4.2+. If the browser does not support adding
|
|
352
|
-
// properties to `Uint8Array` instances, then that's the same as no `Uint8Array` support
|
|
353
|
-
// because we need to be able to add all the node Buffer API methods. This is an issue
|
|
354
|
-
// in Firefox 4-29. Now fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=695438
|
|
366
|
+
var TYPED_ARRAY_SUPPORT = (function () {
|
|
355
367
|
try {
|
|
356
368
|
var buf = new ArrayBuffer(0)
|
|
357
369
|
var arr = new Uint8Array(buf)
|
|
358
370
|
arr.foo = function () { return 42 }
|
|
359
|
-
return 42 === arr.foo() &&
|
|
360
|
-
typeof arr.subarray === 'function' //
|
|
371
|
+
return 42 === arr.foo() && // typed array instances can be augmented
|
|
372
|
+
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
|
|
373
|
+
new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
|
|
361
374
|
} catch (e) {
|
|
362
375
|
return false
|
|
363
376
|
}
|
|
@@ -381,28 +394,23 @@ function Buffer (subject, encoding, noZero) {
|
|
|
381
394
|
|
|
382
395
|
var type = typeof subject
|
|
383
396
|
|
|
384
|
-
// Workaround: node's base64 implementation allows for non-padded strings
|
|
385
|
-
// while base64-js does not.
|
|
386
|
-
if (encoding === 'base64' && type === 'string') {
|
|
387
|
-
subject = stringtrim(subject)
|
|
388
|
-
while (subject.length % 4 !== 0) {
|
|
389
|
-
subject = subject + '='
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
397
|
// Find the length
|
|
394
398
|
var length
|
|
395
399
|
if (type === 'number')
|
|
396
|
-
length =
|
|
397
|
-
else if (type === 'string')
|
|
400
|
+
length = subject > 0 ? subject >>> 0 : 0
|
|
401
|
+
else if (type === 'string') {
|
|
402
|
+
if (encoding === 'base64')
|
|
403
|
+
subject = base64clean(subject)
|
|
398
404
|
length = Buffer.byteLength(subject, encoding)
|
|
399
|
-
else if (type === 'object')
|
|
400
|
-
|
|
401
|
-
|
|
405
|
+
} else if (type === 'object' && subject !== null) { // assume object is array-like
|
|
406
|
+
if (subject.type === 'Buffer' && isArray(subject.data))
|
|
407
|
+
subject = subject.data
|
|
408
|
+
length = +subject.length > 0 ? Math.floor(+subject.length) : 0
|
|
409
|
+
} else
|
|
402
410
|
throw new Error('First argument needs to be a number, array or string.')
|
|
403
411
|
|
|
404
412
|
var buf
|
|
405
|
-
if (
|
|
413
|
+
if (TYPED_ARRAY_SUPPORT) {
|
|
406
414
|
// Preferred: Return an augmented `Uint8Array` instance for best performance
|
|
407
415
|
buf = Buffer._augment(new Uint8Array(length))
|
|
408
416
|
} else {
|
|
@@ -413,20 +421,21 @@ function Buffer (subject, encoding, noZero) {
|
|
|
413
421
|
}
|
|
414
422
|
|
|
415
423
|
var i
|
|
416
|
-
if (
|
|
424
|
+
if (TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {
|
|
417
425
|
// Speed optimization -- use set if we're copying from a typed array
|
|
418
426
|
buf._set(subject)
|
|
419
427
|
} else if (isArrayish(subject)) {
|
|
420
428
|
// Treat array-ish objects as a byte array
|
|
421
|
-
|
|
422
|
-
|
|
429
|
+
if (Buffer.isBuffer(subject)) {
|
|
430
|
+
for (i = 0; i < length; i++)
|
|
423
431
|
buf[i] = subject.readUInt8(i)
|
|
424
|
-
|
|
425
|
-
|
|
432
|
+
} else {
|
|
433
|
+
for (i = 0; i < length; i++)
|
|
434
|
+
buf[i] = ((subject[i] % 256) + 256) % 256
|
|
426
435
|
}
|
|
427
436
|
} else if (type === 'string') {
|
|
428
437
|
buf.write(subject, 0, encoding)
|
|
429
|
-
} else if (type === 'number' && !
|
|
438
|
+
} else if (type === 'number' && !TYPED_ARRAY_SUPPORT && !noZero) {
|
|
430
439
|
for (i = 0; i < length; i++) {
|
|
431
440
|
buf[i] = 0
|
|
432
441
|
}
|
|
@@ -458,12 +467,12 @@ Buffer.isEncoding = function (encoding) {
|
|
|
458
467
|
}
|
|
459
468
|
|
|
460
469
|
Buffer.isBuffer = function (b) {
|
|
461
|
-
return !!(b
|
|
470
|
+
return !!(b != null && b._isBuffer)
|
|
462
471
|
}
|
|
463
472
|
|
|
464
473
|
Buffer.byteLength = function (str, encoding) {
|
|
465
474
|
var ret
|
|
466
|
-
str = str
|
|
475
|
+
str = str.toString()
|
|
467
476
|
switch (encoding || 'utf8') {
|
|
468
477
|
case 'hex':
|
|
469
478
|
ret = str.length / 2
|
|
@@ -493,8 +502,7 @@ Buffer.byteLength = function (str, encoding) {
|
|
|
493
502
|
}
|
|
494
503
|
|
|
495
504
|
Buffer.concat = function (list, totalLength) {
|
|
496
|
-
assert(isArray(list), 'Usage: Buffer.concat(list,
|
|
497
|
-
'list should be an Array.')
|
|
505
|
+
assert(isArray(list), 'Usage: Buffer.concat(list[, length])')
|
|
498
506
|
|
|
499
507
|
if (list.length === 0) {
|
|
500
508
|
return new Buffer(0)
|
|
@@ -503,7 +511,7 @@ Buffer.concat = function (list, totalLength) {
|
|
|
503
511
|
}
|
|
504
512
|
|
|
505
513
|
var i
|
|
506
|
-
if (
|
|
514
|
+
if (totalLength === undefined) {
|
|
507
515
|
totalLength = 0
|
|
508
516
|
for (i = 0; i < list.length; i++) {
|
|
509
517
|
totalLength += list[i].length
|
|
@@ -520,10 +528,28 @@ Buffer.concat = function (list, totalLength) {
|
|
|
520
528
|
return buf
|
|
521
529
|
}
|
|
522
530
|
|
|
531
|
+
Buffer.compare = function (a, b) {
|
|
532
|
+
assert(Buffer.isBuffer(a) && Buffer.isBuffer(b), 'Arguments must be Buffers')
|
|
533
|
+
var x = a.length
|
|
534
|
+
var y = b.length
|
|
535
|
+
for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}
|
|
536
|
+
if (i !== len) {
|
|
537
|
+
x = a[i]
|
|
538
|
+
y = b[i]
|
|
539
|
+
}
|
|
540
|
+
if (x < y) {
|
|
541
|
+
return -1
|
|
542
|
+
}
|
|
543
|
+
if (y < x) {
|
|
544
|
+
return 1
|
|
545
|
+
}
|
|
546
|
+
return 0
|
|
547
|
+
}
|
|
548
|
+
|
|
523
549
|
// BUFFER INSTANCE METHODS
|
|
524
550
|
// =======================
|
|
525
551
|
|
|
526
|
-
function
|
|
552
|
+
function hexWrite (buf, string, offset, length) {
|
|
527
553
|
offset = Number(offset) || 0
|
|
528
554
|
var remaining = buf.length - offset
|
|
529
555
|
if (!length) {
|
|
@@ -547,35 +573,30 @@ function _hexWrite (buf, string, offset, length) {
|
|
|
547
573
|
assert(!isNaN(byte), 'Invalid hex string')
|
|
548
574
|
buf[offset + i] = byte
|
|
549
575
|
}
|
|
550
|
-
Buffer._charsWritten = i * 2
|
|
551
576
|
return i
|
|
552
577
|
}
|
|
553
578
|
|
|
554
|
-
function
|
|
555
|
-
var charsWritten =
|
|
556
|
-
blitBuffer(utf8ToBytes(string), buf, offset, length)
|
|
579
|
+
function utf8Write (buf, string, offset, length) {
|
|
580
|
+
var charsWritten = blitBuffer(utf8ToBytes(string), buf, offset, length)
|
|
557
581
|
return charsWritten
|
|
558
582
|
}
|
|
559
583
|
|
|
560
|
-
function
|
|
561
|
-
var charsWritten =
|
|
562
|
-
blitBuffer(asciiToBytes(string), buf, offset, length)
|
|
584
|
+
function asciiWrite (buf, string, offset, length) {
|
|
585
|
+
var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length)
|
|
563
586
|
return charsWritten
|
|
564
587
|
}
|
|
565
588
|
|
|
566
|
-
function
|
|
567
|
-
return
|
|
589
|
+
function binaryWrite (buf, string, offset, length) {
|
|
590
|
+
return asciiWrite(buf, string, offset, length)
|
|
568
591
|
}
|
|
569
592
|
|
|
570
|
-
function
|
|
571
|
-
var charsWritten =
|
|
572
|
-
blitBuffer(base64ToBytes(string), buf, offset, length)
|
|
593
|
+
function base64Write (buf, string, offset, length) {
|
|
594
|
+
var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length)
|
|
573
595
|
return charsWritten
|
|
574
596
|
}
|
|
575
597
|
|
|
576
|
-
function
|
|
577
|
-
var charsWritten =
|
|
578
|
-
blitBuffer(utf16leToBytes(string), buf, offset, length)
|
|
598
|
+
function utf16leWrite (buf, string, offset, length) {
|
|
599
|
+
var charsWritten = blitBuffer(utf16leToBytes(string), buf, offset, length)
|
|
579
600
|
return charsWritten
|
|
580
601
|
}
|
|
581
602
|
|
|
@@ -609,26 +630,26 @@ Buffer.prototype.write = function (string, offset, length, encoding) {
|
|
|
609
630
|
var ret
|
|
610
631
|
switch (encoding) {
|
|
611
632
|
case 'hex':
|
|
612
|
-
ret =
|
|
633
|
+
ret = hexWrite(this, string, offset, length)
|
|
613
634
|
break
|
|
614
635
|
case 'utf8':
|
|
615
636
|
case 'utf-8':
|
|
616
|
-
ret =
|
|
637
|
+
ret = utf8Write(this, string, offset, length)
|
|
617
638
|
break
|
|
618
639
|
case 'ascii':
|
|
619
|
-
ret =
|
|
640
|
+
ret = asciiWrite(this, string, offset, length)
|
|
620
641
|
break
|
|
621
642
|
case 'binary':
|
|
622
|
-
ret =
|
|
643
|
+
ret = binaryWrite(this, string, offset, length)
|
|
623
644
|
break
|
|
624
645
|
case 'base64':
|
|
625
|
-
ret =
|
|
646
|
+
ret = base64Write(this, string, offset, length)
|
|
626
647
|
break
|
|
627
648
|
case 'ucs2':
|
|
628
649
|
case 'ucs-2':
|
|
629
650
|
case 'utf16le':
|
|
630
651
|
case 'utf-16le':
|
|
631
|
-
ret =
|
|
652
|
+
ret = utf16leWrite(this, string, offset, length)
|
|
632
653
|
break
|
|
633
654
|
default:
|
|
634
655
|
throw new Error('Unknown encoding')
|
|
@@ -641,9 +662,7 @@ Buffer.prototype.toString = function (encoding, start, end) {
|
|
|
641
662
|
|
|
642
663
|
encoding = String(encoding || 'utf8').toLowerCase()
|
|
643
664
|
start = Number(start) || 0
|
|
644
|
-
end = (end
|
|
645
|
-
? Number(end)
|
|
646
|
-
: end = self.length
|
|
665
|
+
end = (end === undefined) ? self.length : Number(end)
|
|
647
666
|
|
|
648
667
|
// Fastpath empty strings
|
|
649
668
|
if (end === start)
|
|
@@ -652,26 +671,26 @@ Buffer.prototype.toString = function (encoding, start, end) {
|
|
|
652
671
|
var ret
|
|
653
672
|
switch (encoding) {
|
|
654
673
|
case 'hex':
|
|
655
|
-
ret =
|
|
674
|
+
ret = hexSlice(self, start, end)
|
|
656
675
|
break
|
|
657
676
|
case 'utf8':
|
|
658
677
|
case 'utf-8':
|
|
659
|
-
ret =
|
|
678
|
+
ret = utf8Slice(self, start, end)
|
|
660
679
|
break
|
|
661
680
|
case 'ascii':
|
|
662
|
-
ret =
|
|
681
|
+
ret = asciiSlice(self, start, end)
|
|
663
682
|
break
|
|
664
683
|
case 'binary':
|
|
665
|
-
ret =
|
|
684
|
+
ret = binarySlice(self, start, end)
|
|
666
685
|
break
|
|
667
686
|
case 'base64':
|
|
668
|
-
ret =
|
|
687
|
+
ret = base64Slice(self, start, end)
|
|
669
688
|
break
|
|
670
689
|
case 'ucs2':
|
|
671
690
|
case 'ucs-2':
|
|
672
691
|
case 'utf16le':
|
|
673
692
|
case 'utf-16le':
|
|
674
|
-
ret =
|
|
693
|
+
ret = utf16leSlice(self, start, end)
|
|
675
694
|
break
|
|
676
695
|
default:
|
|
677
696
|
throw new Error('Unknown encoding')
|
|
@@ -686,6 +705,16 @@ Buffer.prototype.toJSON = function () {
|
|
|
686
705
|
}
|
|
687
706
|
}
|
|
688
707
|
|
|
708
|
+
Buffer.prototype.equals = function (b) {
|
|
709
|
+
assert(Buffer.isBuffer(b), 'Argument must be a Buffer')
|
|
710
|
+
return Buffer.compare(this, b) === 0
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
Buffer.prototype.compare = function (b) {
|
|
714
|
+
assert(Buffer.isBuffer(b), 'Argument must be a Buffer')
|
|
715
|
+
return Buffer.compare(this, b)
|
|
716
|
+
}
|
|
717
|
+
|
|
689
718
|
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
690
719
|
Buffer.prototype.copy = function (target, target_start, start, end) {
|
|
691
720
|
var source = this
|
|
@@ -713,15 +742,16 @@ Buffer.prototype.copy = function (target, target_start, start, end) {
|
|
|
713
742
|
|
|
714
743
|
var len = end - start
|
|
715
744
|
|
|
716
|
-
if (len < 100 || !
|
|
717
|
-
for (var i = 0; i < len; i++)
|
|
745
|
+
if (len < 100 || !TYPED_ARRAY_SUPPORT) {
|
|
746
|
+
for (var i = 0; i < len; i++) {
|
|
718
747
|
target[i + target_start] = this[i + start]
|
|
748
|
+
}
|
|
719
749
|
} else {
|
|
720
750
|
target._set(this.subarray(start, start + len), target_start)
|
|
721
751
|
}
|
|
722
752
|
}
|
|
723
753
|
|
|
724
|
-
function
|
|
754
|
+
function base64Slice (buf, start, end) {
|
|
725
755
|
if (start === 0 && end === buf.length) {
|
|
726
756
|
return base64.fromByteArray(buf)
|
|
727
757
|
} else {
|
|
@@ -729,7 +759,7 @@ function _base64Slice (buf, start, end) {
|
|
|
729
759
|
}
|
|
730
760
|
}
|
|
731
761
|
|
|
732
|
-
function
|
|
762
|
+
function utf8Slice (buf, start, end) {
|
|
733
763
|
var res = ''
|
|
734
764
|
var tmp = ''
|
|
735
765
|
end = Math.min(buf.length, end)
|
|
@@ -746,20 +776,21 @@ function _utf8Slice (buf, start, end) {
|
|
|
746
776
|
return res + decodeUtf8Char(tmp)
|
|
747
777
|
}
|
|
748
778
|
|
|
749
|
-
function
|
|
779
|
+
function asciiSlice (buf, start, end) {
|
|
750
780
|
var ret = ''
|
|
751
781
|
end = Math.min(buf.length, end)
|
|
752
782
|
|
|
753
|
-
for (var i = start; i < end; i++)
|
|
783
|
+
for (var i = start; i < end; i++) {
|
|
754
784
|
ret += String.fromCharCode(buf[i])
|
|
785
|
+
}
|
|
755
786
|
return ret
|
|
756
787
|
}
|
|
757
788
|
|
|
758
|
-
function
|
|
759
|
-
return
|
|
789
|
+
function binarySlice (buf, start, end) {
|
|
790
|
+
return asciiSlice(buf, start, end)
|
|
760
791
|
}
|
|
761
792
|
|
|
762
|
-
function
|
|
793
|
+
function hexSlice (buf, start, end) {
|
|
763
794
|
var len = buf.length
|
|
764
795
|
|
|
765
796
|
if (!start || start < 0) start = 0
|
|
@@ -772,21 +803,40 @@ function _hexSlice (buf, start, end) {
|
|
|
772
803
|
return out
|
|
773
804
|
}
|
|
774
805
|
|
|
775
|
-
function
|
|
806
|
+
function utf16leSlice (buf, start, end) {
|
|
776
807
|
var bytes = buf.slice(start, end)
|
|
777
808
|
var res = ''
|
|
778
809
|
for (var i = 0; i < bytes.length; i += 2) {
|
|
779
|
-
res += String.fromCharCode(bytes[i] + bytes[i+1] * 256)
|
|
810
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
|
|
780
811
|
}
|
|
781
812
|
return res
|
|
782
813
|
}
|
|
783
814
|
|
|
784
815
|
Buffer.prototype.slice = function (start, end) {
|
|
785
816
|
var len = this.length
|
|
786
|
-
start =
|
|
787
|
-
end =
|
|
817
|
+
start = ~~start
|
|
818
|
+
end = end === undefined ? len : ~~end
|
|
819
|
+
|
|
820
|
+
if (start < 0) {
|
|
821
|
+
start += len;
|
|
822
|
+
if (start < 0)
|
|
823
|
+
start = 0
|
|
824
|
+
} else if (start > len) {
|
|
825
|
+
start = len
|
|
826
|
+
}
|
|
788
827
|
|
|
789
|
-
if (
|
|
828
|
+
if (end < 0) {
|
|
829
|
+
end += len
|
|
830
|
+
if (end < 0)
|
|
831
|
+
end = 0
|
|
832
|
+
} else if (end > len) {
|
|
833
|
+
end = len
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
if (end < start)
|
|
837
|
+
end = start
|
|
838
|
+
|
|
839
|
+
if (TYPED_ARRAY_SUPPORT) {
|
|
790
840
|
return Buffer._augment(this.subarray(start, end))
|
|
791
841
|
} else {
|
|
792
842
|
var sliceLen = end - start
|
|
@@ -822,7 +872,7 @@ Buffer.prototype.readUInt8 = function (offset, noAssert) {
|
|
|
822
872
|
return this[offset]
|
|
823
873
|
}
|
|
824
874
|
|
|
825
|
-
function
|
|
875
|
+
function readUInt16 (buf, offset, littleEndian, noAssert) {
|
|
826
876
|
if (!noAssert) {
|
|
827
877
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
828
878
|
assert(offset !== undefined && offset !== null, 'missing offset')
|
|
@@ -847,14 +897,14 @@ function _readUInt16 (buf, offset, littleEndian, noAssert) {
|
|
|
847
897
|
}
|
|
848
898
|
|
|
849
899
|
Buffer.prototype.readUInt16LE = function (offset, noAssert) {
|
|
850
|
-
return
|
|
900
|
+
return readUInt16(this, offset, true, noAssert)
|
|
851
901
|
}
|
|
852
902
|
|
|
853
903
|
Buffer.prototype.readUInt16BE = function (offset, noAssert) {
|
|
854
|
-
return
|
|
904
|
+
return readUInt16(this, offset, false, noAssert)
|
|
855
905
|
}
|
|
856
906
|
|
|
857
|
-
function
|
|
907
|
+
function readUInt32 (buf, offset, littleEndian, noAssert) {
|
|
858
908
|
if (!noAssert) {
|
|
859
909
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
860
910
|
assert(offset !== undefined && offset !== null, 'missing offset')
|
|
@@ -887,11 +937,11 @@ function _readUInt32 (buf, offset, littleEndian, noAssert) {
|
|
|
887
937
|
}
|
|
888
938
|
|
|
889
939
|
Buffer.prototype.readUInt32LE = function (offset, noAssert) {
|
|
890
|
-
return
|
|
940
|
+
return readUInt32(this, offset, true, noAssert)
|
|
891
941
|
}
|
|
892
942
|
|
|
893
943
|
Buffer.prototype.readUInt32BE = function (offset, noAssert) {
|
|
894
|
-
return
|
|
944
|
+
return readUInt32(this, offset, false, noAssert)
|
|
895
945
|
}
|
|
896
946
|
|
|
897
947
|
Buffer.prototype.readInt8 = function (offset, noAssert) {
|
|
@@ -911,7 +961,7 @@ Buffer.prototype.readInt8 = function (offset, noAssert) {
|
|
|
911
961
|
return this[offset]
|
|
912
962
|
}
|
|
913
963
|
|
|
914
|
-
function
|
|
964
|
+
function readInt16 (buf, offset, littleEndian, noAssert) {
|
|
915
965
|
if (!noAssert) {
|
|
916
966
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
917
967
|
assert(offset !== undefined && offset !== null, 'missing offset')
|
|
@@ -922,7 +972,7 @@ function _readInt16 (buf, offset, littleEndian, noAssert) {
|
|
|
922
972
|
if (offset >= len)
|
|
923
973
|
return
|
|
924
974
|
|
|
925
|
-
var val =
|
|
975
|
+
var val = readUInt16(buf, offset, littleEndian, true)
|
|
926
976
|
var neg = val & 0x8000
|
|
927
977
|
if (neg)
|
|
928
978
|
return (0xffff - val + 1) * -1
|
|
@@ -931,14 +981,14 @@ function _readInt16 (buf, offset, littleEndian, noAssert) {
|
|
|
931
981
|
}
|
|
932
982
|
|
|
933
983
|
Buffer.prototype.readInt16LE = function (offset, noAssert) {
|
|
934
|
-
return
|
|
984
|
+
return readInt16(this, offset, true, noAssert)
|
|
935
985
|
}
|
|
936
986
|
|
|
937
987
|
Buffer.prototype.readInt16BE = function (offset, noAssert) {
|
|
938
|
-
return
|
|
988
|
+
return readInt16(this, offset, false, noAssert)
|
|
939
989
|
}
|
|
940
990
|
|
|
941
|
-
function
|
|
991
|
+
function readInt32 (buf, offset, littleEndian, noAssert) {
|
|
942
992
|
if (!noAssert) {
|
|
943
993
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
944
994
|
assert(offset !== undefined && offset !== null, 'missing offset')
|
|
@@ -949,7 +999,7 @@ function _readInt32 (buf, offset, littleEndian, noAssert) {
|
|
|
949
999
|
if (offset >= len)
|
|
950
1000
|
return
|
|
951
1001
|
|
|
952
|
-
var val =
|
|
1002
|
+
var val = readUInt32(buf, offset, littleEndian, true)
|
|
953
1003
|
var neg = val & 0x80000000
|
|
954
1004
|
if (neg)
|
|
955
1005
|
return (0xffffffff - val + 1) * -1
|
|
@@ -958,14 +1008,14 @@ function _readInt32 (buf, offset, littleEndian, noAssert) {
|
|
|
958
1008
|
}
|
|
959
1009
|
|
|
960
1010
|
Buffer.prototype.readInt32LE = function (offset, noAssert) {
|
|
961
|
-
return
|
|
1011
|
+
return readInt32(this, offset, true, noAssert)
|
|
962
1012
|
}
|
|
963
1013
|
|
|
964
1014
|
Buffer.prototype.readInt32BE = function (offset, noAssert) {
|
|
965
|
-
return
|
|
1015
|
+
return readInt32(this, offset, false, noAssert)
|
|
966
1016
|
}
|
|
967
1017
|
|
|
968
|
-
function
|
|
1018
|
+
function readFloat (buf, offset, littleEndian, noAssert) {
|
|
969
1019
|
if (!noAssert) {
|
|
970
1020
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
971
1021
|
assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
|
|
@@ -975,14 +1025,14 @@ function _readFloat (buf, offset, littleEndian, noAssert) {
|
|
|
975
1025
|
}
|
|
976
1026
|
|
|
977
1027
|
Buffer.prototype.readFloatLE = function (offset, noAssert) {
|
|
978
|
-
return
|
|
1028
|
+
return readFloat(this, offset, true, noAssert)
|
|
979
1029
|
}
|
|
980
1030
|
|
|
981
1031
|
Buffer.prototype.readFloatBE = function (offset, noAssert) {
|
|
982
|
-
return
|
|
1032
|
+
return readFloat(this, offset, false, noAssert)
|
|
983
1033
|
}
|
|
984
1034
|
|
|
985
|
-
function
|
|
1035
|
+
function readDouble (buf, offset, littleEndian, noAssert) {
|
|
986
1036
|
if (!noAssert) {
|
|
987
1037
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
988
1038
|
assert(offset + 7 < buf.length, 'Trying to read beyond buffer length')
|
|
@@ -992,11 +1042,11 @@ function _readDouble (buf, offset, littleEndian, noAssert) {
|
|
|
992
1042
|
}
|
|
993
1043
|
|
|
994
1044
|
Buffer.prototype.readDoubleLE = function (offset, noAssert) {
|
|
995
|
-
return
|
|
1045
|
+
return readDouble(this, offset, true, noAssert)
|
|
996
1046
|
}
|
|
997
1047
|
|
|
998
1048
|
Buffer.prototype.readDoubleBE = function (offset, noAssert) {
|
|
999
|
-
return
|
|
1049
|
+
return readDouble(this, offset, false, noAssert)
|
|
1000
1050
|
}
|
|
1001
1051
|
|
|
1002
1052
|
Buffer.prototype.writeUInt8 = function (value, offset, noAssert) {
|
|
@@ -1010,9 +1060,10 @@ Buffer.prototype.writeUInt8 = function (value, offset, noAssert) {
|
|
|
1010
1060
|
if (offset >= this.length) return
|
|
1011
1061
|
|
|
1012
1062
|
this[offset] = value
|
|
1063
|
+
return offset + 1
|
|
1013
1064
|
}
|
|
1014
1065
|
|
|
1015
|
-
function
|
|
1066
|
+
function writeUInt16 (buf, value, offset, littleEndian, noAssert) {
|
|
1016
1067
|
if (!noAssert) {
|
|
1017
1068
|
assert(value !== undefined && value !== null, 'missing value')
|
|
1018
1069
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
@@ -1030,17 +1081,18 @@ function _writeUInt16 (buf, value, offset, littleEndian, noAssert) {
|
|
|
1030
1081
|
(value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
|
1031
1082
|
(littleEndian ? i : 1 - i) * 8
|
|
1032
1083
|
}
|
|
1084
|
+
return offset + 2
|
|
1033
1085
|
}
|
|
1034
1086
|
|
|
1035
1087
|
Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) {
|
|
1036
|
-
|
|
1088
|
+
return writeUInt16(this, value, offset, true, noAssert)
|
|
1037
1089
|
}
|
|
1038
1090
|
|
|
1039
1091
|
Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) {
|
|
1040
|
-
|
|
1092
|
+
return writeUInt16(this, value, offset, false, noAssert)
|
|
1041
1093
|
}
|
|
1042
1094
|
|
|
1043
|
-
function
|
|
1095
|
+
function writeUInt32 (buf, value, offset, littleEndian, noAssert) {
|
|
1044
1096
|
if (!noAssert) {
|
|
1045
1097
|
assert(value !== undefined && value !== null, 'missing value')
|
|
1046
1098
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
@@ -1057,14 +1109,15 @@ function _writeUInt32 (buf, value, offset, littleEndian, noAssert) {
|
|
|
1057
1109
|
buf[offset + i] =
|
|
1058
1110
|
(value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
|
|
1059
1111
|
}
|
|
1112
|
+
return offset + 4
|
|
1060
1113
|
}
|
|
1061
1114
|
|
|
1062
1115
|
Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) {
|
|
1063
|
-
|
|
1116
|
+
return writeUInt32(this, value, offset, true, noAssert)
|
|
1064
1117
|
}
|
|
1065
1118
|
|
|
1066
1119
|
Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) {
|
|
1067
|
-
|
|
1120
|
+
return writeUInt32(this, value, offset, false, noAssert)
|
|
1068
1121
|
}
|
|
1069
1122
|
|
|
1070
1123
|
Buffer.prototype.writeInt8 = function (value, offset, noAssert) {
|
|
@@ -1082,9 +1135,10 @@ Buffer.prototype.writeInt8 = function (value, offset, noAssert) {
|
|
|
1082
1135
|
this.writeUInt8(value, offset, noAssert)
|
|
1083
1136
|
else
|
|
1084
1137
|
this.writeUInt8(0xff + value + 1, offset, noAssert)
|
|
1138
|
+
return offset + 1
|
|
1085
1139
|
}
|
|
1086
1140
|
|
|
1087
|
-
function
|
|
1141
|
+
function writeInt16 (buf, value, offset, littleEndian, noAssert) {
|
|
1088
1142
|
if (!noAssert) {
|
|
1089
1143
|
assert(value !== undefined && value !== null, 'missing value')
|
|
1090
1144
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
@@ -1098,20 +1152,21 @@ function _writeInt16 (buf, value, offset, littleEndian, noAssert) {
|
|
|
1098
1152
|
return
|
|
1099
1153
|
|
|
1100
1154
|
if (value >= 0)
|
|
1101
|
-
|
|
1155
|
+
writeUInt16(buf, value, offset, littleEndian, noAssert)
|
|
1102
1156
|
else
|
|
1103
|
-
|
|
1157
|
+
writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert)
|
|
1158
|
+
return offset + 2
|
|
1104
1159
|
}
|
|
1105
1160
|
|
|
1106
1161
|
Buffer.prototype.writeInt16LE = function (value, offset, noAssert) {
|
|
1107
|
-
|
|
1162
|
+
return writeInt16(this, value, offset, true, noAssert)
|
|
1108
1163
|
}
|
|
1109
1164
|
|
|
1110
1165
|
Buffer.prototype.writeInt16BE = function (value, offset, noAssert) {
|
|
1111
|
-
|
|
1166
|
+
return writeInt16(this, value, offset, false, noAssert)
|
|
1112
1167
|
}
|
|
1113
1168
|
|
|
1114
|
-
function
|
|
1169
|
+
function writeInt32 (buf, value, offset, littleEndian, noAssert) {
|
|
1115
1170
|
if (!noAssert) {
|
|
1116
1171
|
assert(value !== undefined && value !== null, 'missing value')
|
|
1117
1172
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
@@ -1125,20 +1180,21 @@ function _writeInt32 (buf, value, offset, littleEndian, noAssert) {
|
|
|
1125
1180
|
return
|
|
1126
1181
|
|
|
1127
1182
|
if (value >= 0)
|
|
1128
|
-
|
|
1183
|
+
writeUInt32(buf, value, offset, littleEndian, noAssert)
|
|
1129
1184
|
else
|
|
1130
|
-
|
|
1185
|
+
writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert)
|
|
1186
|
+
return offset + 4
|
|
1131
1187
|
}
|
|
1132
1188
|
|
|
1133
1189
|
Buffer.prototype.writeInt32LE = function (value, offset, noAssert) {
|
|
1134
|
-
|
|
1190
|
+
return writeInt32(this, value, offset, true, noAssert)
|
|
1135
1191
|
}
|
|
1136
1192
|
|
|
1137
1193
|
Buffer.prototype.writeInt32BE = function (value, offset, noAssert) {
|
|
1138
|
-
|
|
1194
|
+
return writeInt32(this, value, offset, false, noAssert)
|
|
1139
1195
|
}
|
|
1140
1196
|
|
|
1141
|
-
function
|
|
1197
|
+
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
1142
1198
|
if (!noAssert) {
|
|
1143
1199
|
assert(value !== undefined && value !== null, 'missing value')
|
|
1144
1200
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
@@ -1152,17 +1208,18 @@ function _writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
|
1152
1208
|
return
|
|
1153
1209
|
|
|
1154
1210
|
ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
|
1211
|
+
return offset + 4
|
|
1155
1212
|
}
|
|
1156
1213
|
|
|
1157
1214
|
Buffer.prototype.writeFloatLE = function (value, offset, noAssert) {
|
|
1158
|
-
|
|
1215
|
+
return writeFloat(this, value, offset, true, noAssert)
|
|
1159
1216
|
}
|
|
1160
1217
|
|
|
1161
1218
|
Buffer.prototype.writeFloatBE = function (value, offset, noAssert) {
|
|
1162
|
-
|
|
1219
|
+
return writeFloat(this, value, offset, false, noAssert)
|
|
1163
1220
|
}
|
|
1164
1221
|
|
|
1165
|
-
function
|
|
1222
|
+
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
1166
1223
|
if (!noAssert) {
|
|
1167
1224
|
assert(value !== undefined && value !== null, 'missing value')
|
|
1168
1225
|
assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
|
@@ -1177,14 +1234,15 @@ function _writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
|
1177
1234
|
return
|
|
1178
1235
|
|
|
1179
1236
|
ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
|
1237
|
+
return offset + 8
|
|
1180
1238
|
}
|
|
1181
1239
|
|
|
1182
1240
|
Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) {
|
|
1183
|
-
|
|
1241
|
+
return writeDouble(this, value, offset, true, noAssert)
|
|
1184
1242
|
}
|
|
1185
1243
|
|
|
1186
1244
|
Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) {
|
|
1187
|
-
|
|
1245
|
+
return writeDouble(this, value, offset, false, noAssert)
|
|
1188
1246
|
}
|
|
1189
1247
|
|
|
1190
1248
|
// fill(value, start=0, end=buffer.length)
|
|
@@ -1193,11 +1251,6 @@ Buffer.prototype.fill = function (value, start, end) {
|
|
|
1193
1251
|
if (!start) start = 0
|
|
1194
1252
|
if (!end) end = this.length
|
|
1195
1253
|
|
|
1196
|
-
if (typeof value === 'string') {
|
|
1197
|
-
value = value.charCodeAt(0)
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
assert(typeof value === 'number' && !isNaN(value), 'value is not a number')
|
|
1201
1254
|
assert(end >= start, 'end < start')
|
|
1202
1255
|
|
|
1203
1256
|
// Fill 0 bytes; we're done
|
|
@@ -1207,9 +1260,20 @@ Buffer.prototype.fill = function (value, start, end) {
|
|
|
1207
1260
|
assert(start >= 0 && start < this.length, 'start out of bounds')
|
|
1208
1261
|
assert(end >= 0 && end <= this.length, 'end out of bounds')
|
|
1209
1262
|
|
|
1210
|
-
|
|
1211
|
-
|
|
1263
|
+
var i
|
|
1264
|
+
if (typeof value === 'number') {
|
|
1265
|
+
for (i = start; i < end; i++) {
|
|
1266
|
+
this[i] = value
|
|
1267
|
+
}
|
|
1268
|
+
} else {
|
|
1269
|
+
var bytes = utf8ToBytes(value.toString())
|
|
1270
|
+
var len = bytes.length
|
|
1271
|
+
for (i = start; i < end; i++) {
|
|
1272
|
+
this[i] = bytes[i % len]
|
|
1273
|
+
}
|
|
1212
1274
|
}
|
|
1275
|
+
|
|
1276
|
+
return this
|
|
1213
1277
|
}
|
|
1214
1278
|
|
|
1215
1279
|
Buffer.prototype.inspect = function () {
|
|
@@ -1231,12 +1295,13 @@ Buffer.prototype.inspect = function () {
|
|
|
1231
1295
|
*/
|
|
1232
1296
|
Buffer.prototype.toArrayBuffer = function () {
|
|
1233
1297
|
if (typeof Uint8Array !== 'undefined') {
|
|
1234
|
-
if (
|
|
1298
|
+
if (TYPED_ARRAY_SUPPORT) {
|
|
1235
1299
|
return (new Buffer(this)).buffer
|
|
1236
1300
|
} else {
|
|
1237
1301
|
var buf = new Uint8Array(this.length)
|
|
1238
|
-
for (var i = 0, len = buf.length; i < len; i += 1)
|
|
1302
|
+
for (var i = 0, len = buf.length; i < len; i += 1) {
|
|
1239
1303
|
buf[i] = this[i]
|
|
1304
|
+
}
|
|
1240
1305
|
return buf.buffer
|
|
1241
1306
|
}
|
|
1242
1307
|
} else {
|
|
@@ -1247,11 +1312,6 @@ Buffer.prototype.toArrayBuffer = function () {
|
|
|
1247
1312
|
// HELPER FUNCTIONS
|
|
1248
1313
|
// ================
|
|
1249
1314
|
|
|
1250
|
-
function stringtrim (str) {
|
|
1251
|
-
if (str.trim) return str.trim()
|
|
1252
|
-
return str.replace(/^\s+|\s+$/g, '')
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
1315
|
var BP = Buffer.prototype
|
|
1256
1316
|
|
|
1257
1317
|
/**
|
|
@@ -1272,6 +1332,8 @@ Buffer._augment = function (arr) {
|
|
|
1272
1332
|
arr.toString = BP.toString
|
|
1273
1333
|
arr.toLocaleString = BP.toString
|
|
1274
1334
|
arr.toJSON = BP.toJSON
|
|
1335
|
+
arr.equals = BP.equals
|
|
1336
|
+
arr.compare = BP.compare
|
|
1275
1337
|
arr.copy = BP.copy
|
|
1276
1338
|
arr.slice = BP.slice
|
|
1277
1339
|
arr.readUInt8 = BP.readUInt8
|
|
@@ -1309,23 +1371,21 @@ Buffer._augment = function (arr) {
|
|
|
1309
1371
|
return arr
|
|
1310
1372
|
}
|
|
1311
1373
|
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1374
|
+
var INVALID_BASE64_RE = /[^+\/0-9A-z]/g
|
|
1375
|
+
|
|
1376
|
+
function base64clean (str) {
|
|
1377
|
+
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
1378
|
+
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
|
|
1379
|
+
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
1380
|
+
while (str.length % 4 !== 0) {
|
|
1381
|
+
str = str + '='
|
|
1382
|
+
}
|
|
1383
|
+
return str
|
|
1321
1384
|
}
|
|
1322
1385
|
|
|
1323
|
-
function
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
// double negate to coerce a NaN to 0. Easy, right?
|
|
1327
|
-
length = ~~Math.ceil(+length)
|
|
1328
|
-
return length < 0 ? 0 : length
|
|
1386
|
+
function stringtrim (str) {
|
|
1387
|
+
if (str.trim) return str.trim()
|
|
1388
|
+
return str.replace(/^\s+|\s+$/g, '')
|
|
1329
1389
|
}
|
|
1330
1390
|
|
|
1331
1391
|
function isArray (subject) {
|
|
@@ -1349,14 +1409,15 @@ function utf8ToBytes (str) {
|
|
|
1349
1409
|
var byteArray = []
|
|
1350
1410
|
for (var i = 0; i < str.length; i++) {
|
|
1351
1411
|
var b = str.charCodeAt(i)
|
|
1352
|
-
if (b <= 0x7F)
|
|
1353
|
-
byteArray.push(
|
|
1354
|
-
else {
|
|
1412
|
+
if (b <= 0x7F) {
|
|
1413
|
+
byteArray.push(b)
|
|
1414
|
+
} else {
|
|
1355
1415
|
var start = i
|
|
1356
1416
|
if (b >= 0xD800 && b <= 0xDFFF) i++
|
|
1357
1417
|
var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%')
|
|
1358
|
-
for (var j = 0; j < h.length; j++)
|
|
1418
|
+
for (var j = 0; j < h.length; j++) {
|
|
1359
1419
|
byteArray.push(parseInt(h[j], 16))
|
|
1420
|
+
}
|
|
1360
1421
|
}
|
|
1361
1422
|
}
|
|
1362
1423
|
return byteArray
|
|
@@ -1390,7 +1451,6 @@ function base64ToBytes (str) {
|
|
|
1390
1451
|
}
|
|
1391
1452
|
|
|
1392
1453
|
function blitBuffer (src, dst, offset, length) {
|
|
1393
|
-
var pos
|
|
1394
1454
|
for (var i = 0; i < length; i++) {
|
|
1395
1455
|
if ((i + offset >= dst.length) || (i >= src.length))
|
|
1396
1456
|
break
|
|
@@ -1436,7 +1496,7 @@ function assert (test, message) {
|
|
|
1436
1496
|
if (!test) throw new Error(message || 'Failed assertion')
|
|
1437
1497
|
}
|
|
1438
1498
|
|
|
1439
|
-
},{"base64-js":2,"ieee754":4}],4:[function(
|
|
1499
|
+
},{"base64-js":2,"ieee754":4}],4:[function(require,module,exports){
|
|
1440
1500
|
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
|
1441
1501
|
var e, m,
|
|
1442
1502
|
eLen = nBytes * 8 - mLen - 1,
|
|
@@ -1522,7 +1582,7 @@ exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
|
|
|
1522
1582
|
buffer[offset + i - d] |= s * 128;
|
|
1523
1583
|
};
|
|
1524
1584
|
|
|
1525
|
-
},{}],5:[function(
|
|
1585
|
+
},{}],5:[function(require,module,exports){
|
|
1526
1586
|
(function (global){
|
|
1527
1587
|
|
|
1528
1588
|
/**
|
|
@@ -1580,8 +1640,8 @@ function config (name) {
|
|
|
1580
1640
|
return String(val).toLowerCase() === 'true';
|
|
1581
1641
|
}
|
|
1582
1642
|
|
|
1583
|
-
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
1584
|
-
},{}],6:[function(
|
|
1643
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
1644
|
+
},{}],6:[function(require,module,exports){
|
|
1585
1645
|
function DOMParser(options){
|
|
1586
1646
|
this.options = options ||{locator:{}};
|
|
1587
1647
|
|
|
@@ -1831,14 +1891,14 @@ function appendElement (hander,node) {
|
|
|
1831
1891
|
}
|
|
1832
1892
|
}//appendChild and setAttributeNS are preformance key
|
|
1833
1893
|
|
|
1834
|
-
if(typeof
|
|
1835
|
-
var XMLReader =
|
|
1836
|
-
var DOMImplementation = exports.DOMImplementation =
|
|
1837
|
-
exports.XMLSerializer =
|
|
1894
|
+
if(typeof require == 'function'){
|
|
1895
|
+
var XMLReader = require('./sax').XMLReader;
|
|
1896
|
+
var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation;
|
|
1897
|
+
exports.XMLSerializer = require('./dom').XMLSerializer ;
|
|
1838
1898
|
exports.DOMParser = DOMParser;
|
|
1839
1899
|
}
|
|
1840
1900
|
|
|
1841
|
-
},{"./dom":7,"./sax":8}],7:[function(
|
|
1901
|
+
},{"./dom":7,"./sax":8}],7:[function(require,module,exports){
|
|
1842
1902
|
/*
|
|
1843
1903
|
* DOM Level 2
|
|
1844
1904
|
* Object DOMException
|
|
@@ -2973,12 +3033,12 @@ try{
|
|
|
2973
3033
|
}catch(e){//ie8
|
|
2974
3034
|
}
|
|
2975
3035
|
|
|
2976
|
-
if(typeof
|
|
3036
|
+
if(typeof require == 'function'){
|
|
2977
3037
|
exports.DOMImplementation = DOMImplementation;
|
|
2978
3038
|
exports.XMLSerializer = XMLSerializer;
|
|
2979
3039
|
}
|
|
2980
3040
|
|
|
2981
|
-
},{}],8:[function(
|
|
3041
|
+
},{}],8:[function(require,module,exports){
|
|
2982
3042
|
//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
|
2983
3043
|
//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
|
|
2984
3044
|
//[5] Name ::= NameStartChar (NameChar)*
|
|
@@ -3559,11 +3619,10 @@ function split(source,start){
|
|
|
3559
3619
|
}
|
|
3560
3620
|
}
|
|
3561
3621
|
|
|
3562
|
-
if(typeof
|
|
3622
|
+
if(typeof require == 'function'){
|
|
3563
3623
|
exports.XMLReader = XMLReader;
|
|
3564
3624
|
}
|
|
3565
3625
|
|
|
3566
3626
|
|
|
3567
|
-
},{}]},{},[1])
|
|
3568
|
-
(1)
|
|
3627
|
+
},{}]},{},[1])(1)
|
|
3569
3628
|
});
|