1 | (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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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 | 'use strict';
|
3 |
|
4 | require('./lib/polyfills');
|
5 | var crypto = require('crypto');
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | exports = module.exports = objectHash;
|
23 |
|
24 | function objectHash(object, options){
|
25 | options = options || {};
|
26 | options.algorithm = options.algorithm || 'sha1';
|
27 | options.encoding = options.encoding || 'hex';
|
28 | options.excludeValues = options.excludeValues ? true : false;
|
29 | options.algorithm = options.algorithm.toLowerCase();
|
30 | options.encoding = options.encoding.toLowerCase();
|
31 |
|
32 | validate(object, options);
|
33 |
|
34 | return hash(object, options);
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | exports.sha1 = function(object){
|
45 | return objectHash(object);
|
46 | };
|
47 | exports.keys = function(object){
|
48 | return objectHash(object, {excludeValues: true, algorithm: 'sha1', encoding: 'hex'});
|
49 | };
|
50 | exports.MD5 = function(object){
|
51 | return objectHash(object, {algorithm: 'md5', encoding: 'hex'});
|
52 | };
|
53 | exports.keysMD5 = function(object){
|
54 | return objectHash(object, {algorithm: 'md5', encoding: 'hex', excludeValues: true});
|
55 | };
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | exports.HashTable = require('./lib/hashTable');
|
62 |
|
63 |
|
64 |
|
65 | function validate(object, options){
|
66 | var hashes = crypto.getHashes ? crypto.getHashes() : ['sha1', 'md5'];
|
67 | var encodings = ['buffer', 'hex', 'binary', 'base64'];
|
68 |
|
69 | if(typeof object === 'undefined') {
|
70 | throw new Error('Object argument required.');
|
71 | }
|
72 |
|
73 | if(hashes.indexOf(options.algorithm) === -1){
|
74 | throw new Error('Algorithm "' + options.algorithm + '" not supported. ' +
|
75 | 'supported values: ' + hashes.join(', '));
|
76 | }
|
77 |
|
78 | if(encodings.indexOf(options.encoding) === -1){
|
79 | throw new Error('Encoding "' + options.encoding + '" not supported. ' +
|
80 | 'supported values: ' + encodings.join(', '));
|
81 | }
|
82 | }
|
83 |
|
84 | function hash(object, options){
|
85 | var hashFn = crypto.createHash(options.algorithm);
|
86 |
|
87 | typeHasher(hashFn, options).dispatch(object);
|
88 |
|
89 | return (options.encoding === 'buffer') ? hashFn.digest() :
|
90 | hashFn.digest(options.encoding);
|
91 | }
|
92 |
|
93 | function typeHasher(hashFn, options){
|
94 | return {
|
95 | dispatch: function(value){
|
96 | var type = typeof value;
|
97 | var func = this['_' + type];
|
98 | return (value === null) ? this._null() : func(value);
|
99 | },
|
100 | _object: function(object) {
|
101 | var pattern = (/\[object (.*)\]/i);
|
102 | var objString = Object.prototype.toString.call(object);
|
103 | var objType = pattern.exec(objString)[1] || 'null';
|
104 | objType = objType.toLowerCase();
|
105 |
|
106 | if(objType !== 'object') {
|
107 | if(typeHasher(hashFn, options)['_' + objType]) {
|
108 | typeHasher(hashFn, options)['_' + objType](object);
|
109 | }else{
|
110 | throw new Error('Unknown object type "' + objType + '"');
|
111 | }
|
112 | }else{
|
113 |
|
114 | var keys = Object.keys(object).sort();
|
115 | return keys.forEach(function(key){
|
116 | hashFn.update(key);
|
117 | if(!options.excludeValues) {
|
118 | typeHasher(hashFn, options).dispatch(object[key]);
|
119 | }
|
120 | });
|
121 | }
|
122 | },
|
123 | _array: function(arr){
|
124 | return arr.forEach(function(el){
|
125 | typeHasher(hashFn, options).dispatch(el);
|
126 | });
|
127 | },
|
128 | _date: function(date){
|
129 | return hashFn.update(date.toString());
|
130 | },
|
131 | _boolean: function(bool){
|
132 | return hashFn.update(bool.toString());
|
133 | },
|
134 | _string: function(string){
|
135 | return hashFn.update(string);
|
136 | },
|
137 | _function: function(fn){
|
138 | return hashFn.update(fn.toString());
|
139 | },
|
140 | _number: function(number){
|
141 | return hashFn.update(number.toString());
|
142 | },
|
143 | _xml: function(xml){
|
144 | return hashFn.update(xml.toString());
|
145 | },
|
146 | _null: function(){
|
147 | return hashFn.update('Null');
|
148 | },
|
149 | _undefined: function(){
|
150 | return hashFn.update('Undefined');
|
151 | },
|
152 | _regexp: function(regex){
|
153 | return hashFn.update(regex.toString());
|
154 | },
|
155 | _domwindow: function(){
|
156 | return hashFn.update('domwindow');
|
157 | }
|
158 | };
|
159 | }
|
160 |
|
161 | },{"./lib/hashTable":2,"./lib/polyfills":3,"crypto":8}],2:[function(require,module,exports){
|
162 | 'use strict';
|
163 | var hasher = require('../index');
|
164 | require('./polyfills');
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 | exports = module.exports = HashTable;
|
179 |
|
180 | function HashTable(options){
|
181 | options = options || {};
|
182 | this.options = options;
|
183 | this._table = {};
|
184 | }
|
185 |
|
186 | HashTable.prototype.add = function(/* values to be added */){
|
187 | var self = this;
|
188 | var args = Array.prototype.slice.call(arguments, 0);
|
189 | args.forEach(function(obj){
|
190 | if(Object.prototype.toString.call(obj) === '[object Array]'){
|
191 | obj.forEach(function(val){
|
192 | self._addObject(val);
|
193 | });
|
194 | }else{
|
195 | self._addObject(obj);
|
196 | }
|
197 | });
|
198 |
|
199 | return this;
|
200 | };
|
201 |
|
202 | HashTable.prototype._addObject = function(object){
|
203 | var hash = hasher(object, this.options);
|
204 |
|
205 | if(this._table[hash]){
|
206 | this._table[hash].count++;
|
207 | if(this.options.excludeValues){
|
208 | this._table[hash].value.push(object);
|
209 | }
|
210 | }else{
|
211 | this._table[hash] = {
|
212 | value: this.options.excludeValues ? [object] : object,
|
213 | count: 1
|
214 | };
|
215 | }
|
216 | }
|
217 |
|
218 | HashTable.prototype.hasKey = function(key){
|
219 | return !!(this._table[key]);
|
220 | };
|
221 |
|
222 | HashTable.prototype.getValue = function(key){
|
223 | return this._table[key] ? this._table[key].value : undefined;
|
224 | };
|
225 |
|
226 | HashTable.prototype.getCount = function(key){
|
227 | return this._table[key] ? this._table[key].count : 0;
|
228 | };
|
229 |
|
230 | HashTable.prototype.table = function(){
|
231 | return this._table;
|
232 | };
|
233 |
|
234 | HashTable.prototype.toArray = function(){
|
235 | var keys = Object.keys(this._table);
|
236 | var arr = [];
|
237 | for(var i = 0;i < keys.length;i++){
|
238 | arr.push({
|
239 | value: this._table[keys[i]].value,
|
240 | count: this._table[keys[i]].count,
|
241 | hash: keys[i]
|
242 | });
|
243 | }
|
244 | return arr;
|
245 | };
|
246 |
|
247 | HashTable.prototype.reset = function(){
|
248 | this._table = {};
|
249 | return this;
|
250 | }
|
251 | },{"../index":1,"./polyfills":3}],3:[function(require,module,exports){
|
252 |
|
253 | if (!Object.keys) {
|
254 | Object.keys = (function () {
|
255 | 'use strict';
|
256 | var hasOwnProperty = Object.prototype.hasOwnProperty,
|
257 | hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
|
258 | dontEnums = [
|
259 | 'toString',
|
260 | 'toLocaleString',
|
261 | 'valueOf',
|
262 | 'hasOwnProperty',
|
263 | 'isPrototypeOf',
|
264 | 'propertyIsEnumerable',
|
265 | 'constructor'
|
266 | ],
|
267 | dontEnumsLength = dontEnums.length;
|
268 |
|
269 | return function (obj) {
|
270 | if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
|
271 | throw new TypeError('Object.keys called on non-object');
|
272 | }
|
273 |
|
274 | var result = [], prop, i;
|
275 |
|
276 | for (prop in obj) {
|
277 | if (hasOwnProperty.call(obj, prop)) {
|
278 | result.push(prop);
|
279 | }
|
280 | }
|
281 |
|
282 | if (hasDontEnumBug) {
|
283 | for (i = 0; i < dontEnumsLength; i++) {
|
284 | if (hasOwnProperty.call(obj, dontEnums[i])) {
|
285 | result.push(dontEnums[i]);
|
286 | }
|
287 | }
|
288 | }
|
289 | return result;
|
290 | };
|
291 | }());
|
292 | }
|
293 |
|
294 |
|
295 | if (!Array.prototype.indexOf) {
|
296 | Array.prototype.indexOf = function (searchElement, fromIndex) {
|
297 | if ( this === undefined || this === null ) {
|
298 | throw new TypeError( '"this" is null or not defined' );
|
299 | }
|
300 |
|
301 | var length = this.length >>> 0;
|
302 |
|
303 | fromIndex = +fromIndex || 0;
|
304 |
|
305 | if (Math.abs(fromIndex) === Infinity) {
|
306 | fromIndex = 0;
|
307 | }
|
308 |
|
309 | if (fromIndex < 0) {
|
310 | fromIndex += length;
|
311 | if (fromIndex < 0) {
|
312 | fromIndex = 0;
|
313 | }
|
314 | }
|
315 |
|
316 | for (;fromIndex < length; fromIndex++) {
|
317 | if (this[fromIndex] === searchElement) {
|
318 | return fromIndex;
|
319 | }
|
320 | }
|
321 |
|
322 | return -1;
|
323 | };
|
324 | }
|
325 |
|
326 | if (!Array.prototype.forEach)
|
327 | {
|
328 | Array.prototype.forEach = function(fun /*, thisArg */)
|
329 | {
|
330 | "use strict";
|
331 |
|
332 | if (this === void 0 || this === null) {
|
333 | throw new TypeError();
|
334 | }
|
335 |
|
336 | var t = Object(this);
|
337 | var len = t.length >>> 0;
|
338 | if (typeof fun !== "function") {
|
339 | throw new TypeError();
|
340 | }
|
341 |
|
342 | var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
|
343 | for (var i = 0; i < len; i++)
|
344 | {
|
345 | if (i in t) {
|
346 | fun.call(thisArg, t[i], i, t);
|
347 | }
|
348 | }
|
349 | };
|
350 | }
|
351 |
|
352 | (function () {
|
353 | 'use strict';
|
354 | var _slice = Array.prototype.slice;
|
355 |
|
356 | try {
|
357 |
|
358 | _slice.call(document.documentElement);
|
359 | }
|
360 | catch (e) {
|
361 | Array.prototype.slice = function (begin, end) {
|
362 | var i, arrl = this.length, a = [];
|
363 |
|
364 |
|
365 |
|
366 | if (this.charAt) {
|
367 | for (i = 0; i < arrl; i++) {
|
368 | a.push(this.charAt(i));
|
369 | }
|
370 | }
|
371 |
|
372 |
|
373 |
|
374 |
|
375 | else {
|
376 |
|
377 |
|
378 | for (i = 0; i < this.length; i++) {
|
379 | a.push(this[i]);
|
380 | }
|
381 | }
|
382 |
|
383 |
|
384 | return _slice.call(a, begin, end || a.length);
|
385 | };
|
386 | }
|
387 | }());
|
388 |
|
389 | },{}],4:[function(require,module,exports){
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 | var base64 = require('base64-js')
|
400 | var ieee754 = require('ieee754')
|
401 |
|
402 | exports.Buffer = Buffer
|
403 | exports.SlowBuffer = Buffer
|
404 | exports.INSPECT_MAX_BYTES = 50
|
405 | Buffer.poolSize = 8192
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 | Buffer._useTypedArrays = (function () {
|
413 |
|
414 |
|
415 | if (typeof Uint8Array !== 'function' || typeof ArrayBuffer !== 'function')
|
416 | return false
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 | try {
|
423 | var arr = new Uint8Array(0)
|
424 | arr.foo = function () { return 42 }
|
425 | return 42 === arr.foo() &&
|
426 | typeof arr.subarray === 'function'
|
427 | } catch (e) {
|
428 | return false
|
429 | }
|
430 | })()
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 | function Buffer (subject, encoding, noZero) {
|
445 | if (!(this instanceof Buffer))
|
446 | return new Buffer(subject, encoding, noZero)
|
447 |
|
448 | var type = typeof subject
|
449 |
|
450 |
|
451 |
|
452 | if (encoding === 'base64' && type === 'string') {
|
453 | subject = stringtrim(subject)
|
454 | while (subject.length % 4 !== 0) {
|
455 | subject = subject + '='
|
456 | }
|
457 | }
|
458 |
|
459 |
|
460 | var length
|
461 | if (type === 'number')
|
462 | length = coerce(subject)
|
463 | else if (type === 'string')
|
464 | length = Buffer.byteLength(subject, encoding)
|
465 | else if (type === 'object')
|
466 | length = coerce(subject.length)
|
467 | else
|
468 | throw new Error('First argument needs to be a number, array or string.')
|
469 |
|
470 | var buf
|
471 | if (Buffer._useTypedArrays) {
|
472 |
|
473 | buf = augment(new Uint8Array(length))
|
474 | } else {
|
475 |
|
476 | buf = this
|
477 | buf.length = length
|
478 | buf._isBuffer = true
|
479 | }
|
480 |
|
481 | var i
|
482 | if (Buffer._useTypedArrays && typeof Uint8Array === 'function' &&
|
483 | subject instanceof Uint8Array) {
|
484 |
|
485 | buf._set(subject)
|
486 | } else if (isArrayish(subject)) {
|
487 |
|
488 | for (i = 0; i < length; i++) {
|
489 | if (Buffer.isBuffer(subject))
|
490 | buf[i] = subject.readUInt8(i)
|
491 | else
|
492 | buf[i] = subject[i]
|
493 | }
|
494 | } else if (type === 'string') {
|
495 | buf.write(subject, 0, encoding)
|
496 | } else if (type === 'number' && !Buffer._useTypedArrays && !noZero) {
|
497 | for (i = 0; i < length; i++) {
|
498 | buf[i] = 0
|
499 | }
|
500 | }
|
501 |
|
502 | return buf
|
503 | }
|
504 |
|
505 |
|
506 |
|
507 |
|
508 | Buffer.isEncoding = function (encoding) {
|
509 | switch (String(encoding).toLowerCase()) {
|
510 | case 'hex':
|
511 | case 'utf8':
|
512 | case 'utf-8':
|
513 | case 'ascii':
|
514 | case 'binary':
|
515 | case 'base64':
|
516 | case 'raw':
|
517 | case 'ucs2':
|
518 | case 'ucs-2':
|
519 | case 'utf16le':
|
520 | case 'utf-16le':
|
521 | return true
|
522 | default:
|
523 | return false
|
524 | }
|
525 | }
|
526 |
|
527 | Buffer.isBuffer = function (b) {
|
528 | return !!(b !== null && b !== undefined && b._isBuffer)
|
529 | }
|
530 |
|
531 | Buffer.byteLength = function (str, encoding) {
|
532 | var ret
|
533 | str = str + ''
|
534 | switch (encoding || 'utf8') {
|
535 | case 'hex':
|
536 | ret = str.length / 2
|
537 | break
|
538 | case 'utf8':
|
539 | case 'utf-8':
|
540 | ret = utf8ToBytes(str).length
|
541 | break
|
542 | case 'ascii':
|
543 | case 'binary':
|
544 | case 'raw':
|
545 | ret = str.length
|
546 | break
|
547 | case 'base64':
|
548 | ret = base64ToBytes(str).length
|
549 | break
|
550 | case 'ucs2':
|
551 | case 'ucs-2':
|
552 | case 'utf16le':
|
553 | case 'utf-16le':
|
554 | ret = str.length * 2
|
555 | break
|
556 | default:
|
557 | throw new Error('Unknown encoding')
|
558 | }
|
559 | return ret
|
560 | }
|
561 |
|
562 | Buffer.concat = function (list, totalLength) {
|
563 | assert(isArray(list), 'Usage: Buffer.concat(list, [totalLength])\n' +
|
564 | 'list should be an Array.')
|
565 |
|
566 | if (list.length === 0) {
|
567 | return new Buffer(0)
|
568 | } else if (list.length === 1) {
|
569 | return list[0]
|
570 | }
|
571 |
|
572 | var i
|
573 | if (typeof totalLength !== 'number') {
|
574 | totalLength = 0
|
575 | for (i = 0; i < list.length; i++) {
|
576 | totalLength += list[i].length
|
577 | }
|
578 | }
|
579 |
|
580 | var buf = new Buffer(totalLength)
|
581 | var pos = 0
|
582 | for (i = 0; i < list.length; i++) {
|
583 | var item = list[i]
|
584 | item.copy(buf, pos)
|
585 | pos += item.length
|
586 | }
|
587 | return buf
|
588 | }
|
589 |
|
590 |
|
591 |
|
592 |
|
593 | function _hexWrite (buf, string, offset, length) {
|
594 | offset = Number(offset) || 0
|
595 | var remaining = buf.length - offset
|
596 | if (!length) {
|
597 | length = remaining
|
598 | } else {
|
599 | length = Number(length)
|
600 | if (length > remaining) {
|
601 | length = remaining
|
602 | }
|
603 | }
|
604 |
|
605 |
|
606 | var strLen = string.length
|
607 | assert(strLen % 2 === 0, 'Invalid hex string')
|
608 |
|
609 | if (length > strLen / 2) {
|
610 | length = strLen / 2
|
611 | }
|
612 | for (var i = 0; i < length; i++) {
|
613 | var byte = parseInt(string.substr(i * 2, 2), 16)
|
614 | assert(!isNaN(byte), 'Invalid hex string')
|
615 | buf[offset + i] = byte
|
616 | }
|
617 | Buffer._charsWritten = i * 2
|
618 | return i
|
619 | }
|
620 |
|
621 | function _utf8Write (buf, string, offset, length) {
|
622 | var charsWritten = Buffer._charsWritten =
|
623 | blitBuffer(utf8ToBytes(string), buf, offset, length)
|
624 | return charsWritten
|
625 | }
|
626 |
|
627 | function _asciiWrite (buf, string, offset, length) {
|
628 | var charsWritten = Buffer._charsWritten =
|
629 | blitBuffer(asciiToBytes(string), buf, offset, length)
|
630 | return charsWritten
|
631 | }
|
632 |
|
633 | function _binaryWrite (buf, string, offset, length) {
|
634 | return _asciiWrite(buf, string, offset, length)
|
635 | }
|
636 |
|
637 | function _base64Write (buf, string, offset, length) {
|
638 | var charsWritten = Buffer._charsWritten =
|
639 | blitBuffer(base64ToBytes(string), buf, offset, length)
|
640 | return charsWritten
|
641 | }
|
642 |
|
643 | function _utf16leWrite (buf, string, offset, length) {
|
644 | var charsWritten = Buffer._charsWritten =
|
645 | blitBuffer(utf16leToBytes(string), buf, offset, length)
|
646 | return charsWritten
|
647 | }
|
648 |
|
649 | Buffer.prototype.write = function (string, offset, length, encoding) {
|
650 |
|
651 |
|
652 | if (isFinite(offset)) {
|
653 | if (!isFinite(length)) {
|
654 | encoding = length
|
655 | length = undefined
|
656 | }
|
657 | } else {
|
658 | var swap = encoding
|
659 | encoding = offset
|
660 | offset = length
|
661 | length = swap
|
662 | }
|
663 |
|
664 | offset = Number(offset) || 0
|
665 | var remaining = this.length - offset
|
666 | if (!length) {
|
667 | length = remaining
|
668 | } else {
|
669 | length = Number(length)
|
670 | if (length > remaining) {
|
671 | length = remaining
|
672 | }
|
673 | }
|
674 | encoding = String(encoding || 'utf8').toLowerCase()
|
675 |
|
676 | var ret
|
677 | switch (encoding) {
|
678 | case 'hex':
|
679 | ret = _hexWrite(this, string, offset, length)
|
680 | break
|
681 | case 'utf8':
|
682 | case 'utf-8':
|
683 | ret = _utf8Write(this, string, offset, length)
|
684 | break
|
685 | case 'ascii':
|
686 | ret = _asciiWrite(this, string, offset, length)
|
687 | break
|
688 | case 'binary':
|
689 | ret = _binaryWrite(this, string, offset, length)
|
690 | break
|
691 | case 'base64':
|
692 | ret = _base64Write(this, string, offset, length)
|
693 | break
|
694 | case 'ucs2':
|
695 | case 'ucs-2':
|
696 | case 'utf16le':
|
697 | case 'utf-16le':
|
698 | ret = _utf16leWrite(this, string, offset, length)
|
699 | break
|
700 | default:
|
701 | throw new Error('Unknown encoding')
|
702 | }
|
703 | return ret
|
704 | }
|
705 |
|
706 | Buffer.prototype.toString = function (encoding, start, end) {
|
707 | var self = this
|
708 |
|
709 | encoding = String(encoding || 'utf8').toLowerCase()
|
710 | start = Number(start) || 0
|
711 | end = (end !== undefined)
|
712 | ? Number(end)
|
713 | : end = self.length
|
714 |
|
715 |
|
716 | if (end === start)
|
717 | return ''
|
718 |
|
719 | var ret
|
720 | switch (encoding) {
|
721 | case 'hex':
|
722 | ret = _hexSlice(self, start, end)
|
723 | break
|
724 | case 'utf8':
|
725 | case 'utf-8':
|
726 | ret = _utf8Slice(self, start, end)
|
727 | break
|
728 | case 'ascii':
|
729 | ret = _asciiSlice(self, start, end)
|
730 | break
|
731 | case 'binary':
|
732 | ret = _binarySlice(self, start, end)
|
733 | break
|
734 | case 'base64':
|
735 | ret = _base64Slice(self, start, end)
|
736 | break
|
737 | case 'ucs2':
|
738 | case 'ucs-2':
|
739 | case 'utf16le':
|
740 | case 'utf-16le':
|
741 | ret = _utf16leSlice(self, start, end)
|
742 | break
|
743 | default:
|
744 | throw new Error('Unknown encoding')
|
745 | }
|
746 | return ret
|
747 | }
|
748 |
|
749 | Buffer.prototype.toJSON = function () {
|
750 | return {
|
751 | type: 'Buffer',
|
752 | data: Array.prototype.slice.call(this._arr || this, 0)
|
753 | }
|
754 | }
|
755 |
|
756 |
|
757 | Buffer.prototype.copy = function (target, target_start, start, end) {
|
758 | var source = this
|
759 |
|
760 | if (!start) start = 0
|
761 | if (!end && end !== 0) end = this.length
|
762 | if (!target_start) target_start = 0
|
763 |
|
764 |
|
765 | if (end === start) return
|
766 | if (target.length === 0 || source.length === 0) return
|
767 |
|
768 |
|
769 | assert(end >= start, 'sourceEnd < sourceStart')
|
770 | assert(target_start >= 0 && target_start < target.length,
|
771 | 'targetStart out of bounds')
|
772 | assert(start >= 0 && start < source.length, 'sourceStart out of bounds')
|
773 | assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds')
|
774 |
|
775 |
|
776 | if (end > this.length)
|
777 | end = this.length
|
778 | if (target.length - target_start < end - start)
|
779 | end = target.length - target_start + start
|
780 |
|
781 |
|
782 | for (var i = 0; i < end - start; i++)
|
783 | target[i + target_start] = this[i + start]
|
784 | }
|
785 |
|
786 | function _base64Slice (buf, start, end) {
|
787 | if (start === 0 && end === buf.length) {
|
788 | return base64.fromByteArray(buf)
|
789 | } else {
|
790 | return base64.fromByteArray(buf.slice(start, end))
|
791 | }
|
792 | }
|
793 |
|
794 | function _utf8Slice (buf, start, end) {
|
795 | var res = ''
|
796 | var tmp = ''
|
797 | end = Math.min(buf.length, end)
|
798 |
|
799 | for (var i = start; i < end; i++) {
|
800 | if (buf[i] <= 0x7F) {
|
801 | res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])
|
802 | tmp = ''
|
803 | } else {
|
804 | tmp += '%' + buf[i].toString(16)
|
805 | }
|
806 | }
|
807 |
|
808 | return res + decodeUtf8Char(tmp)
|
809 | }
|
810 |
|
811 | function _asciiSlice (buf, start, end) {
|
812 | var ret = ''
|
813 | end = Math.min(buf.length, end)
|
814 |
|
815 | for (var i = start; i < end; i++)
|
816 | ret += String.fromCharCode(buf[i])
|
817 | return ret
|
818 | }
|
819 |
|
820 | function _binarySlice (buf, start, end) {
|
821 | return _asciiSlice(buf, start, end)
|
822 | }
|
823 |
|
824 | function _hexSlice (buf, start, end) {
|
825 | var len = buf.length
|
826 |
|
827 | if (!start || start < 0) start = 0
|
828 | if (!end || end < 0 || end > len) end = len
|
829 |
|
830 | var out = ''
|
831 | for (var i = start; i < end; i++) {
|
832 | out += toHex(buf[i])
|
833 | }
|
834 | return out
|
835 | }
|
836 |
|
837 | function _utf16leSlice (buf, start, end) {
|
838 | var bytes = buf.slice(start, end)
|
839 | var res = ''
|
840 | for (var i = 0; i < bytes.length; i += 2) {
|
841 | res += String.fromCharCode(bytes[i] + bytes[i+1] * 256)
|
842 | }
|
843 | return res
|
844 | }
|
845 |
|
846 | Buffer.prototype.slice = function (start, end) {
|
847 | var len = this.length
|
848 | start = clamp(start, len, 0)
|
849 | end = clamp(end, len, len)
|
850 |
|
851 | if (Buffer._useTypedArrays) {
|
852 | return augment(this.subarray(start, end))
|
853 | } else {
|
854 | var sliceLen = end - start
|
855 | var newBuf = new Buffer(sliceLen, undefined, true)
|
856 | for (var i = 0; i < sliceLen; i++) {
|
857 | newBuf[i] = this[i + start]
|
858 | }
|
859 | return newBuf
|
860 | }
|
861 | }
|
862 |
|
863 |
|
864 | Buffer.prototype.get = function (offset) {
|
865 | console.log('.get() is deprecated. Access using array indexes instead.')
|
866 | return this.readUInt8(offset)
|
867 | }
|
868 |
|
869 |
|
870 | Buffer.prototype.set = function (v, offset) {
|
871 | console.log('.set() is deprecated. Access using array indexes instead.')
|
872 | return this.writeUInt8(v, offset)
|
873 | }
|
874 |
|
875 | Buffer.prototype.readUInt8 = function (offset, noAssert) {
|
876 | if (!noAssert) {
|
877 | assert(offset !== undefined && offset !== null, 'missing offset')
|
878 | assert(offset < this.length, 'Trying to read beyond buffer length')
|
879 | }
|
880 |
|
881 | if (offset >= this.length)
|
882 | return
|
883 |
|
884 | return this[offset]
|
885 | }
|
886 |
|
887 | function _readUInt16 (buf, offset, littleEndian, noAssert) {
|
888 | if (!noAssert) {
|
889 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
890 | assert(offset !== undefined && offset !== null, 'missing offset')
|
891 | assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')
|
892 | }
|
893 |
|
894 | var len = buf.length
|
895 | if (offset >= len)
|
896 | return
|
897 |
|
898 | var val
|
899 | if (littleEndian) {
|
900 | val = buf[offset]
|
901 | if (offset + 1 < len)
|
902 | val |= buf[offset + 1] << 8
|
903 | } else {
|
904 | val = buf[offset] << 8
|
905 | if (offset + 1 < len)
|
906 | val |= buf[offset + 1]
|
907 | }
|
908 | return val
|
909 | }
|
910 |
|
911 | Buffer.prototype.readUInt16LE = function (offset, noAssert) {
|
912 | return _readUInt16(this, offset, true, noAssert)
|
913 | }
|
914 |
|
915 | Buffer.prototype.readUInt16BE = function (offset, noAssert) {
|
916 | return _readUInt16(this, offset, false, noAssert)
|
917 | }
|
918 |
|
919 | function _readUInt32 (buf, offset, littleEndian, noAssert) {
|
920 | if (!noAssert) {
|
921 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
922 | assert(offset !== undefined && offset !== null, 'missing offset')
|
923 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
|
924 | }
|
925 |
|
926 | var len = buf.length
|
927 | if (offset >= len)
|
928 | return
|
929 |
|
930 | var val
|
931 | if (littleEndian) {
|
932 | if (offset + 2 < len)
|
933 | val = buf[offset + 2] << 16
|
934 | if (offset + 1 < len)
|
935 | val |= buf[offset + 1] << 8
|
936 | val |= buf[offset]
|
937 | if (offset + 3 < len)
|
938 | val = val + (buf[offset + 3] << 24 >>> 0)
|
939 | } else {
|
940 | if (offset + 1 < len)
|
941 | val = buf[offset + 1] << 16
|
942 | if (offset + 2 < len)
|
943 | val |= buf[offset + 2] << 8
|
944 | if (offset + 3 < len)
|
945 | val |= buf[offset + 3]
|
946 | val = val + (buf[offset] << 24 >>> 0)
|
947 | }
|
948 | return val
|
949 | }
|
950 |
|
951 | Buffer.prototype.readUInt32LE = function (offset, noAssert) {
|
952 | return _readUInt32(this, offset, true, noAssert)
|
953 | }
|
954 |
|
955 | Buffer.prototype.readUInt32BE = function (offset, noAssert) {
|
956 | return _readUInt32(this, offset, false, noAssert)
|
957 | }
|
958 |
|
959 | Buffer.prototype.readInt8 = function (offset, noAssert) {
|
960 | if (!noAssert) {
|
961 | assert(offset !== undefined && offset !== null,
|
962 | 'missing offset')
|
963 | assert(offset < this.length, 'Trying to read beyond buffer length')
|
964 | }
|
965 |
|
966 | if (offset >= this.length)
|
967 | return
|
968 |
|
969 | var neg = this[offset] & 0x80
|
970 | if (neg)
|
971 | return (0xff - this[offset] + 1) * -1
|
972 | else
|
973 | return this[offset]
|
974 | }
|
975 |
|
976 | function _readInt16 (buf, offset, littleEndian, noAssert) {
|
977 | if (!noAssert) {
|
978 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
979 | assert(offset !== undefined && offset !== null, 'missing offset')
|
980 | assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')
|
981 | }
|
982 |
|
983 | var len = buf.length
|
984 | if (offset >= len)
|
985 | return
|
986 |
|
987 | var val = _readUInt16(buf, offset, littleEndian, true)
|
988 | var neg = val & 0x8000
|
989 | if (neg)
|
990 | return (0xffff - val + 1) * -1
|
991 | else
|
992 | return val
|
993 | }
|
994 |
|
995 | Buffer.prototype.readInt16LE = function (offset, noAssert) {
|
996 | return _readInt16(this, offset, true, noAssert)
|
997 | }
|
998 |
|
999 | Buffer.prototype.readInt16BE = function (offset, noAssert) {
|
1000 | return _readInt16(this, offset, false, noAssert)
|
1001 | }
|
1002 |
|
1003 | function _readInt32 (buf, offset, littleEndian, noAssert) {
|
1004 | if (!noAssert) {
|
1005 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
1006 | assert(offset !== undefined && offset !== null, 'missing offset')
|
1007 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
|
1008 | }
|
1009 |
|
1010 | var len = buf.length
|
1011 | if (offset >= len)
|
1012 | return
|
1013 |
|
1014 | var val = _readUInt32(buf, offset, littleEndian, true)
|
1015 | var neg = val & 0x80000000
|
1016 | if (neg)
|
1017 | return (0xffffffff - val + 1) * -1
|
1018 | else
|
1019 | return val
|
1020 | }
|
1021 |
|
1022 | Buffer.prototype.readInt32LE = function (offset, noAssert) {
|
1023 | return _readInt32(this, offset, true, noAssert)
|
1024 | }
|
1025 |
|
1026 | Buffer.prototype.readInt32BE = function (offset, noAssert) {
|
1027 | return _readInt32(this, offset, false, noAssert)
|
1028 | }
|
1029 |
|
1030 | function _readFloat (buf, offset, littleEndian, noAssert) {
|
1031 | if (!noAssert) {
|
1032 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
1033 | assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
|
1034 | }
|
1035 |
|
1036 | return ieee754.read(buf, offset, littleEndian, 23, 4)
|
1037 | }
|
1038 |
|
1039 | Buffer.prototype.readFloatLE = function (offset, noAssert) {
|
1040 | return _readFloat(this, offset, true, noAssert)
|
1041 | }
|
1042 |
|
1043 | Buffer.prototype.readFloatBE = function (offset, noAssert) {
|
1044 | return _readFloat(this, offset, false, noAssert)
|
1045 | }
|
1046 |
|
1047 | function _readDouble (buf, offset, littleEndian, noAssert) {
|
1048 | if (!noAssert) {
|
1049 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
1050 | assert(offset + 7 < buf.length, 'Trying to read beyond buffer length')
|
1051 | }
|
1052 |
|
1053 | return ieee754.read(buf, offset, littleEndian, 52, 8)
|
1054 | }
|
1055 |
|
1056 | Buffer.prototype.readDoubleLE = function (offset, noAssert) {
|
1057 | return _readDouble(this, offset, true, noAssert)
|
1058 | }
|
1059 |
|
1060 | Buffer.prototype.readDoubleBE = function (offset, noAssert) {
|
1061 | return _readDouble(this, offset, false, noAssert)
|
1062 | }
|
1063 |
|
1064 | Buffer.prototype.writeUInt8 = function (value, offset, noAssert) {
|
1065 | if (!noAssert) {
|
1066 | assert(value !== undefined && value !== null, 'missing value')
|
1067 | assert(offset !== undefined && offset !== null, 'missing offset')
|
1068 | assert(offset < this.length, 'trying to write beyond buffer length')
|
1069 | verifuint(value, 0xff)
|
1070 | }
|
1071 |
|
1072 | if (offset >= this.length) return
|
1073 |
|
1074 | this[offset] = value
|
1075 | }
|
1076 |
|
1077 | function _writeUInt16 (buf, value, offset, littleEndian, noAssert) {
|
1078 | if (!noAssert) {
|
1079 | assert(value !== undefined && value !== null, 'missing value')
|
1080 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
1081 | assert(offset !== undefined && offset !== null, 'missing offset')
|
1082 | assert(offset + 1 < buf.length, 'trying to write beyond buffer length')
|
1083 | verifuint(value, 0xffff)
|
1084 | }
|
1085 |
|
1086 | var len = buf.length
|
1087 | if (offset >= len)
|
1088 | return
|
1089 |
|
1090 | for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) {
|
1091 | buf[offset + i] =
|
1092 | (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
1093 | (littleEndian ? i : 1 - i) * 8
|
1094 | }
|
1095 | }
|
1096 |
|
1097 | Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) {
|
1098 | _writeUInt16(this, value, offset, true, noAssert)
|
1099 | }
|
1100 |
|
1101 | Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) {
|
1102 | _writeUInt16(this, value, offset, false, noAssert)
|
1103 | }
|
1104 |
|
1105 | function _writeUInt32 (buf, value, offset, littleEndian, noAssert) {
|
1106 | if (!noAssert) {
|
1107 | assert(value !== undefined && value !== null, 'missing value')
|
1108 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
1109 | assert(offset !== undefined && offset !== null, 'missing offset')
|
1110 | assert(offset + 3 < buf.length, 'trying to write beyond buffer length')
|
1111 | verifuint(value, 0xffffffff)
|
1112 | }
|
1113 |
|
1114 | var len = buf.length
|
1115 | if (offset >= len)
|
1116 | return
|
1117 |
|
1118 | for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) {
|
1119 | buf[offset + i] =
|
1120 | (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
|
1121 | }
|
1122 | }
|
1123 |
|
1124 | Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) {
|
1125 | _writeUInt32(this, value, offset, true, noAssert)
|
1126 | }
|
1127 |
|
1128 | Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) {
|
1129 | _writeUInt32(this, value, offset, false, noAssert)
|
1130 | }
|
1131 |
|
1132 | Buffer.prototype.writeInt8 = function (value, offset, noAssert) {
|
1133 | if (!noAssert) {
|
1134 | assert(value !== undefined && value !== null, 'missing value')
|
1135 | assert(offset !== undefined && offset !== null, 'missing offset')
|
1136 | assert(offset < this.length, 'Trying to write beyond buffer length')
|
1137 | verifsint(value, 0x7f, -0x80)
|
1138 | }
|
1139 |
|
1140 | if (offset >= this.length)
|
1141 | return
|
1142 |
|
1143 | if (value >= 0)
|
1144 | this.writeUInt8(value, offset, noAssert)
|
1145 | else
|
1146 | this.writeUInt8(0xff + value + 1, offset, noAssert)
|
1147 | }
|
1148 |
|
1149 | function _writeInt16 (buf, value, offset, littleEndian, noAssert) {
|
1150 | if (!noAssert) {
|
1151 | assert(value !== undefined && value !== null, 'missing value')
|
1152 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
1153 | assert(offset !== undefined && offset !== null, 'missing offset')
|
1154 | assert(offset + 1 < buf.length, 'Trying to write beyond buffer length')
|
1155 | verifsint(value, 0x7fff, -0x8000)
|
1156 | }
|
1157 |
|
1158 | var len = buf.length
|
1159 | if (offset >= len)
|
1160 | return
|
1161 |
|
1162 | if (value >= 0)
|
1163 | _writeUInt16(buf, value, offset, littleEndian, noAssert)
|
1164 | else
|
1165 | _writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert)
|
1166 | }
|
1167 |
|
1168 | Buffer.prototype.writeInt16LE = function (value, offset, noAssert) {
|
1169 | _writeInt16(this, value, offset, true, noAssert)
|
1170 | }
|
1171 |
|
1172 | Buffer.prototype.writeInt16BE = function (value, offset, noAssert) {
|
1173 | _writeInt16(this, value, offset, false, noAssert)
|
1174 | }
|
1175 |
|
1176 | function _writeInt32 (buf, value, offset, littleEndian, noAssert) {
|
1177 | if (!noAssert) {
|
1178 | assert(value !== undefined && value !== null, 'missing value')
|
1179 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
1180 | assert(offset !== undefined && offset !== null, 'missing offset')
|
1181 | assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')
|
1182 | verifsint(value, 0x7fffffff, -0x80000000)
|
1183 | }
|
1184 |
|
1185 | var len = buf.length
|
1186 | if (offset >= len)
|
1187 | return
|
1188 |
|
1189 | if (value >= 0)
|
1190 | _writeUInt32(buf, value, offset, littleEndian, noAssert)
|
1191 | else
|
1192 | _writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert)
|
1193 | }
|
1194 |
|
1195 | Buffer.prototype.writeInt32LE = function (value, offset, noAssert) {
|
1196 | _writeInt32(this, value, offset, true, noAssert)
|
1197 | }
|
1198 |
|
1199 | Buffer.prototype.writeInt32BE = function (value, offset, noAssert) {
|
1200 | _writeInt32(this, value, offset, false, noAssert)
|
1201 | }
|
1202 |
|
1203 | function _writeFloat (buf, value, offset, littleEndian, noAssert) {
|
1204 | if (!noAssert) {
|
1205 | assert(value !== undefined && value !== null, 'missing value')
|
1206 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
1207 | assert(offset !== undefined && offset !== null, 'missing offset')
|
1208 | assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')
|
1209 | verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
1210 | }
|
1211 |
|
1212 | var len = buf.length
|
1213 | if (offset >= len)
|
1214 | return
|
1215 |
|
1216 | ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
1217 | }
|
1218 |
|
1219 | Buffer.prototype.writeFloatLE = function (value, offset, noAssert) {
|
1220 | _writeFloat(this, value, offset, true, noAssert)
|
1221 | }
|
1222 |
|
1223 | Buffer.prototype.writeFloatBE = function (value, offset, noAssert) {
|
1224 | _writeFloat(this, value, offset, false, noAssert)
|
1225 | }
|
1226 |
|
1227 | function _writeDouble (buf, value, offset, littleEndian, noAssert) {
|
1228 | if (!noAssert) {
|
1229 | assert(value !== undefined && value !== null, 'missing value')
|
1230 | assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
|
1231 | assert(offset !== undefined && offset !== null, 'missing offset')
|
1232 | assert(offset + 7 < buf.length,
|
1233 | 'Trying to write beyond buffer length')
|
1234 | verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
1235 | }
|
1236 |
|
1237 | var len = buf.length
|
1238 | if (offset >= len)
|
1239 | return
|
1240 |
|
1241 | ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
1242 | }
|
1243 |
|
1244 | Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) {
|
1245 | _writeDouble(this, value, offset, true, noAssert)
|
1246 | }
|
1247 |
|
1248 | Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) {
|
1249 | _writeDouble(this, value, offset, false, noAssert)
|
1250 | }
|
1251 |
|
1252 |
|
1253 | Buffer.prototype.fill = function (value, start, end) {
|
1254 | if (!value) value = 0
|
1255 | if (!start) start = 0
|
1256 | if (!end) end = this.length
|
1257 |
|
1258 | if (typeof value === 'string') {
|
1259 | value = value.charCodeAt(0)
|
1260 | }
|
1261 |
|
1262 | assert(typeof value === 'number' && !isNaN(value), 'value is not a number')
|
1263 | assert(end >= start, 'end < start')
|
1264 |
|
1265 |
|
1266 | if (end === start) return
|
1267 | if (this.length === 0) return
|
1268 |
|
1269 | assert(start >= 0 && start < this.length, 'start out of bounds')
|
1270 | assert(end >= 0 && end <= this.length, 'end out of bounds')
|
1271 |
|
1272 | for (var i = start; i < end; i++) {
|
1273 | this[i] = value
|
1274 | }
|
1275 | }
|
1276 |
|
1277 | Buffer.prototype.inspect = function () {
|
1278 | var out = []
|
1279 | var len = this.length
|
1280 | for (var i = 0; i < len; i++) {
|
1281 | out[i] = toHex(this[i])
|
1282 | if (i === exports.INSPECT_MAX_BYTES) {
|
1283 | out[i + 1] = '...'
|
1284 | break
|
1285 | }
|
1286 | }
|
1287 | return '<Buffer ' + out.join(' ') + '>'
|
1288 | }
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 | Buffer.prototype.toArrayBuffer = function () {
|
1295 | if (typeof Uint8Array === 'function') {
|
1296 | if (Buffer._useTypedArrays) {
|
1297 | return (new Buffer(this)).buffer
|
1298 | } else {
|
1299 | var buf = new Uint8Array(this.length)
|
1300 | for (var i = 0, len = buf.length; i < len; i += 1)
|
1301 | buf[i] = this[i]
|
1302 | return buf.buffer
|
1303 | }
|
1304 | } else {
|
1305 | throw new Error('Buffer.toArrayBuffer not supported in this browser')
|
1306 | }
|
1307 | }
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 | function stringtrim (str) {
|
1313 | if (str.trim) return str.trim()
|
1314 | return str.replace(/^\s+|\s+$/g, '')
|
1315 | }
|
1316 |
|
1317 | var BP = Buffer.prototype
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 | function augment (arr) {
|
1323 | arr._isBuffer = true
|
1324 |
|
1325 |
|
1326 | arr._get = arr.get
|
1327 | arr._set = arr.set
|
1328 |
|
1329 |
|
1330 | arr.get = BP.get
|
1331 | arr.set = BP.set
|
1332 |
|
1333 | arr.write = BP.write
|
1334 | arr.toString = BP.toString
|
1335 | arr.toLocaleString = BP.toString
|
1336 | arr.toJSON = BP.toJSON
|
1337 | arr.copy = BP.copy
|
1338 | arr.slice = BP.slice
|
1339 | arr.readUInt8 = BP.readUInt8
|
1340 | arr.readUInt16LE = BP.readUInt16LE
|
1341 | arr.readUInt16BE = BP.readUInt16BE
|
1342 | arr.readUInt32LE = BP.readUInt32LE
|
1343 | arr.readUInt32BE = BP.readUInt32BE
|
1344 | arr.readInt8 = BP.readInt8
|
1345 | arr.readInt16LE = BP.readInt16LE
|
1346 | arr.readInt16BE = BP.readInt16BE
|
1347 | arr.readInt32LE = BP.readInt32LE
|
1348 | arr.readInt32BE = BP.readInt32BE
|
1349 | arr.readFloatLE = BP.readFloatLE
|
1350 | arr.readFloatBE = BP.readFloatBE
|
1351 | arr.readDoubleLE = BP.readDoubleLE
|
1352 | arr.readDoubleBE = BP.readDoubleBE
|
1353 | arr.writeUInt8 = BP.writeUInt8
|
1354 | arr.writeUInt16LE = BP.writeUInt16LE
|
1355 | arr.writeUInt16BE = BP.writeUInt16BE
|
1356 | arr.writeUInt32LE = BP.writeUInt32LE
|
1357 | arr.writeUInt32BE = BP.writeUInt32BE
|
1358 | arr.writeInt8 = BP.writeInt8
|
1359 | arr.writeInt16LE = BP.writeInt16LE
|
1360 | arr.writeInt16BE = BP.writeInt16BE
|
1361 | arr.writeInt32LE = BP.writeInt32LE
|
1362 | arr.writeInt32BE = BP.writeInt32BE
|
1363 | arr.writeFloatLE = BP.writeFloatLE
|
1364 | arr.writeFloatBE = BP.writeFloatBE
|
1365 | arr.writeDoubleLE = BP.writeDoubleLE
|
1366 | arr.writeDoubleBE = BP.writeDoubleBE
|
1367 | arr.fill = BP.fill
|
1368 | arr.inspect = BP.inspect
|
1369 | arr.toArrayBuffer = BP.toArrayBuffer
|
1370 |
|
1371 | return arr
|
1372 | }
|
1373 |
|
1374 |
|
1375 | function clamp (index, len, defaultValue) {
|
1376 | if (typeof index !== 'number') return defaultValue
|
1377 | index = ~~index;
|
1378 | if (index >= len) return len
|
1379 | if (index >= 0) return index
|
1380 | index += len
|
1381 | if (index >= 0) return index
|
1382 | return 0
|
1383 | }
|
1384 |
|
1385 | function coerce (length) {
|
1386 |
|
1387 |
|
1388 |
|
1389 | length = ~~Math.ceil(+length)
|
1390 | return length < 0 ? 0 : length
|
1391 | }
|
1392 |
|
1393 | function isArray (subject) {
|
1394 | return (Array.isArray || function (subject) {
|
1395 | return Object.prototype.toString.call(subject) === '[object Array]'
|
1396 | })(subject)
|
1397 | }
|
1398 |
|
1399 | function isArrayish (subject) {
|
1400 | return isArray(subject) || Buffer.isBuffer(subject) ||
|
1401 | subject && typeof subject === 'object' &&
|
1402 | typeof subject.length === 'number'
|
1403 | }
|
1404 |
|
1405 | function toHex (n) {
|
1406 | if (n < 16) return '0' + n.toString(16)
|
1407 | return n.toString(16)
|
1408 | }
|
1409 |
|
1410 | function utf8ToBytes (str) {
|
1411 | var byteArray = []
|
1412 | for (var i = 0; i < str.length; i++) {
|
1413 | var b = str.charCodeAt(i)
|
1414 | if (b <= 0x7F)
|
1415 | byteArray.push(str.charCodeAt(i))
|
1416 | else {
|
1417 | var start = i
|
1418 | if (b >= 0xD800 && b <= 0xDFFF) i++
|
1419 | var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%')
|
1420 | for (var j = 0; j < h.length; j++)
|
1421 | byteArray.push(parseInt(h[j], 16))
|
1422 | }
|
1423 | }
|
1424 | return byteArray
|
1425 | }
|
1426 |
|
1427 | function asciiToBytes (str) {
|
1428 | var byteArray = []
|
1429 | for (var i = 0; i < str.length; i++) {
|
1430 |
|
1431 | byteArray.push(str.charCodeAt(i) & 0xFF)
|
1432 | }
|
1433 | return byteArray
|
1434 | }
|
1435 |
|
1436 | function utf16leToBytes (str) {
|
1437 | var c, hi, lo
|
1438 | var byteArray = []
|
1439 | for (var i = 0; i < str.length; i++) {
|
1440 | c = str.charCodeAt(i)
|
1441 | hi = c >> 8
|
1442 | lo = c % 256
|
1443 | byteArray.push(lo)
|
1444 | byteArray.push(hi)
|
1445 | }
|
1446 |
|
1447 | return byteArray
|
1448 | }
|
1449 |
|
1450 | function base64ToBytes (str) {
|
1451 | return base64.toByteArray(str)
|
1452 | }
|
1453 |
|
1454 | function blitBuffer (src, dst, offset, length) {
|
1455 | var pos
|
1456 | for (var i = 0; i < length; i++) {
|
1457 | if ((i + offset >= dst.length) || (i >= src.length))
|
1458 | break
|
1459 | dst[i + offset] = src[i]
|
1460 | }
|
1461 | return i
|
1462 | }
|
1463 |
|
1464 | function decodeUtf8Char (str) {
|
1465 | try {
|
1466 | return decodeURIComponent(str)
|
1467 | } catch (err) {
|
1468 | return String.fromCharCode(0xFFFD)
|
1469 | }
|
1470 | }
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 | function verifuint (value, max) {
|
1478 | assert(typeof value === 'number', 'cannot write a non-number as a number')
|
1479 | assert(value >= 0, 'specified a negative value for writing an unsigned value')
|
1480 | assert(value <= max, 'value is larger than maximum value for type')
|
1481 | assert(Math.floor(value) === value, 'value has a fractional component')
|
1482 | }
|
1483 |
|
1484 | function verifsint (value, max, min) {
|
1485 | assert(typeof value === 'number', 'cannot write a non-number as a number')
|
1486 | assert(value <= max, 'value larger than maximum allowed value')
|
1487 | assert(value >= min, 'value smaller than minimum allowed value')
|
1488 | assert(Math.floor(value) === value, 'value has a fractional component')
|
1489 | }
|
1490 |
|
1491 | function verifIEEE754 (value, max, min) {
|
1492 | assert(typeof value === 'number', 'cannot write a non-number as a number')
|
1493 | assert(value <= max, 'value larger than maximum allowed value')
|
1494 | assert(value >= min, 'value smaller than minimum allowed value')
|
1495 | }
|
1496 |
|
1497 | function assert (test, message) {
|
1498 | if (!test) throw new Error(message || 'Failed assertion')
|
1499 | }
|
1500 |
|
1501 | },{"base64-js":5,"ieee754":6}],5:[function(require,module,exports){
|
1502 | var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
1503 |
|
1504 | ;(function (exports) {
|
1505 | 'use strict';
|
1506 |
|
1507 | var Arr = (typeof Uint8Array !== 'undefined')
|
1508 | ? Uint8Array
|
1509 | : Array
|
1510 |
|
1511 | var ZERO = '0'.charCodeAt(0)
|
1512 | var PLUS = '+'.charCodeAt(0)
|
1513 | var SLASH = '/'.charCodeAt(0)
|
1514 | var NUMBER = '0'.charCodeAt(0)
|
1515 | var LOWER = 'a'.charCodeAt(0)
|
1516 | var UPPER = 'A'.charCodeAt(0)
|
1517 |
|
1518 | function decode (elt) {
|
1519 | var code = elt.charCodeAt(0)
|
1520 | if (code === PLUS)
|
1521 | return 62
|
1522 | if (code === SLASH)
|
1523 | return 63
|
1524 | if (code < NUMBER)
|
1525 | return -1
|
1526 | if (code < NUMBER + 10)
|
1527 | return code - NUMBER + 26 + 26
|
1528 | if (code < UPPER + 26)
|
1529 | return code - UPPER
|
1530 | if (code < LOWER + 26)
|
1531 | return code - LOWER + 26
|
1532 | }
|
1533 |
|
1534 | function b64ToByteArray (b64) {
|
1535 | var i, j, l, tmp, placeHolders, arr
|
1536 |
|
1537 | if (b64.length % 4 > 0) {
|
1538 | throw new Error('Invalid string. Length must be a multiple of 4')
|
1539 | }
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 | var len = b64.length
|
1547 | placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
|
1548 |
|
1549 |
|
1550 | arr = new Arr(b64.length * 3 / 4 - placeHolders)
|
1551 |
|
1552 |
|
1553 | l = placeHolders > 0 ? b64.length - 4 : b64.length
|
1554 |
|
1555 | var L = 0
|
1556 |
|
1557 | function push (v) {
|
1558 | arr[L++] = v
|
1559 | }
|
1560 |
|
1561 | for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
1562 | tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
|
1563 | push((tmp & 0xFF0000) >> 16)
|
1564 | push((tmp & 0xFF00) >> 8)
|
1565 | push(tmp & 0xFF)
|
1566 | }
|
1567 |
|
1568 | if (placeHolders === 2) {
|
1569 | tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
|
1570 | push(tmp & 0xFF)
|
1571 | } else if (placeHolders === 1) {
|
1572 | tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
|
1573 | push((tmp >> 8) & 0xFF)
|
1574 | push(tmp & 0xFF)
|
1575 | }
|
1576 |
|
1577 | return arr
|
1578 | }
|
1579 |
|
1580 | function uint8ToBase64 (uint8) {
|
1581 | var i,
|
1582 | extraBytes = uint8.length % 3,
|
1583 | output = "",
|
1584 | temp, length
|
1585 |
|
1586 | function encode (num) {
|
1587 | return lookup.charAt(num)
|
1588 | }
|
1589 |
|
1590 | function tripletToBase64 (num) {
|
1591 | return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
|
1592 | }
|
1593 |
|
1594 |
|
1595 | for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
|
1596 | temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
|
1597 | output += tripletToBase64(temp)
|
1598 | }
|
1599 |
|
1600 |
|
1601 | switch (extraBytes) {
|
1602 | case 1:
|
1603 | temp = uint8[uint8.length - 1]
|
1604 | output += encode(temp >> 2)
|
1605 | output += encode((temp << 4) & 0x3F)
|
1606 | output += '=='
|
1607 | break
|
1608 | case 2:
|
1609 | temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
|
1610 | output += encode(temp >> 10)
|
1611 | output += encode((temp >> 4) & 0x3F)
|
1612 | output += encode((temp << 2) & 0x3F)
|
1613 | output += '='
|
1614 | break
|
1615 | }
|
1616 |
|
1617 | return output
|
1618 | }
|
1619 |
|
1620 | module.exports.toByteArray = b64ToByteArray
|
1621 | module.exports.fromByteArray = uint8ToBase64
|
1622 | }())
|
1623 |
|
1624 | },{}],6:[function(require,module,exports){
|
1625 | exports.read = function(buffer, offset, isLE, mLen, nBytes) {
|
1626 | var e, m,
|
1627 | eLen = nBytes * 8 - mLen - 1,
|
1628 | eMax = (1 << eLen) - 1,
|
1629 | eBias = eMax >> 1,
|
1630 | nBits = -7,
|
1631 | i = isLE ? (nBytes - 1) : 0,
|
1632 | d = isLE ? -1 : 1,
|
1633 | s = buffer[offset + i];
|
1634 |
|
1635 | i += d;
|
1636 |
|
1637 | e = s & ((1 << (-nBits)) - 1);
|
1638 | s >>= (-nBits);
|
1639 | nBits += eLen;
|
1640 | for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);
|
1641 |
|
1642 | m = e & ((1 << (-nBits)) - 1);
|
1643 | e >>= (-nBits);
|
1644 | nBits += mLen;
|
1645 | for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);
|
1646 |
|
1647 | if (e === 0) {
|
1648 | e = 1 - eBias;
|
1649 | } else if (e === eMax) {
|
1650 | return m ? NaN : ((s ? -1 : 1) * Infinity);
|
1651 | } else {
|
1652 | m = m + Math.pow(2, mLen);
|
1653 | e = e - eBias;
|
1654 | }
|
1655 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
1656 | };
|
1657 |
|
1658 | exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
|
1659 | var e, m, c,
|
1660 | eLen = nBytes * 8 - mLen - 1,
|
1661 | eMax = (1 << eLen) - 1,
|
1662 | eBias = eMax >> 1,
|
1663 | rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
|
1664 | i = isLE ? 0 : (nBytes - 1),
|
1665 | d = isLE ? 1 : -1,
|
1666 | s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
|
1667 |
|
1668 | value = Math.abs(value);
|
1669 |
|
1670 | if (isNaN(value) || value === Infinity) {
|
1671 | m = isNaN(value) ? 1 : 0;
|
1672 | e = eMax;
|
1673 | } else {
|
1674 | e = Math.floor(Math.log(value) / Math.LN2);
|
1675 | if (value * (c = Math.pow(2, -e)) < 1) {
|
1676 | e--;
|
1677 | c *= 2;
|
1678 | }
|
1679 | if (e + eBias >= 1) {
|
1680 | value += rt / c;
|
1681 | } else {
|
1682 | value += rt * Math.pow(2, 1 - eBias);
|
1683 | }
|
1684 | if (value * c >= 2) {
|
1685 | e++;
|
1686 | c /= 2;
|
1687 | }
|
1688 |
|
1689 | if (e + eBias >= eMax) {
|
1690 | m = 0;
|
1691 | e = eMax;
|
1692 | } else if (e + eBias >= 1) {
|
1693 | m = (value * c - 1) * Math.pow(2, mLen);
|
1694 | e = e + eBias;
|
1695 | } else {
|
1696 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
1697 | e = 0;
|
1698 | }
|
1699 | }
|
1700 |
|
1701 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);
|
1702 |
|
1703 | e = (e << mLen) | m;
|
1704 | eLen += mLen;
|
1705 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);
|
1706 |
|
1707 | buffer[offset + i - d] |= s * 128;
|
1708 | };
|
1709 |
|
1710 | },{}],7:[function(require,module,exports){
|
1711 | var Buffer = require('buffer').Buffer;
|
1712 | var intSize = 4;
|
1713 | var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);
|
1714 | var chrsz = 8;
|
1715 |
|
1716 | function toArray(buf, bigEndian) {
|
1717 | if ((buf.length % intSize) !== 0) {
|
1718 | var len = buf.length + (intSize - (buf.length % intSize));
|
1719 | buf = Buffer.concat([buf, zeroBuffer], len);
|
1720 | }
|
1721 |
|
1722 | var arr = [];
|
1723 | var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
|
1724 | for (var i = 0; i < buf.length; i += intSize) {
|
1725 | arr.push(fn.call(buf, i));
|
1726 | }
|
1727 | return arr;
|
1728 | }
|
1729 |
|
1730 | function toBuffer(arr, size, bigEndian) {
|
1731 | var buf = new Buffer(size);
|
1732 | var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
|
1733 | for (var i = 0; i < arr.length; i++) {
|
1734 | fn.call(buf, arr[i], i * 4, true);
|
1735 | }
|
1736 | return buf;
|
1737 | }
|
1738 |
|
1739 | function hash(buf, fn, hashSize, bigEndian) {
|
1740 | if (!Buffer.isBuffer(buf)) buf = new Buffer(buf);
|
1741 | var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
|
1742 | return toBuffer(arr, hashSize, bigEndian);
|
1743 | }
|
1744 |
|
1745 | module.exports = { hash: hash };
|
1746 |
|
1747 | },{"buffer":4}],8:[function(require,module,exports){
|
1748 | var Buffer = require('buffer').Buffer
|
1749 | var sha = require('./sha')
|
1750 | var sha256 = require('./sha256')
|
1751 | var rng = require('./rng')
|
1752 | var md5 = require('./md5')
|
1753 |
|
1754 | var algorithms = {
|
1755 | sha1: sha,
|
1756 | sha256: sha256,
|
1757 | md5: md5
|
1758 | }
|
1759 |
|
1760 | var blocksize = 64
|
1761 | var zeroBuffer = new Buffer(blocksize); zeroBuffer.fill(0)
|
1762 | function hmac(fn, key, data) {
|
1763 | if(!Buffer.isBuffer(key)) key = new Buffer(key)
|
1764 | if(!Buffer.isBuffer(data)) data = new Buffer(data)
|
1765 |
|
1766 | if(key.length > blocksize) {
|
1767 | key = fn(key)
|
1768 | } else if(key.length < blocksize) {
|
1769 | key = Buffer.concat([key, zeroBuffer], blocksize)
|
1770 | }
|
1771 |
|
1772 | var ipad = new Buffer(blocksize), opad = new Buffer(blocksize)
|
1773 | for(var i = 0; i < blocksize; i++) {
|
1774 | ipad[i] = key[i] ^ 0x36
|
1775 | opad[i] = key[i] ^ 0x5C
|
1776 | }
|
1777 |
|
1778 | var hash = fn(Buffer.concat([ipad, data]))
|
1779 | return fn(Buffer.concat([opad, hash]))
|
1780 | }
|
1781 |
|
1782 | function hash(alg, key) {
|
1783 | alg = alg || 'sha1'
|
1784 | var fn = algorithms[alg]
|
1785 | var bufs = []
|
1786 | var length = 0
|
1787 | if(!fn) error('algorithm:', alg, 'is not yet supported')
|
1788 | return {
|
1789 | update: function (data) {
|
1790 | if(!Buffer.isBuffer(data)) data = new Buffer(data)
|
1791 |
|
1792 | bufs.push(data)
|
1793 | length += data.length
|
1794 | return this
|
1795 | },
|
1796 | digest: function (enc) {
|
1797 | var buf = Buffer.concat(bufs)
|
1798 | var r = key ? hmac(fn, key, buf) : fn(buf)
|
1799 | bufs = null
|
1800 | return enc ? r.toString(enc) : r
|
1801 | }
|
1802 | }
|
1803 | }
|
1804 |
|
1805 | function error () {
|
1806 | var m = [].slice.call(arguments).join(' ')
|
1807 | throw new Error([
|
1808 | m,
|
1809 | 'we accept pull requests',
|
1810 | 'http://github.com/dominictarr/crypto-browserify'
|
1811 | ].join('\n'))
|
1812 | }
|
1813 |
|
1814 | exports.createHash = function (alg) { return hash(alg) }
|
1815 | exports.createHmac = function (alg, key) { return hash(alg, key) }
|
1816 | exports.randomBytes = function(size, callback) {
|
1817 | if (callback && callback.call) {
|
1818 | try {
|
1819 | callback.call(this, undefined, new Buffer(rng(size)))
|
1820 | } catch (err) { callback(err) }
|
1821 | } else {
|
1822 | return new Buffer(rng(size))
|
1823 | }
|
1824 | }
|
1825 |
|
1826 | function each(a, f) {
|
1827 | for(var i in a)
|
1828 | f(a[i], i)
|
1829 | }
|
1830 |
|
1831 |
|
1832 | each(['createCredentials'
|
1833 | , 'createCipher'
|
1834 | , 'createCipheriv'
|
1835 | , 'createDecipher'
|
1836 | , 'createDecipheriv'
|
1837 | , 'createSign'
|
1838 | , 'createVerify'
|
1839 | , 'createDiffieHellman'
|
1840 | , 'pbkdf2'], function (name) {
|
1841 | exports[name] = function () {
|
1842 | error('sorry,', name, 'is not implemented yet')
|
1843 | }
|
1844 | })
|
1845 |
|
1846 | },{"./md5":9,"./rng":10,"./sha":11,"./sha256":12,"buffer":4}],9:[function(require,module,exports){
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 | var helpers = require('./helpers');
|
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 | function md5_vm_test()
|
1862 | {
|
1863 | return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
|
1864 | }
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 | function core_md5(x, len)
|
1870 | {
|
1871 |
|
1872 | x[len >> 5] |= 0x80 << ((len) % 32);
|
1873 | x[(((len + 64) >>> 9) << 4) + 14] = len;
|
1874 |
|
1875 | var a = 1732584193;
|
1876 | var b = -271733879;
|
1877 | var c = -1732584194;
|
1878 | var d = 271733878;
|
1879 |
|
1880 | for(var i = 0; i < x.length; i += 16)
|
1881 | {
|
1882 | var olda = a;
|
1883 | var oldb = b;
|
1884 | var oldc = c;
|
1885 | var oldd = d;
|
1886 |
|
1887 | a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
|
1888 | d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
|
1889 | c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
|
1890 | b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
|
1891 | a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
|
1892 | d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
|
1893 | c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
|
1894 | b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
|
1895 | a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
|
1896 | d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
|
1897 | c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
|
1898 | b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
|
1899 | a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
|
1900 | d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
|
1901 | c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
|
1902 | b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
|
1903 |
|
1904 | a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
|
1905 | d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
|
1906 | c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
|
1907 | b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
|
1908 | a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
|
1909 | d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
|
1910 | c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
|
1911 | b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
|
1912 | a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
|
1913 | d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
|
1914 | c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
|
1915 | b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
|
1916 | a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
|
1917 | d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
|
1918 | c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
|
1919 | b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
|
1920 |
|
1921 | a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
|
1922 | d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
|
1923 | c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
|
1924 | b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
|
1925 | a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
|
1926 | d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
|
1927 | c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
|
1928 | b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
|
1929 | a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
|
1930 | d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
|
1931 | c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
|
1932 | b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
|
1933 | a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
|
1934 | d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
|
1935 | c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
|
1936 | b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
|
1937 |
|
1938 | a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
|
1939 | d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
|
1940 | c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
|
1941 | b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
|
1942 | a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
|
1943 | d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
|
1944 | c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
|
1945 | b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
|
1946 | a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
|
1947 | d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
|
1948 | c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
|
1949 | b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
|
1950 | a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
|
1951 | d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
|
1952 | c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
|
1953 | b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
|
1954 |
|
1955 | a = safe_add(a, olda);
|
1956 | b = safe_add(b, oldb);
|
1957 | c = safe_add(c, oldc);
|
1958 | d = safe_add(d, oldd);
|
1959 | }
|
1960 | return Array(a, b, c, d);
|
1961 |
|
1962 | }
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 | function md5_cmn(q, a, b, x, s, t)
|
1968 | {
|
1969 | return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
|
1970 | }
|
1971 | function md5_ff(a, b, c, d, x, s, t)
|
1972 | {
|
1973 | return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
1974 | }
|
1975 | function md5_gg(a, b, c, d, x, s, t)
|
1976 | {
|
1977 | return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
1978 | }
|
1979 | function md5_hh(a, b, c, d, x, s, t)
|
1980 | {
|
1981 | return md5_cmn(b ^ c ^ d, a, b, x, s, t);
|
1982 | }
|
1983 | function md5_ii(a, b, c, d, x, s, t)
|
1984 | {
|
1985 | return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
|
1986 | }
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 |
|
1992 | function safe_add(x, y)
|
1993 | {
|
1994 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
1995 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
1996 | return (msw << 16) | (lsw & 0xFFFF);
|
1997 | }
|
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 | function bit_rol(num, cnt)
|
2003 | {
|
2004 | return (num << cnt) | (num >>> (32 - cnt));
|
2005 | }
|
2006 |
|
2007 | module.exports = function md5(buf) {
|
2008 | return helpers.hash(buf, core_md5, 16);
|
2009 | };
|
2010 |
|
2011 | },{"./helpers":7}],10:[function(require,module,exports){
|
2012 |
|
2013 |
|
2014 | (function() {
|
2015 | var _global = this;
|
2016 |
|
2017 | var mathRNG, whatwgRNG;
|
2018 |
|
2019 |
|
2020 | mathRNG = function(size) {
|
2021 | var bytes = new Array(size);
|
2022 | var r;
|
2023 |
|
2024 | for (var i = 0, r; i < size; i++) {
|
2025 | if ((i & 0x03) == 0) r = Math.random() * 0x100000000;
|
2026 | bytes[i] = r >>> ((i & 0x03) << 3) & 0xff;
|
2027 | }
|
2028 |
|
2029 | return bytes;
|
2030 | }
|
2031 |
|
2032 | if (_global.crypto && crypto.getRandomValues) {
|
2033 | whatwgRNG = function(size) {
|
2034 | var bytes = new Uint8Array(size);
|
2035 | crypto.getRandomValues(bytes);
|
2036 | return bytes;
|
2037 | }
|
2038 | }
|
2039 |
|
2040 | module.exports = whatwgRNG || mathRNG;
|
2041 |
|
2042 | }())
|
2043 |
|
2044 | },{}],11:[function(require,module,exports){
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 | var helpers = require('./helpers');
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 | function core_sha1(x, len)
|
2060 | {
|
2061 |
|
2062 | x[len >> 5] |= 0x80 << (24 - len % 32);
|
2063 | x[((len + 64 >> 9) << 4) + 15] = len;
|
2064 |
|
2065 | var w = Array(80);
|
2066 | var a = 1732584193;
|
2067 | var b = -271733879;
|
2068 | var c = -1732584194;
|
2069 | var d = 271733878;
|
2070 | var e = -1009589776;
|
2071 |
|
2072 | for(var i = 0; i < x.length; i += 16)
|
2073 | {
|
2074 | var olda = a;
|
2075 | var oldb = b;
|
2076 | var oldc = c;
|
2077 | var oldd = d;
|
2078 | var olde = e;
|
2079 |
|
2080 | for(var j = 0; j < 80; j++)
|
2081 | {
|
2082 | if(j < 16) w[j] = x[i + j];
|
2083 | else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
|
2084 | var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),
|
2085 | safe_add(safe_add(e, w[j]), sha1_kt(j)));
|
2086 | e = d;
|
2087 | d = c;
|
2088 | c = rol(b, 30);
|
2089 | b = a;
|
2090 | a = t;
|
2091 | }
|
2092 |
|
2093 | a = safe_add(a, olda);
|
2094 | b = safe_add(b, oldb);
|
2095 | c = safe_add(c, oldc);
|
2096 | d = safe_add(d, oldd);
|
2097 | e = safe_add(e, olde);
|
2098 | }
|
2099 | return Array(a, b, c, d, e);
|
2100 |
|
2101 | }
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 | function sha1_ft(t, b, c, d)
|
2108 | {
|
2109 | if(t < 20) return (b & c) | ((~b) & d);
|
2110 | if(t < 40) return b ^ c ^ d;
|
2111 | if(t < 60) return (b & c) | (b & d) | (c & d);
|
2112 | return b ^ c ^ d;
|
2113 | }
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 | function sha1_kt(t)
|
2119 | {
|
2120 | return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :
|
2121 | (t < 60) ? -1894007588 : -899497514;
|
2122 | }
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 | function safe_add(x, y)
|
2129 | {
|
2130 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
2131 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
2132 | return (msw << 16) | (lsw & 0xFFFF);
|
2133 | }
|
2134 |
|
2135 |
|
2136 |
|
2137 |
|
2138 | function rol(num, cnt)
|
2139 | {
|
2140 | return (num << cnt) | (num >>> (32 - cnt));
|
2141 | }
|
2142 |
|
2143 | module.exports = function sha1(buf) {
|
2144 | return helpers.hash(buf, core_sha1, 20, true);
|
2145 | };
|
2146 |
|
2147 | },{"./helpers":7}],12:[function(require,module,exports){
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 |
|
2157 | var helpers = require('./helpers');
|
2158 |
|
2159 | var safe_add = function(x, y) {
|
2160 | var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
2161 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
2162 | return (msw << 16) | (lsw & 0xFFFF);
|
2163 | };
|
2164 |
|
2165 | var S = function(X, n) {
|
2166 | return (X >>> n) | (X << (32 - n));
|
2167 | };
|
2168 |
|
2169 | var R = function(X, n) {
|
2170 | return (X >>> n);
|
2171 | };
|
2172 |
|
2173 | var Ch = function(x, y, z) {
|
2174 | return ((x & y) ^ ((~x) & z));
|
2175 | };
|
2176 |
|
2177 | var Maj = function(x, y, z) {
|
2178 | return ((x & y) ^ (x & z) ^ (y & z));
|
2179 | };
|
2180 |
|
2181 | var Sigma0256 = function(x) {
|
2182 | return (S(x, 2) ^ S(x, 13) ^ S(x, 22));
|
2183 | };
|
2184 |
|
2185 | var Sigma1256 = function(x) {
|
2186 | return (S(x, 6) ^ S(x, 11) ^ S(x, 25));
|
2187 | };
|
2188 |
|
2189 | var Gamma0256 = function(x) {
|
2190 | return (S(x, 7) ^ S(x, 18) ^ R(x, 3));
|
2191 | };
|
2192 |
|
2193 | var Gamma1256 = function(x) {
|
2194 | return (S(x, 17) ^ S(x, 19) ^ R(x, 10));
|
2195 | };
|
2196 |
|
2197 | var core_sha256 = function(m, l) {
|
2198 | var K = new Array(0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2);
|
2199 | var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19);
|
2200 | var W = new Array(64);
|
2201 | var a, b, c, d, e, f, g, h, i, j;
|
2202 | var T1, T2;
|
2203 |
|
2204 | m[l >> 5] |= 0x80 << (24 - l % 32);
|
2205 | m[((l + 64 >> 9) << 4) + 15] = l;
|
2206 | for (var i = 0; i < m.length; i += 16) {
|
2207 | a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7];
|
2208 | for (var j = 0; j < 64; j++) {
|
2209 | if (j < 16) {
|
2210 | W[j] = m[j + i];
|
2211 | } else {
|
2212 | W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]);
|
2213 | }
|
2214 | T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]);
|
2215 | T2 = safe_add(Sigma0256(a), Maj(a, b, c));
|
2216 | h = g; g = f; f = e; e = safe_add(d, T1); d = c; c = b; b = a; a = safe_add(T1, T2);
|
2217 | }
|
2218 | HASH[0] = safe_add(a, HASH[0]); HASH[1] = safe_add(b, HASH[1]); HASH[2] = safe_add(c, HASH[2]); HASH[3] = safe_add(d, HASH[3]);
|
2219 | HASH[4] = safe_add(e, HASH[4]); HASH[5] = safe_add(f, HASH[5]); HASH[6] = safe_add(g, HASH[6]); HASH[7] = safe_add(h, HASH[7]);
|
2220 | }
|
2221 | return HASH;
|
2222 | };
|
2223 |
|
2224 | module.exports = function sha256(buf) {
|
2225 | return helpers.hash(buf, core_sha256, 32, true);
|
2226 | };
|
2227 |
|
2228 | },{"./helpers":7}],13:[function(require,module,exports){
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 |
|
2241 |
|
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 |
|
2248 |
|
2249 |
|
2250 | function EventEmitter() {
|
2251 | this._events = this._events || {};
|
2252 | this._maxListeners = this._maxListeners || undefined;
|
2253 | }
|
2254 | module.exports = EventEmitter;
|
2255 |
|
2256 |
|
2257 | EventEmitter.EventEmitter = EventEmitter;
|
2258 |
|
2259 | EventEmitter.prototype._events = undefined;
|
2260 | EventEmitter.prototype._maxListeners = undefined;
|
2261 |
|
2262 |
|
2263 |
|
2264 | EventEmitter.defaultMaxListeners = 10;
|
2265 |
|
2266 |
|
2267 |
|
2268 | EventEmitter.prototype.setMaxListeners = function(n) {
|
2269 | if (!isNumber(n) || n < 0 || isNaN(n))
|
2270 | throw TypeError('n must be a positive number');
|
2271 | this._maxListeners = n;
|
2272 | return this;
|
2273 | };
|
2274 |
|
2275 | EventEmitter.prototype.emit = function(type) {
|
2276 | var er, handler, len, args, i, listeners;
|
2277 |
|
2278 | if (!this._events)
|
2279 | this._events = {};
|
2280 |
|
2281 |
|
2282 | if (type === 'error') {
|
2283 | if (!this._events.error ||
|
2284 | (isObject(this._events.error) && !this._events.error.length)) {
|
2285 | er = arguments[1];
|
2286 | if (er instanceof Error) {
|
2287 | throw er;
|
2288 | } else {
|
2289 | throw TypeError('Uncaught, unspecified "error" event.');
|
2290 | }
|
2291 | return false;
|
2292 | }
|
2293 | }
|
2294 |
|
2295 | handler = this._events[type];
|
2296 |
|
2297 | if (isUndefined(handler))
|
2298 | return false;
|
2299 |
|
2300 | if (isFunction(handler)) {
|
2301 | switch (arguments.length) {
|
2302 |
|
2303 | case 1:
|
2304 | handler.call(this);
|
2305 | break;
|
2306 | case 2:
|
2307 | handler.call(this, arguments[1]);
|
2308 | break;
|
2309 | case 3:
|
2310 | handler.call(this, arguments[1], arguments[2]);
|
2311 | break;
|
2312 |
|
2313 | default:
|
2314 | len = arguments.length;
|
2315 | args = new Array(len - 1);
|
2316 | for (i = 1; i < len; i++)
|
2317 | args[i - 1] = arguments[i];
|
2318 | handler.apply(this, args);
|
2319 | }
|
2320 | } else if (isObject(handler)) {
|
2321 | len = arguments.length;
|
2322 | args = new Array(len - 1);
|
2323 | for (i = 1; i < len; i++)
|
2324 | args[i - 1] = arguments[i];
|
2325 |
|
2326 | listeners = handler.slice();
|
2327 | len = listeners.length;
|
2328 | for (i = 0; i < len; i++)
|
2329 | listeners[i].apply(this, args);
|
2330 | }
|
2331 |
|
2332 | return true;
|
2333 | };
|
2334 |
|
2335 | EventEmitter.prototype.addListener = function(type, listener) {
|
2336 | var m;
|
2337 |
|
2338 | if (!isFunction(listener))
|
2339 | throw TypeError('listener must be a function');
|
2340 |
|
2341 | if (!this._events)
|
2342 | this._events = {};
|
2343 |
|
2344 |
|
2345 |
|
2346 | if (this._events.newListener)
|
2347 | this.emit('newListener', type,
|
2348 | isFunction(listener.listener) ?
|
2349 | listener.listener : listener);
|
2350 |
|
2351 | if (!this._events[type])
|
2352 |
|
2353 | this._events[type] = listener;
|
2354 | else if (isObject(this._events[type]))
|
2355 |
|
2356 | this._events[type].push(listener);
|
2357 | else
|
2358 |
|
2359 | this._events[type] = [this._events[type], listener];
|
2360 |
|
2361 |
|
2362 | if (isObject(this._events[type]) && !this._events[type].warned) {
|
2363 | var m;
|
2364 | if (!isUndefined(this._maxListeners)) {
|
2365 | m = this._maxListeners;
|
2366 | } else {
|
2367 | m = EventEmitter.defaultMaxListeners;
|
2368 | }
|
2369 |
|
2370 | if (m && m > 0 && this._events[type].length > m) {
|
2371 | this._events[type].warned = true;
|
2372 | console.error('(node) warning: possible EventEmitter memory ' +
|
2373 | 'leak detected. %d listeners added. ' +
|
2374 | 'Use emitter.setMaxListeners() to increase limit.',
|
2375 | this._events[type].length);
|
2376 | console.trace();
|
2377 | }
|
2378 | }
|
2379 |
|
2380 | return this;
|
2381 | };
|
2382 |
|
2383 | EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
2384 |
|
2385 | EventEmitter.prototype.once = function(type, listener) {
|
2386 | if (!isFunction(listener))
|
2387 | throw TypeError('listener must be a function');
|
2388 |
|
2389 | var fired = false;
|
2390 |
|
2391 | function g() {
|
2392 | this.removeListener(type, g);
|
2393 |
|
2394 | if (!fired) {
|
2395 | fired = true;
|
2396 | listener.apply(this, arguments);
|
2397 | }
|
2398 | }
|
2399 |
|
2400 | g.listener = listener;
|
2401 | this.on(type, g);
|
2402 |
|
2403 | return this;
|
2404 | };
|
2405 |
|
2406 |
|
2407 | EventEmitter.prototype.removeListener = function(type, listener) {
|
2408 | var list, position, length, i;
|
2409 |
|
2410 | if (!isFunction(listener))
|
2411 | throw TypeError('listener must be a function');
|
2412 |
|
2413 | if (!this._events || !this._events[type])
|
2414 | return this;
|
2415 |
|
2416 | list = this._events[type];
|
2417 | length = list.length;
|
2418 | position = -1;
|
2419 |
|
2420 | if (list === listener ||
|
2421 | (isFunction(list.listener) && list.listener === listener)) {
|
2422 | delete this._events[type];
|
2423 | if (this._events.removeListener)
|
2424 | this.emit('removeListener', type, listener);
|
2425 |
|
2426 | } else if (isObject(list)) {
|
2427 | for (i = length; i-- > 0;) {
|
2428 | if (list[i] === listener ||
|
2429 | (list[i].listener && list[i].listener === listener)) {
|
2430 | position = i;
|
2431 | break;
|
2432 | }
|
2433 | }
|
2434 |
|
2435 | if (position < 0)
|
2436 | return this;
|
2437 |
|
2438 | if (list.length === 1) {
|
2439 | list.length = 0;
|
2440 | delete this._events[type];
|
2441 | } else {
|
2442 | list.splice(position, 1);
|
2443 | }
|
2444 |
|
2445 | if (this._events.removeListener)
|
2446 | this.emit('removeListener', type, listener);
|
2447 | }
|
2448 |
|
2449 | return this;
|
2450 | };
|
2451 |
|
2452 | EventEmitter.prototype.removeAllListeners = function(type) {
|
2453 | var key, listeners;
|
2454 |
|
2455 | if (!this._events)
|
2456 | return this;
|
2457 |
|
2458 |
|
2459 | if (!this._events.removeListener) {
|
2460 | if (arguments.length === 0)
|
2461 | this._events = {};
|
2462 | else if (this._events[type])
|
2463 | delete this._events[type];
|
2464 | return this;
|
2465 | }
|
2466 |
|
2467 |
|
2468 | if (arguments.length === 0) {
|
2469 | for (key in this._events) {
|
2470 | if (key === 'removeListener') continue;
|
2471 | this.removeAllListeners(key);
|
2472 | }
|
2473 | this.removeAllListeners('removeListener');
|
2474 | this._events = {};
|
2475 | return this;
|
2476 | }
|
2477 |
|
2478 | listeners = this._events[type];
|
2479 |
|
2480 | if (isFunction(listeners)) {
|
2481 | this.removeListener(type, listeners);
|
2482 | } else {
|
2483 |
|
2484 | while (listeners.length)
|
2485 | this.removeListener(type, listeners[listeners.length - 1]);
|
2486 | }
|
2487 | delete this._events[type];
|
2488 |
|
2489 | return this;
|
2490 | };
|
2491 |
|
2492 | EventEmitter.prototype.listeners = function(type) {
|
2493 | var ret;
|
2494 | if (!this._events || !this._events[type])
|
2495 | ret = [];
|
2496 | else if (isFunction(this._events[type]))
|
2497 | ret = [this._events[type]];
|
2498 | else
|
2499 | ret = this._events[type].slice();
|
2500 | return ret;
|
2501 | };
|
2502 |
|
2503 | EventEmitter.listenerCount = function(emitter, type) {
|
2504 | var ret;
|
2505 | if (!emitter._events || !emitter._events[type])
|
2506 | ret = 0;
|
2507 | else if (isFunction(emitter._events[type]))
|
2508 | ret = 1;
|
2509 | else
|
2510 | ret = emitter._events[type].length;
|
2511 | return ret;
|
2512 | };
|
2513 |
|
2514 | function isFunction(arg) {
|
2515 | return typeof arg === 'function';
|
2516 | }
|
2517 |
|
2518 | function isNumber(arg) {
|
2519 | return typeof arg === 'number';
|
2520 | }
|
2521 |
|
2522 | function isObject(arg) {
|
2523 | return typeof arg === 'object' && arg !== null;
|
2524 | }
|
2525 |
|
2526 | function isUndefined(arg) {
|
2527 | return arg === void 0;
|
2528 | }
|
2529 |
|
2530 | },{}],14:[function(require,module,exports){
|
2531 | if (typeof Object.create === 'function') {
|
2532 |
|
2533 | module.exports = function inherits(ctor, superCtor) {
|
2534 | ctor.super_ = superCtor
|
2535 | ctor.prototype = Object.create(superCtor.prototype, {
|
2536 | constructor: {
|
2537 | value: ctor,
|
2538 | enumerable: false,
|
2539 | writable: true,
|
2540 | configurable: true
|
2541 | }
|
2542 | });
|
2543 | };
|
2544 | } else {
|
2545 |
|
2546 | module.exports = function inherits(ctor, superCtor) {
|
2547 | ctor.super_ = superCtor
|
2548 | var TempCtor = function () {}
|
2549 | TempCtor.prototype = superCtor.prototype
|
2550 | ctor.prototype = new TempCtor()
|
2551 | ctor.prototype.constructor = ctor
|
2552 | }
|
2553 | }
|
2554 |
|
2555 | },{}],15:[function(require,module,exports){
|
2556 |
|
2557 |
|
2558 | var process = module.exports = {};
|
2559 |
|
2560 | process.nextTick = (function () {
|
2561 | var canSetImmediate = typeof window !== 'undefined'
|
2562 | && window.setImmediate;
|
2563 | var canPost = typeof window !== 'undefined'
|
2564 | && window.postMessage && window.addEventListener
|
2565 | ;
|
2566 |
|
2567 | if (canSetImmediate) {
|
2568 | return function (f) { return window.setImmediate(f) };
|
2569 | }
|
2570 |
|
2571 | if (canPost) {
|
2572 | var queue = [];
|
2573 | window.addEventListener('message', function (ev) {
|
2574 | var source = ev.source;
|
2575 | if ((source === window || source === null) && ev.data === 'process-tick') {
|
2576 | ev.stopPropagation();
|
2577 | if (queue.length > 0) {
|
2578 | var fn = queue.shift();
|
2579 | fn();
|
2580 | }
|
2581 | }
|
2582 | }, true);
|
2583 |
|
2584 | return function nextTick(fn) {
|
2585 | queue.push(fn);
|
2586 | window.postMessage('process-tick', '*');
|
2587 | };
|
2588 | }
|
2589 |
|
2590 | return function nextTick(fn) {
|
2591 | setTimeout(fn, 0);
|
2592 | };
|
2593 | })();
|
2594 |
|
2595 | process.title = 'browser';
|
2596 | process.browser = true;
|
2597 | process.env = {};
|
2598 | process.argv = [];
|
2599 |
|
2600 | process.binding = function (name) {
|
2601 | throw new Error('process.binding is not supported');
|
2602 | }
|
2603 |
|
2604 |
|
2605 | process.cwd = function () { return '/' };
|
2606 | process.chdir = function (dir) {
|
2607 | throw new Error('process.chdir is not supported');
|
2608 | };
|
2609 |
|
2610 | },{}],16:[function(require,module,exports){
|
2611 | (function (process){
|
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 |
|
2629 |
|
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 | function normalizeArray(parts, allowAboveRoot) {
|
2638 |
|
2639 | var up = 0;
|
2640 | for (var i = parts.length - 1; i >= 0; i--) {
|
2641 | var last = parts[i];
|
2642 | if (last === '.') {
|
2643 | parts.splice(i, 1);
|
2644 | } else if (last === '..') {
|
2645 | parts.splice(i, 1);
|
2646 | up++;
|
2647 | } else if (up) {
|
2648 | parts.splice(i, 1);
|
2649 | up--;
|
2650 | }
|
2651 | }
|
2652 |
|
2653 |
|
2654 | if (allowAboveRoot) {
|
2655 | for (; up--; up) {
|
2656 | parts.unshift('..');
|
2657 | }
|
2658 | }
|
2659 |
|
2660 | return parts;
|
2661 | }
|
2662 |
|
2663 |
|
2664 |
|
2665 | var splitPathRe =
|
2666 | /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
2667 | var splitPath = function(filename) {
|
2668 | return splitPathRe.exec(filename).slice(1);
|
2669 | };
|
2670 |
|
2671 |
|
2672 |
|
2673 | exports.resolve = function() {
|
2674 | var resolvedPath = '',
|
2675 | resolvedAbsolute = false;
|
2676 |
|
2677 | for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
2678 | var path = (i >= 0) ? arguments[i] : process.cwd();
|
2679 |
|
2680 |
|
2681 | if (typeof path !== 'string') {
|
2682 | throw new TypeError('Arguments to path.resolve must be strings');
|
2683 | } else if (!path) {
|
2684 | continue;
|
2685 | }
|
2686 |
|
2687 | resolvedPath = path + '/' + resolvedPath;
|
2688 | resolvedAbsolute = path.charAt(0) === '/';
|
2689 | }
|
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 |
|
2695 | resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
|
2696 | return !!p;
|
2697 | }), !resolvedAbsolute).join('/');
|
2698 |
|
2699 | return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
2700 | };
|
2701 |
|
2702 |
|
2703 |
|
2704 | exports.normalize = function(path) {
|
2705 | var isAbsolute = exports.isAbsolute(path),
|
2706 | trailingSlash = substr(path, -1) === '/';
|
2707 |
|
2708 |
|
2709 | path = normalizeArray(filter(path.split('/'), function(p) {
|
2710 | return !!p;
|
2711 | }), !isAbsolute).join('/');
|
2712 |
|
2713 | if (!path && !isAbsolute) {
|
2714 | path = '.';
|
2715 | }
|
2716 | if (path && trailingSlash) {
|
2717 | path += '/';
|
2718 | }
|
2719 |
|
2720 | return (isAbsolute ? '/' : '') + path;
|
2721 | };
|
2722 |
|
2723 |
|
2724 | exports.isAbsolute = function(path) {
|
2725 | return path.charAt(0) === '/';
|
2726 | };
|
2727 |
|
2728 |
|
2729 | exports.join = function() {
|
2730 | var paths = Array.prototype.slice.call(arguments, 0);
|
2731 | return exports.normalize(filter(paths, function(p, index) {
|
2732 | if (typeof p !== 'string') {
|
2733 | throw new TypeError('Arguments to path.join must be strings');
|
2734 | }
|
2735 | return p;
|
2736 | }).join('/'));
|
2737 | };
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 | exports.relative = function(from, to) {
|
2743 | from = exports.resolve(from).substr(1);
|
2744 | to = exports.resolve(to).substr(1);
|
2745 |
|
2746 | function trim(arr) {
|
2747 | var start = 0;
|
2748 | for (; start < arr.length; start++) {
|
2749 | if (arr[start] !== '') break;
|
2750 | }
|
2751 |
|
2752 | var end = arr.length - 1;
|
2753 | for (; end >= 0; end--) {
|
2754 | if (arr[end] !== '') break;
|
2755 | }
|
2756 |
|
2757 | if (start > end) return [];
|
2758 | return arr.slice(start, end - start + 1);
|
2759 | }
|
2760 |
|
2761 | var fromParts = trim(from.split('/'));
|
2762 | var toParts = trim(to.split('/'));
|
2763 |
|
2764 | var length = Math.min(fromParts.length, toParts.length);
|
2765 | var samePartsLength = length;
|
2766 | for (var i = 0; i < length; i++) {
|
2767 | if (fromParts[i] !== toParts[i]) {
|
2768 | samePartsLength = i;
|
2769 | break;
|
2770 | }
|
2771 | }
|
2772 |
|
2773 | var outputParts = [];
|
2774 | for (var i = samePartsLength; i < fromParts.length; i++) {
|
2775 | outputParts.push('..');
|
2776 | }
|
2777 |
|
2778 | outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
2779 |
|
2780 | return outputParts.join('/');
|
2781 | };
|
2782 |
|
2783 | exports.sep = '/';
|
2784 | exports.delimiter = ':';
|
2785 |
|
2786 | exports.dirname = function(path) {
|
2787 | var result = splitPath(path),
|
2788 | root = result[0],
|
2789 | dir = result[1];
|
2790 |
|
2791 | if (!root && !dir) {
|
2792 |
|
2793 | return '.';
|
2794 | }
|
2795 |
|
2796 | if (dir) {
|
2797 |
|
2798 | dir = dir.substr(0, dir.length - 1);
|
2799 | }
|
2800 |
|
2801 | return root + dir;
|
2802 | };
|
2803 |
|
2804 |
|
2805 | exports.basename = function(path, ext) {
|
2806 | var f = splitPath(path)[2];
|
2807 |
|
2808 | if (ext && f.substr(-1 * ext.length) === ext) {
|
2809 | f = f.substr(0, f.length - ext.length);
|
2810 | }
|
2811 | return f;
|
2812 | };
|
2813 |
|
2814 |
|
2815 | exports.extname = function(path) {
|
2816 | return splitPath(path)[3];
|
2817 | };
|
2818 |
|
2819 | function filter (xs, f) {
|
2820 | if (xs.filter) return xs.filter(f);
|
2821 | var res = [];
|
2822 | for (var i = 0; i < xs.length; i++) {
|
2823 | if (f(xs[i], i, xs)) res.push(xs[i]);
|
2824 | }
|
2825 | return res;
|
2826 | }
|
2827 |
|
2828 |
|
2829 | var substr = 'ab'.substr(-1) === 'b'
|
2830 | ? function (str, start, len) { return str.substr(start, len) }
|
2831 | : function (str, start, len) {
|
2832 | if (start < 0) start = str.length + start;
|
2833 | return str.substr(start, len);
|
2834 | }
|
2835 | ;
|
2836 |
|
2837 | }).call(this,require("/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))
|
2838 | },{"/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":15}],17:[function(require,module,exports){
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 |
|
2845 |
|
2846 |
|
2847 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 |
|
2861 |
|
2862 |
|
2863 |
|
2864 |
|
2865 | module.exports = Duplex;
|
2866 | var inherits = require('inherits');
|
2867 | var setImmediate = require('process/browser.js').nextTick;
|
2868 | var Readable = require('./readable.js');
|
2869 | var Writable = require('./writable.js');
|
2870 |
|
2871 | inherits(Duplex, Readable);
|
2872 |
|
2873 | Duplex.prototype.write = Writable.prototype.write;
|
2874 | Duplex.prototype.end = Writable.prototype.end;
|
2875 | Duplex.prototype._write = Writable.prototype._write;
|
2876 |
|
2877 | function Duplex(options) {
|
2878 | if (!(this instanceof Duplex))
|
2879 | return new Duplex(options);
|
2880 |
|
2881 | Readable.call(this, options);
|
2882 | Writable.call(this, options);
|
2883 |
|
2884 | if (options && options.readable === false)
|
2885 | this.readable = false;
|
2886 |
|
2887 | if (options && options.writable === false)
|
2888 | this.writable = false;
|
2889 |
|
2890 | this.allowHalfOpen = true;
|
2891 | if (options && options.allowHalfOpen === false)
|
2892 | this.allowHalfOpen = false;
|
2893 |
|
2894 | this.once('end', onend);
|
2895 | }
|
2896 |
|
2897 |
|
2898 | function onend() {
|
2899 |
|
2900 |
|
2901 | if (this.allowHalfOpen || this._writableState.ended)
|
2902 | return;
|
2903 |
|
2904 |
|
2905 |
|
2906 | var self = this;
|
2907 | setImmediate(function () {
|
2908 | self.end();
|
2909 | });
|
2910 | }
|
2911 |
|
2912 | },{"./readable.js":21,"./writable.js":23,"inherits":14,"process/browser.js":19}],18:[function(require,module,exports){
|
2913 |
|
2914 |
|
2915 |
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 |
|
2928 |
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 | module.exports = Stream;
|
2935 |
|
2936 | var EE = require('events').EventEmitter;
|
2937 | var inherits = require('inherits');
|
2938 |
|
2939 | inherits(Stream, EE);
|
2940 | Stream.Readable = require('./readable.js');
|
2941 | Stream.Writable = require('./writable.js');
|
2942 | Stream.Duplex = require('./duplex.js');
|
2943 | Stream.Transform = require('./transform.js');
|
2944 | Stream.PassThrough = require('./passthrough.js');
|
2945 |
|
2946 |
|
2947 | Stream.Stream = Stream;
|
2948 |
|
2949 |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 | function Stream() {
|
2955 | EE.call(this);
|
2956 | }
|
2957 |
|
2958 | Stream.prototype.pipe = function(dest, options) {
|
2959 | var source = this;
|
2960 |
|
2961 | function ondata(chunk) {
|
2962 | if (dest.writable) {
|
2963 | if (false === dest.write(chunk) && source.pause) {
|
2964 | source.pause();
|
2965 | }
|
2966 | }
|
2967 | }
|
2968 |
|
2969 | source.on('data', ondata);
|
2970 |
|
2971 | function ondrain() {
|
2972 | if (source.readable && source.resume) {
|
2973 | source.resume();
|
2974 | }
|
2975 | }
|
2976 |
|
2977 | dest.on('drain', ondrain);
|
2978 |
|
2979 |
|
2980 |
|
2981 | if (!dest._isStdio && (!options || options.end !== false)) {
|
2982 | source.on('end', onend);
|
2983 | source.on('close', onclose);
|
2984 | }
|
2985 |
|
2986 | var didOnEnd = false;
|
2987 | function onend() {
|
2988 | if (didOnEnd) return;
|
2989 | didOnEnd = true;
|
2990 |
|
2991 | dest.end();
|
2992 | }
|
2993 |
|
2994 |
|
2995 | function onclose() {
|
2996 | if (didOnEnd) return;
|
2997 | didOnEnd = true;
|
2998 |
|
2999 | if (typeof dest.destroy === 'function') dest.destroy();
|
3000 | }
|
3001 |
|
3002 |
|
3003 | function onerror(er) {
|
3004 | cleanup();
|
3005 | if (EE.listenerCount(this, 'error') === 0) {
|
3006 | throw er;
|
3007 | }
|
3008 | }
|
3009 |
|
3010 | source.on('error', onerror);
|
3011 | dest.on('error', onerror);
|
3012 |
|
3013 |
|
3014 | function cleanup() {
|
3015 | source.removeListener('data', ondata);
|
3016 | dest.removeListener('drain', ondrain);
|
3017 |
|
3018 | source.removeListener('end', onend);
|
3019 | source.removeListener('close', onclose);
|
3020 |
|
3021 | source.removeListener('error', onerror);
|
3022 | dest.removeListener('error', onerror);
|
3023 |
|
3024 | source.removeListener('end', cleanup);
|
3025 | source.removeListener('close', cleanup);
|
3026 |
|
3027 | dest.removeListener('close', cleanup);
|
3028 | }
|
3029 |
|
3030 | source.on('end', cleanup);
|
3031 | source.on('close', cleanup);
|
3032 |
|
3033 | dest.on('close', cleanup);
|
3034 |
|
3035 | dest.emit('pipe', source);
|
3036 |
|
3037 |
|
3038 | return dest;
|
3039 | };
|
3040 |
|
3041 | },{"./duplex.js":17,"./passthrough.js":20,"./readable.js":21,"./transform.js":22,"./writable.js":23,"events":13,"inherits":14}],19:[function(require,module,exports){
|
3042 | module.exports=require(15)
|
3043 | },{}],20:[function(require,module,exports){
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 |
|
3049 |
|
3050 |
|
3051 |
|
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 |
|
3064 |
|
3065 |
|
3066 |
|
3067 |
|
3068 |
|
3069 | module.exports = PassThrough;
|
3070 |
|
3071 | var Transform = require('./transform.js');
|
3072 | var inherits = require('inherits');
|
3073 | inherits(PassThrough, Transform);
|
3074 |
|
3075 | function PassThrough(options) {
|
3076 | if (!(this instanceof PassThrough))
|
3077 | return new PassThrough(options);
|
3078 |
|
3079 | Transform.call(this, options);
|
3080 | }
|
3081 |
|
3082 | PassThrough.prototype._transform = function(chunk, encoding, cb) {
|
3083 | cb(null, chunk);
|
3084 | };
|
3085 |
|
3086 | },{"./transform.js":22,"inherits":14}],21:[function(require,module,exports){
|
3087 | (function (process){
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 |
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 | module.exports = Readable;
|
3110 | Readable.ReadableState = ReadableState;
|
3111 |
|
3112 | var EE = require('events').EventEmitter;
|
3113 | var Stream = require('./index.js');
|
3114 | var Buffer = require('buffer').Buffer;
|
3115 | var setImmediate = require('process/browser.js').nextTick;
|
3116 | var StringDecoder;
|
3117 |
|
3118 | var inherits = require('inherits');
|
3119 | inherits(Readable, Stream);
|
3120 |
|
3121 | function ReadableState(options, stream) {
|
3122 | options = options || {};
|
3123 |
|
3124 |
|
3125 |
|
3126 | var hwm = options.highWaterMark;
|
3127 | this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;
|
3128 |
|
3129 |
|
3130 | this.highWaterMark = ~~this.highWaterMark;
|
3131 |
|
3132 | this.buffer = [];
|
3133 | this.length = 0;
|
3134 | this.pipes = null;
|
3135 | this.pipesCount = 0;
|
3136 | this.flowing = false;
|
3137 | this.ended = false;
|
3138 | this.endEmitted = false;
|
3139 | this.reading = false;
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 | this.calledRead = false;
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 | this.sync = true;
|
3152 |
|
3153 |
|
3154 |
|
3155 | this.needReadable = false;
|
3156 | this.emittedReadable = false;
|
3157 | this.readableListening = false;
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 | this.objectMode = !!options.objectMode;
|
3163 |
|
3164 |
|
3165 |
|
3166 |
|
3167 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
3168 |
|
3169 |
|
3170 |
|
3171 | this.ranOut = false;
|
3172 |
|
3173 |
|
3174 | this.awaitDrain = 0;
|
3175 |
|
3176 |
|
3177 | this.readingMore = false;
|
3178 |
|
3179 | this.decoder = null;
|
3180 | this.encoding = null;
|
3181 | if (options.encoding) {
|
3182 | if (!StringDecoder)
|
3183 | StringDecoder = require('string_decoder').StringDecoder;
|
3184 | this.decoder = new StringDecoder(options.encoding);
|
3185 | this.encoding = options.encoding;
|
3186 | }
|
3187 | }
|
3188 |
|
3189 | function Readable(options) {
|
3190 | if (!(this instanceof Readable))
|
3191 | return new Readable(options);
|
3192 |
|
3193 | this._readableState = new ReadableState(options, this);
|
3194 |
|
3195 |
|
3196 | this.readable = true;
|
3197 |
|
3198 | Stream.call(this);
|
3199 | }
|
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 |
|
3205 | Readable.prototype.push = function(chunk, encoding) {
|
3206 | var state = this._readableState;
|
3207 |
|
3208 | if (typeof chunk === 'string' && !state.objectMode) {
|
3209 | encoding = encoding || state.defaultEncoding;
|
3210 | if (encoding !== state.encoding) {
|
3211 | chunk = new Buffer(chunk, encoding);
|
3212 | encoding = '';
|
3213 | }
|
3214 | }
|
3215 |
|
3216 | return readableAddChunk(this, state, chunk, encoding, false);
|
3217 | };
|
3218 |
|
3219 |
|
3220 | Readable.prototype.unshift = function(chunk) {
|
3221 | var state = this._readableState;
|
3222 | return readableAddChunk(this, state, chunk, '', true);
|
3223 | };
|
3224 |
|
3225 | function readableAddChunk(stream, state, chunk, encoding, addToFront) {
|
3226 | var er = chunkInvalid(state, chunk);
|
3227 | if (er) {
|
3228 | stream.emit('error', er);
|
3229 | } else if (chunk === null || chunk === undefined) {
|
3230 | state.reading = false;
|
3231 | if (!state.ended)
|
3232 | onEofChunk(stream, state);
|
3233 | } else if (state.objectMode || chunk && chunk.length > 0) {
|
3234 | if (state.ended && !addToFront) {
|
3235 | var e = new Error('stream.push() after EOF');
|
3236 | stream.emit('error', e);
|
3237 | } else if (state.endEmitted && addToFront) {
|
3238 | var e = new Error('stream.unshift() after end event');
|
3239 | stream.emit('error', e);
|
3240 | } else {
|
3241 | if (state.decoder && !addToFront && !encoding)
|
3242 | chunk = state.decoder.write(chunk);
|
3243 |
|
3244 |
|
3245 | state.length += state.objectMode ? 1 : chunk.length;
|
3246 | if (addToFront) {
|
3247 | state.buffer.unshift(chunk);
|
3248 | } else {
|
3249 | state.reading = false;
|
3250 | state.buffer.push(chunk);
|
3251 | }
|
3252 |
|
3253 | if (state.needReadable)
|
3254 | emitReadable(stream);
|
3255 |
|
3256 | maybeReadMore(stream, state);
|
3257 | }
|
3258 | } else if (!addToFront) {
|
3259 | state.reading = false;
|
3260 | }
|
3261 |
|
3262 | return needMoreData(state);
|
3263 | }
|
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 |
|
3270 |
|
3271 |
|
3272 |
|
3273 |
|
3274 | function needMoreData(state) {
|
3275 | return !state.ended &&
|
3276 | (state.needReadable ||
|
3277 | state.length < state.highWaterMark ||
|
3278 | state.length === 0);
|
3279 | }
|
3280 |
|
3281 |
|
3282 | Readable.prototype.setEncoding = function(enc) {
|
3283 | if (!StringDecoder)
|
3284 | StringDecoder = require('string_decoder').StringDecoder;
|
3285 | this._readableState.decoder = new StringDecoder(enc);
|
3286 | this._readableState.encoding = enc;
|
3287 | };
|
3288 |
|
3289 |
|
3290 | var MAX_HWM = 0x800000;
|
3291 | function roundUpToNextPowerOf2(n) {
|
3292 | if (n >= MAX_HWM) {
|
3293 | n = MAX_HWM;
|
3294 | } else {
|
3295 |
|
3296 | n--;
|
3297 | for (var p = 1; p < 32; p <<= 1) n |= n >> p;
|
3298 | n++;
|
3299 | }
|
3300 | return n;
|
3301 | }
|
3302 |
|
3303 | function howMuchToRead(n, state) {
|
3304 | if (state.length === 0 && state.ended)
|
3305 | return 0;
|
3306 |
|
3307 | if (state.objectMode)
|
3308 | return n === 0 ? 0 : 1;
|
3309 |
|
3310 | if (isNaN(n) || n === null) {
|
3311 |
|
3312 | if (state.flowing && state.buffer.length)
|
3313 | return state.buffer[0].length;
|
3314 | else
|
3315 | return state.length;
|
3316 | }
|
3317 |
|
3318 | if (n <= 0)
|
3319 | return 0;
|
3320 |
|
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 | if (n > state.highWaterMark)
|
3326 | state.highWaterMark = roundUpToNextPowerOf2(n);
|
3327 |
|
3328 |
|
3329 | if (n > state.length) {
|
3330 | if (!state.ended) {
|
3331 | state.needReadable = true;
|
3332 | return 0;
|
3333 | } else
|
3334 | return state.length;
|
3335 | }
|
3336 |
|
3337 | return n;
|
3338 | }
|
3339 |
|
3340 |
|
3341 | Readable.prototype.read = function(n) {
|
3342 | var state = this._readableState;
|
3343 | state.calledRead = true;
|
3344 | var nOrig = n;
|
3345 |
|
3346 | if (typeof n !== 'number' || n > 0)
|
3347 | state.emittedReadable = false;
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 | if (n === 0 &&
|
3353 | state.needReadable &&
|
3354 | (state.length >= state.highWaterMark || state.ended)) {
|
3355 | emitReadable(this);
|
3356 | return null;
|
3357 | }
|
3358 |
|
3359 | n = howMuchToRead(n, state);
|
3360 |
|
3361 |
|
3362 | if (n === 0 && state.ended) {
|
3363 | if (state.length === 0)
|
3364 | endReadable(this);
|
3365 | return null;
|
3366 | }
|
3367 |
|
3368 |
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 |
|
3378 |
|
3379 |
|
3380 |
|
3381 |
|
3382 |
|
3383 |
|
3384 |
|
3385 |
|
3386 |
|
3387 |
|
3388 |
|
3389 |
|
3390 |
|
3391 | var doRead = state.needReadable;
|
3392 |
|
3393 |
|
3394 | if (state.length - n <= state.highWaterMark)
|
3395 | doRead = true;
|
3396 |
|
3397 |
|
3398 |
|
3399 | if (state.ended || state.reading)
|
3400 | doRead = false;
|
3401 |
|
3402 | if (doRead) {
|
3403 | state.reading = true;
|
3404 | state.sync = true;
|
3405 |
|
3406 | if (state.length === 0)
|
3407 | state.needReadable = true;
|
3408 |
|
3409 | this._read(state.highWaterMark);
|
3410 | state.sync = false;
|
3411 | }
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 | if (doRead && !state.reading)
|
3417 | n = howMuchToRead(nOrig, state);
|
3418 |
|
3419 | var ret;
|
3420 | if (n > 0)
|
3421 | ret = fromList(n, state);
|
3422 | else
|
3423 | ret = null;
|
3424 |
|
3425 | if (ret === null) {
|
3426 | state.needReadable = true;
|
3427 | n = 0;
|
3428 | }
|
3429 |
|
3430 | state.length -= n;
|
3431 |
|
3432 |
|
3433 |
|
3434 | if (state.length === 0 && !state.ended)
|
3435 | state.needReadable = true;
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 | if (state.ended && !state.endEmitted && state.length === 0)
|
3441 | endReadable(this);
|
3442 |
|
3443 | return ret;
|
3444 | };
|
3445 |
|
3446 | function chunkInvalid(state, chunk) {
|
3447 | var er = null;
|
3448 | if (!Buffer.isBuffer(chunk) &&
|
3449 | 'string' !== typeof chunk &&
|
3450 | chunk !== null &&
|
3451 | chunk !== undefined &&
|
3452 | !state.objectMode &&
|
3453 | !er) {
|
3454 | er = new TypeError('Invalid non-string/buffer chunk');
|
3455 | }
|
3456 | return er;
|
3457 | }
|
3458 |
|
3459 |
|
3460 | function onEofChunk(stream, state) {
|
3461 | if (state.decoder && !state.ended) {
|
3462 | var chunk = state.decoder.end();
|
3463 | if (chunk && chunk.length) {
|
3464 | state.buffer.push(chunk);
|
3465 | state.length += state.objectMode ? 1 : chunk.length;
|
3466 | }
|
3467 | }
|
3468 | state.ended = true;
|
3469 |
|
3470 |
|
3471 |
|
3472 | if (state.length > 0)
|
3473 | emitReadable(stream);
|
3474 | else
|
3475 | endReadable(stream);
|
3476 | }
|
3477 |
|
3478 |
|
3479 |
|
3480 |
|
3481 | function emitReadable(stream) {
|
3482 | var state = stream._readableState;
|
3483 | state.needReadable = false;
|
3484 | if (state.emittedReadable)
|
3485 | return;
|
3486 |
|
3487 | state.emittedReadable = true;
|
3488 | if (state.sync)
|
3489 | setImmediate(function() {
|
3490 | emitReadable_(stream);
|
3491 | });
|
3492 | else
|
3493 | emitReadable_(stream);
|
3494 | }
|
3495 |
|
3496 | function emitReadable_(stream) {
|
3497 | stream.emit('readable');
|
3498 | }
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 | function maybeReadMore(stream, state) {
|
3508 | if (!state.readingMore) {
|
3509 | state.readingMore = true;
|
3510 | setImmediate(function() {
|
3511 | maybeReadMore_(stream, state);
|
3512 | });
|
3513 | }
|
3514 | }
|
3515 |
|
3516 | function maybeReadMore_(stream, state) {
|
3517 | var len = state.length;
|
3518 | while (!state.reading && !state.flowing && !state.ended &&
|
3519 | state.length < state.highWaterMark) {
|
3520 | stream.read(0);
|
3521 | if (len === state.length)
|
3522 |
|
3523 | break;
|
3524 | else
|
3525 | len = state.length;
|
3526 | }
|
3527 | state.readingMore = false;
|
3528 | }
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 | Readable.prototype._read = function(n) {
|
3535 | this.emit('error', new Error('not implemented'));
|
3536 | };
|
3537 |
|
3538 | Readable.prototype.pipe = function(dest, pipeOpts) {
|
3539 | var src = this;
|
3540 | var state = this._readableState;
|
3541 |
|
3542 | switch (state.pipesCount) {
|
3543 | case 0:
|
3544 | state.pipes = dest;
|
3545 | break;
|
3546 | case 1:
|
3547 | state.pipes = [state.pipes, dest];
|
3548 | break;
|
3549 | default:
|
3550 | state.pipes.push(dest);
|
3551 | break;
|
3552 | }
|
3553 | state.pipesCount += 1;
|
3554 |
|
3555 | var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
|
3556 | dest !== process.stdout &&
|
3557 | dest !== process.stderr;
|
3558 |
|
3559 | var endFn = doEnd ? onend : cleanup;
|
3560 | if (state.endEmitted)
|
3561 | setImmediate(endFn);
|
3562 | else
|
3563 | src.once('end', endFn);
|
3564 |
|
3565 | dest.on('unpipe', onunpipe);
|
3566 | function onunpipe(readable) {
|
3567 | if (readable !== src) return;
|
3568 | cleanup();
|
3569 | }
|
3570 |
|
3571 | function onend() {
|
3572 | dest.end();
|
3573 | }
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 | var ondrain = pipeOnDrain(src);
|
3580 | dest.on('drain', ondrain);
|
3581 |
|
3582 | function cleanup() {
|
3583 |
|
3584 | dest.removeListener('close', onclose);
|
3585 | dest.removeListener('finish', onfinish);
|
3586 | dest.removeListener('drain', ondrain);
|
3587 | dest.removeListener('error', onerror);
|
3588 | dest.removeListener('unpipe', onunpipe);
|
3589 | src.removeListener('end', onend);
|
3590 | src.removeListener('end', cleanup);
|
3591 |
|
3592 |
|
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 | if (!dest._writableState || dest._writableState.needDrain)
|
3598 | ondrain();
|
3599 | }
|
3600 |
|
3601 |
|
3602 |
|
3603 |
|
3604 | var errListeners = EE.listenerCount(dest, 'error');
|
3605 | function onerror(er) {
|
3606 | unpipe();
|
3607 | if (errListeners === 0 && EE.listenerCount(dest, 'error') === 0)
|
3608 | dest.emit('error', er);
|
3609 | }
|
3610 | dest.once('error', onerror);
|
3611 |
|
3612 |
|
3613 | function onclose() {
|
3614 | dest.removeListener('finish', onfinish);
|
3615 | unpipe();
|
3616 | }
|
3617 | dest.once('close', onclose);
|
3618 | function onfinish() {
|
3619 | dest.removeListener('close', onclose);
|
3620 | unpipe();
|
3621 | }
|
3622 | dest.once('finish', onfinish);
|
3623 |
|
3624 | function unpipe() {
|
3625 | src.unpipe(dest);
|
3626 | }
|
3627 |
|
3628 |
|
3629 | dest.emit('pipe', src);
|
3630 |
|
3631 |
|
3632 | if (!state.flowing) {
|
3633 |
|
3634 |
|
3635 |
|
3636 |
|
3637 | this.on('readable', pipeOnReadable);
|
3638 |
|
3639 | state.flowing = true;
|
3640 | setImmediate(function() {
|
3641 | flow(src);
|
3642 | });
|
3643 | }
|
3644 |
|
3645 | return dest;
|
3646 | };
|
3647 |
|
3648 | function pipeOnDrain(src) {
|
3649 | return function() {
|
3650 | var dest = this;
|
3651 | var state = src._readableState;
|
3652 | state.awaitDrain--;
|
3653 | if (state.awaitDrain === 0)
|
3654 | flow(src);
|
3655 | };
|
3656 | }
|
3657 |
|
3658 | function flow(src) {
|
3659 | var state = src._readableState;
|
3660 | var chunk;
|
3661 | state.awaitDrain = 0;
|
3662 |
|
3663 | function write(dest, i, list) {
|
3664 | var written = dest.write(chunk);
|
3665 | if (false === written) {
|
3666 | state.awaitDrain++;
|
3667 | }
|
3668 | }
|
3669 |
|
3670 | while (state.pipesCount && null !== (chunk = src.read())) {
|
3671 |
|
3672 | if (state.pipesCount === 1)
|
3673 | write(state.pipes, 0, null);
|
3674 | else
|
3675 | forEach(state.pipes, write);
|
3676 |
|
3677 | src.emit('data', chunk);
|
3678 |
|
3679 |
|
3680 | if (state.awaitDrain > 0)
|
3681 | return;
|
3682 | }
|
3683 |
|
3684 |
|
3685 |
|
3686 |
|
3687 |
|
3688 | if (state.pipesCount === 0) {
|
3689 | state.flowing = false;
|
3690 |
|
3691 |
|
3692 | if (EE.listenerCount(src, 'data') > 0)
|
3693 | emitDataEvents(src);
|
3694 | return;
|
3695 | }
|
3696 |
|
3697 |
|
3698 |
|
3699 | state.ranOut = true;
|
3700 | }
|
3701 |
|
3702 | function pipeOnReadable() {
|
3703 | if (this._readableState.ranOut) {
|
3704 | this._readableState.ranOut = false;
|
3705 | flow(this);
|
3706 | }
|
3707 | }
|
3708 |
|
3709 |
|
3710 | Readable.prototype.unpipe = function(dest) {
|
3711 | var state = this._readableState;
|
3712 |
|
3713 |
|
3714 | if (state.pipesCount === 0)
|
3715 | return this;
|
3716 |
|
3717 |
|
3718 | if (state.pipesCount === 1) {
|
3719 |
|
3720 | if (dest && dest !== state.pipes)
|
3721 | return this;
|
3722 |
|
3723 | if (!dest)
|
3724 | dest = state.pipes;
|
3725 |
|
3726 |
|
3727 | state.pipes = null;
|
3728 | state.pipesCount = 0;
|
3729 | this.removeListener('readable', pipeOnReadable);
|
3730 | state.flowing = false;
|
3731 | if (dest)
|
3732 | dest.emit('unpipe', this);
|
3733 | return this;
|
3734 | }
|
3735 |
|
3736 |
|
3737 |
|
3738 | if (!dest) {
|
3739 |
|
3740 | var dests = state.pipes;
|
3741 | var len = state.pipesCount;
|
3742 | state.pipes = null;
|
3743 | state.pipesCount = 0;
|
3744 | this.removeListener('readable', pipeOnReadable);
|
3745 | state.flowing = false;
|
3746 |
|
3747 | for (var i = 0; i < len; i++)
|
3748 | dests[i].emit('unpipe', this);
|
3749 | return this;
|
3750 | }
|
3751 |
|
3752 |
|
3753 | var i = indexOf(state.pipes, dest);
|
3754 | if (i === -1)
|
3755 | return this;
|
3756 |
|
3757 | state.pipes.splice(i, 1);
|
3758 | state.pipesCount -= 1;
|
3759 | if (state.pipesCount === 1)
|
3760 | state.pipes = state.pipes[0];
|
3761 |
|
3762 | dest.emit('unpipe', this);
|
3763 |
|
3764 | return this;
|
3765 | };
|
3766 |
|
3767 |
|
3768 |
|
3769 | Readable.prototype.on = function(ev, fn) {
|
3770 | var res = Stream.prototype.on.call(this, ev, fn);
|
3771 |
|
3772 | if (ev === 'data' && !this._readableState.flowing)
|
3773 | emitDataEvents(this);
|
3774 |
|
3775 | if (ev === 'readable' && this.readable) {
|
3776 | var state = this._readableState;
|
3777 | if (!state.readableListening) {
|
3778 | state.readableListening = true;
|
3779 | state.emittedReadable = false;
|
3780 | state.needReadable = true;
|
3781 | if (!state.reading) {
|
3782 | this.read(0);
|
3783 | } else if (state.length) {
|
3784 | emitReadable(this, state);
|
3785 | }
|
3786 | }
|
3787 | }
|
3788 |
|
3789 | return res;
|
3790 | };
|
3791 | Readable.prototype.addListener = Readable.prototype.on;
|
3792 |
|
3793 |
|
3794 |
|
3795 | Readable.prototype.resume = function() {
|
3796 | emitDataEvents(this);
|
3797 | this.read(0);
|
3798 | this.emit('resume');
|
3799 | };
|
3800 |
|
3801 | Readable.prototype.pause = function() {
|
3802 | emitDataEvents(this, true);
|
3803 | this.emit('pause');
|
3804 | };
|
3805 |
|
3806 | function emitDataEvents(stream, startPaused) {
|
3807 | var state = stream._readableState;
|
3808 |
|
3809 | if (state.flowing) {
|
3810 |
|
3811 | throw new Error('Cannot switch to old mode now.');
|
3812 | }
|
3813 |
|
3814 | var paused = startPaused || false;
|
3815 | var readable = false;
|
3816 |
|
3817 |
|
3818 | stream.readable = true;
|
3819 | stream.pipe = Stream.prototype.pipe;
|
3820 | stream.on = stream.addListener = Stream.prototype.on;
|
3821 |
|
3822 | stream.on('readable', function() {
|
3823 | readable = true;
|
3824 |
|
3825 | var c;
|
3826 | while (!paused && (null !== (c = stream.read())))
|
3827 | stream.emit('data', c);
|
3828 |
|
3829 | if (c === null) {
|
3830 | readable = false;
|
3831 | stream._readableState.needReadable = true;
|
3832 | }
|
3833 | });
|
3834 |
|
3835 | stream.pause = function() {
|
3836 | paused = true;
|
3837 | this.emit('pause');
|
3838 | };
|
3839 |
|
3840 | stream.resume = function() {
|
3841 | paused = false;
|
3842 | if (readable)
|
3843 | setImmediate(function() {
|
3844 | stream.emit('readable');
|
3845 | });
|
3846 | else
|
3847 | this.read(0);
|
3848 | this.emit('resume');
|
3849 | };
|
3850 |
|
3851 |
|
3852 | stream.emit('readable');
|
3853 | }
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 | Readable.prototype.wrap = function(stream) {
|
3859 | var state = this._readableState;
|
3860 | var paused = false;
|
3861 |
|
3862 | var self = this;
|
3863 | stream.on('end', function() {
|
3864 | if (state.decoder && !state.ended) {
|
3865 | var chunk = state.decoder.end();
|
3866 | if (chunk && chunk.length)
|
3867 | self.push(chunk);
|
3868 | }
|
3869 |
|
3870 | self.push(null);
|
3871 | });
|
3872 |
|
3873 | stream.on('data', function(chunk) {
|
3874 | if (state.decoder)
|
3875 | chunk = state.decoder.write(chunk);
|
3876 | if (!chunk || !state.objectMode && !chunk.length)
|
3877 | return;
|
3878 |
|
3879 | var ret = self.push(chunk);
|
3880 | if (!ret) {
|
3881 | paused = true;
|
3882 | stream.pause();
|
3883 | }
|
3884 | });
|
3885 |
|
3886 |
|
3887 |
|
3888 | for (var i in stream) {
|
3889 | if (typeof stream[i] === 'function' &&
|
3890 | typeof this[i] === 'undefined') {
|
3891 | this[i] = function(method) { return function() {
|
3892 | return stream[method].apply(stream, arguments);
|
3893 | }}(i);
|
3894 | }
|
3895 | }
|
3896 |
|
3897 |
|
3898 | var events = ['error', 'close', 'destroy', 'pause', 'resume'];
|
3899 | forEach(events, function(ev) {
|
3900 | stream.on(ev, function (x) {
|
3901 | return self.emit.apply(self, ev, x);
|
3902 | });
|
3903 | });
|
3904 |
|
3905 |
|
3906 |
|
3907 | self._read = function(n) {
|
3908 | if (paused) {
|
3909 | paused = false;
|
3910 | stream.resume();
|
3911 | }
|
3912 | };
|
3913 |
|
3914 | return self;
|
3915 | };
|
3916 |
|
3917 |
|
3918 |
|
3919 |
|
3920 | Readable._fromList = fromList;
|
3921 |
|
3922 |
|
3923 |
|
3924 | function fromList(n, state) {
|
3925 | var list = state.buffer;
|
3926 | var length = state.length;
|
3927 | var stringMode = !!state.decoder;
|
3928 | var objectMode = !!state.objectMode;
|
3929 | var ret;
|
3930 |
|
3931 |
|
3932 | if (list.length === 0)
|
3933 | return null;
|
3934 |
|
3935 | if (length === 0)
|
3936 | ret = null;
|
3937 | else if (objectMode)
|
3938 | ret = list.shift();
|
3939 | else if (!n || n >= length) {
|
3940 |
|
3941 | if (stringMode)
|
3942 | ret = list.join('');
|
3943 | else
|
3944 | ret = Buffer.concat(list, length);
|
3945 | list.length = 0;
|
3946 | } else {
|
3947 |
|
3948 | if (n < list[0].length) {
|
3949 |
|
3950 |
|
3951 | var buf = list[0];
|
3952 | ret = buf.slice(0, n);
|
3953 | list[0] = buf.slice(n);
|
3954 | } else if (n === list[0].length) {
|
3955 |
|
3956 | ret = list.shift();
|
3957 | } else {
|
3958 |
|
3959 |
|
3960 | if (stringMode)
|
3961 | ret = '';
|
3962 | else
|
3963 | ret = new Buffer(n);
|
3964 |
|
3965 | var c = 0;
|
3966 | for (var i = 0, l = list.length; i < l && c < n; i++) {
|
3967 | var buf = list[0];
|
3968 | var cpy = Math.min(n - c, buf.length);
|
3969 |
|
3970 | if (stringMode)
|
3971 | ret += buf.slice(0, cpy);
|
3972 | else
|
3973 | buf.copy(ret, c, 0, cpy);
|
3974 |
|
3975 | if (cpy < buf.length)
|
3976 | list[0] = buf.slice(cpy);
|
3977 | else
|
3978 | list.shift();
|
3979 |
|
3980 | c += cpy;
|
3981 | }
|
3982 | }
|
3983 | }
|
3984 |
|
3985 | return ret;
|
3986 | }
|
3987 |
|
3988 | function endReadable(stream) {
|
3989 | var state = stream._readableState;
|
3990 |
|
3991 |
|
3992 |
|
3993 | if (state.length > 0)
|
3994 | throw new Error('endReadable called on non-empty stream');
|
3995 |
|
3996 | if (!state.endEmitted && state.calledRead) {
|
3997 | state.ended = true;
|
3998 | setImmediate(function() {
|
3999 |
|
4000 | if (!state.endEmitted && state.length === 0) {
|
4001 | state.endEmitted = true;
|
4002 | stream.readable = false;
|
4003 | stream.emit('end');
|
4004 | }
|
4005 | });
|
4006 | }
|
4007 | }
|
4008 |
|
4009 | function forEach (xs, f) {
|
4010 | for (var i = 0, l = xs.length; i < l; i++) {
|
4011 | f(xs[i], i);
|
4012 | }
|
4013 | }
|
4014 |
|
4015 | function indexOf (xs, x) {
|
4016 | for (var i = 0, l = xs.length; i < l; i++) {
|
4017 | if (xs[i] === x) return i;
|
4018 | }
|
4019 | return -1;
|
4020 | }
|
4021 |
|
4022 | }).call(this,require("/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))
|
4023 | },{"./index.js":18,"/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":15,"buffer":4,"events":13,"inherits":14,"process/browser.js":19,"string_decoder":24}],22:[function(require,module,exports){
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 |
|
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 |
|
4041 |
|
4042 |
|
4043 |
|
4044 |
|
4045 |
|
4046 |
|
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 |
|
4052 |
|
4053 |
|
4054 |
|
4055 |
|
4056 |
|
4057 |
|
4058 |
|
4059 |
|
4060 |
|
4061 |
|
4062 |
|
4063 |
|
4064 |
|
4065 |
|
4066 |
|
4067 |
|
4068 |
|
4069 |
|
4070 |
|
4071 |
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 | module.exports = Transform;
|
4088 |
|
4089 | var Duplex = require('./duplex.js');
|
4090 | var inherits = require('inherits');
|
4091 | inherits(Transform, Duplex);
|
4092 |
|
4093 |
|
4094 | function TransformState(options, stream) {
|
4095 | this.afterTransform = function(er, data) {
|
4096 | return afterTransform(stream, er, data);
|
4097 | };
|
4098 |
|
4099 | this.needTransform = false;
|
4100 | this.transforming = false;
|
4101 | this.writecb = null;
|
4102 | this.writechunk = null;
|
4103 | }
|
4104 |
|
4105 | function afterTransform(stream, er, data) {
|
4106 | var ts = stream._transformState;
|
4107 | ts.transforming = false;
|
4108 |
|
4109 | var cb = ts.writecb;
|
4110 |
|
4111 | if (!cb)
|
4112 | return stream.emit('error', new Error('no writecb in Transform class'));
|
4113 |
|
4114 | ts.writechunk = null;
|
4115 | ts.writecb = null;
|
4116 |
|
4117 | if (data !== null && data !== undefined)
|
4118 | stream.push(data);
|
4119 |
|
4120 | if (cb)
|
4121 | cb(er);
|
4122 |
|
4123 | var rs = stream._readableState;
|
4124 | rs.reading = false;
|
4125 | if (rs.needReadable || rs.length < rs.highWaterMark) {
|
4126 | stream._read(rs.highWaterMark);
|
4127 | }
|
4128 | }
|
4129 |
|
4130 |
|
4131 | function Transform(options) {
|
4132 | if (!(this instanceof Transform))
|
4133 | return new Transform(options);
|
4134 |
|
4135 | Duplex.call(this, options);
|
4136 |
|
4137 | var ts = this._transformState = new TransformState(options, this);
|
4138 |
|
4139 |
|
4140 | var stream = this;
|
4141 |
|
4142 |
|
4143 | this._readableState.needReadable = true;
|
4144 |
|
4145 |
|
4146 |
|
4147 |
|
4148 | this._readableState.sync = false;
|
4149 |
|
4150 | this.once('finish', function() {
|
4151 | if ('function' === typeof this._flush)
|
4152 | this._flush(function(er) {
|
4153 | done(stream, er);
|
4154 | });
|
4155 | else
|
4156 | done(stream);
|
4157 | });
|
4158 | }
|
4159 |
|
4160 | Transform.prototype.push = function(chunk, encoding) {
|
4161 | this._transformState.needTransform = false;
|
4162 | return Duplex.prototype.push.call(this, chunk, encoding);
|
4163 | };
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 |
|
4171 |
|
4172 |
|
4173 |
|
4174 |
|
4175 | Transform.prototype._transform = function(chunk, encoding, cb) {
|
4176 | throw new Error('not implemented');
|
4177 | };
|
4178 |
|
4179 | Transform.prototype._write = function(chunk, encoding, cb) {
|
4180 | var ts = this._transformState;
|
4181 | ts.writecb = cb;
|
4182 | ts.writechunk = chunk;
|
4183 | ts.writeencoding = encoding;
|
4184 | if (!ts.transforming) {
|
4185 | var rs = this._readableState;
|
4186 | if (ts.needTransform ||
|
4187 | rs.needReadable ||
|
4188 | rs.length < rs.highWaterMark)
|
4189 | this._read(rs.highWaterMark);
|
4190 | }
|
4191 | };
|
4192 |
|
4193 |
|
4194 |
|
4195 |
|
4196 | Transform.prototype._read = function(n) {
|
4197 | var ts = this._transformState;
|
4198 |
|
4199 | if (ts.writechunk && ts.writecb && !ts.transforming) {
|
4200 | ts.transforming = true;
|
4201 | this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
4202 | } else {
|
4203 |
|
4204 |
|
4205 | ts.needTransform = true;
|
4206 | }
|
4207 | };
|
4208 |
|
4209 |
|
4210 | function done(stream, er) {
|
4211 | if (er)
|
4212 | return stream.emit('error', er);
|
4213 |
|
4214 |
|
4215 |
|
4216 | var ws = stream._writableState;
|
4217 | var rs = stream._readableState;
|
4218 | var ts = stream._transformState;
|
4219 |
|
4220 | if (ws.length)
|
4221 | throw new Error('calling transform done when ws.length != 0');
|
4222 |
|
4223 | if (ts.transforming)
|
4224 | throw new Error('calling transform done when still transforming');
|
4225 |
|
4226 | return stream.push(null);
|
4227 | }
|
4228 |
|
4229 | },{"./duplex.js":17,"inherits":14}],23:[function(require,module,exports){
|
4230 |
|
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 |
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 |
|
4253 |
|
4254 |
|
4255 | module.exports = Writable;
|
4256 | Writable.WritableState = WritableState;
|
4257 |
|
4258 | var isUint8Array = typeof Uint8Array !== 'undefined'
|
4259 | ? function (x) { return x instanceof Uint8Array }
|
4260 | : function (x) {
|
4261 | return x && x.constructor && x.constructor.name === 'Uint8Array'
|
4262 | }
|
4263 | ;
|
4264 | var isArrayBuffer = typeof ArrayBuffer !== 'undefined'
|
4265 | ? function (x) { return x instanceof ArrayBuffer }
|
4266 | : function (x) {
|
4267 | return x && x.constructor && x.constructor.name === 'ArrayBuffer'
|
4268 | }
|
4269 | ;
|
4270 |
|
4271 | var inherits = require('inherits');
|
4272 | var Stream = require('./index.js');
|
4273 | var setImmediate = require('process/browser.js').nextTick;
|
4274 | var Buffer = require('buffer').Buffer;
|
4275 |
|
4276 | inherits(Writable, Stream);
|
4277 |
|
4278 | function WriteReq(chunk, encoding, cb) {
|
4279 | this.chunk = chunk;
|
4280 | this.encoding = encoding;
|
4281 | this.callback = cb;
|
4282 | }
|
4283 |
|
4284 | function WritableState(options, stream) {
|
4285 | options = options || {};
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 | var hwm = options.highWaterMark;
|
4291 | this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;
|
4292 |
|
4293 |
|
4294 |
|
4295 | this.objectMode = !!options.objectMode;
|
4296 |
|
4297 |
|
4298 | this.highWaterMark = ~~this.highWaterMark;
|
4299 |
|
4300 | this.needDrain = false;
|
4301 |
|
4302 | this.ending = false;
|
4303 |
|
4304 | this.ended = false;
|
4305 |
|
4306 | this.finished = false;
|
4307 |
|
4308 |
|
4309 |
|
4310 |
|
4311 | var noDecode = options.decodeStrings === false;
|
4312 | this.decodeStrings = !noDecode;
|
4313 |
|
4314 |
|
4315 |
|
4316 |
|
4317 | this.defaultEncoding = options.defaultEncoding || 'utf8';
|
4318 |
|
4319 |
|
4320 |
|
4321 |
|
4322 | this.length = 0;
|
4323 |
|
4324 |
|
4325 | this.writing = false;
|
4326 |
|
4327 |
|
4328 |
|
4329 |
|
4330 |
|
4331 | this.sync = true;
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 | this.bufferProcessing = false;
|
4337 |
|
4338 |
|
4339 | this.onwrite = function(er) {
|
4340 | onwrite(stream, er);
|
4341 | };
|
4342 |
|
4343 |
|
4344 | this.writecb = null;
|
4345 |
|
4346 |
|
4347 | this.writelen = 0;
|
4348 |
|
4349 | this.buffer = [];
|
4350 | }
|
4351 |
|
4352 | function Writable(options) {
|
4353 |
|
4354 |
|
4355 | if (!(this instanceof Writable) && !(this instanceof Stream.Duplex))
|
4356 | return new Writable(options);
|
4357 |
|
4358 | this._writableState = new WritableState(options, this);
|
4359 |
|
4360 |
|
4361 | this.writable = true;
|
4362 |
|
4363 | Stream.call(this);
|
4364 | }
|
4365 |
|
4366 |
|
4367 | Writable.prototype.pipe = function() {
|
4368 | this.emit('error', new Error('Cannot pipe. Not readable.'));
|
4369 | };
|
4370 |
|
4371 |
|
4372 | function writeAfterEnd(stream, state, cb) {
|
4373 | var er = new Error('write after end');
|
4374 |
|
4375 | stream.emit('error', er);
|
4376 | setImmediate(function() {
|
4377 | cb(er);
|
4378 | });
|
4379 | }
|
4380 |
|
4381 |
|
4382 |
|
4383 |
|
4384 |
|
4385 |
|
4386 | function validChunk(stream, state, chunk, cb) {
|
4387 | var valid = true;
|
4388 | if (!Buffer.isBuffer(chunk) &&
|
4389 | 'string' !== typeof chunk &&
|
4390 | chunk !== null &&
|
4391 | chunk !== undefined &&
|
4392 | !state.objectMode) {
|
4393 | var er = new TypeError('Invalid non-string/buffer chunk');
|
4394 | stream.emit('error', er);
|
4395 | setImmediate(function() {
|
4396 | cb(er);
|
4397 | });
|
4398 | valid = false;
|
4399 | }
|
4400 | return valid;
|
4401 | }
|
4402 |
|
4403 | Writable.prototype.write = function(chunk, encoding, cb) {
|
4404 | var state = this._writableState;
|
4405 | var ret = false;
|
4406 |
|
4407 | if (typeof encoding === 'function') {
|
4408 | cb = encoding;
|
4409 | encoding = null;
|
4410 | }
|
4411 |
|
4412 | if (!Buffer.isBuffer(chunk) && isUint8Array(chunk))
|
4413 | chunk = new Buffer(chunk);
|
4414 | if (isArrayBuffer(chunk) && typeof Uint8Array !== 'undefined')
|
4415 | chunk = new Buffer(new Uint8Array(chunk));
|
4416 |
|
4417 | if (Buffer.isBuffer(chunk))
|
4418 | encoding = 'buffer';
|
4419 | else if (!encoding)
|
4420 | encoding = state.defaultEncoding;
|
4421 |
|
4422 | if (typeof cb !== 'function')
|
4423 | cb = function() {};
|
4424 |
|
4425 | if (state.ended)
|
4426 | writeAfterEnd(this, state, cb);
|
4427 | else if (validChunk(this, state, chunk, cb))
|
4428 | ret = writeOrBuffer(this, state, chunk, encoding, cb);
|
4429 |
|
4430 | return ret;
|
4431 | };
|
4432 |
|
4433 | function decodeChunk(state, chunk, encoding) {
|
4434 | if (!state.objectMode &&
|
4435 | state.decodeStrings !== false &&
|
4436 | typeof chunk === 'string') {
|
4437 | chunk = new Buffer(chunk, encoding);
|
4438 | }
|
4439 | return chunk;
|
4440 | }
|
4441 |
|
4442 |
|
4443 |
|
4444 |
|
4445 | function writeOrBuffer(stream, state, chunk, encoding, cb) {
|
4446 | chunk = decodeChunk(state, chunk, encoding);
|
4447 | var len = state.objectMode ? 1 : chunk.length;
|
4448 |
|
4449 | state.length += len;
|
4450 |
|
4451 | var ret = state.length < state.highWaterMark;
|
4452 | state.needDrain = !ret;
|
4453 |
|
4454 | if (state.writing)
|
4455 | state.buffer.push(new WriteReq(chunk, encoding, cb));
|
4456 | else
|
4457 | doWrite(stream, state, len, chunk, encoding, cb);
|
4458 |
|
4459 | return ret;
|
4460 | }
|
4461 |
|
4462 | function doWrite(stream, state, len, chunk, encoding, cb) {
|
4463 | state.writelen = len;
|
4464 | state.writecb = cb;
|
4465 | state.writing = true;
|
4466 | state.sync = true;
|
4467 | stream._write(chunk, encoding, state.onwrite);
|
4468 | state.sync = false;
|
4469 | }
|
4470 |
|
4471 | function onwriteError(stream, state, sync, er, cb) {
|
4472 | if (sync)
|
4473 | setImmediate(function() {
|
4474 | cb(er);
|
4475 | });
|
4476 | else
|
4477 | cb(er);
|
4478 |
|
4479 | stream.emit('error', er);
|
4480 | }
|
4481 |
|
4482 | function onwriteStateUpdate(state) {
|
4483 | state.writing = false;
|
4484 | state.writecb = null;
|
4485 | state.length -= state.writelen;
|
4486 | state.writelen = 0;
|
4487 | }
|
4488 |
|
4489 | function onwrite(stream, er) {
|
4490 | var state = stream._writableState;
|
4491 | var sync = state.sync;
|
4492 | var cb = state.writecb;
|
4493 |
|
4494 | onwriteStateUpdate(state);
|
4495 |
|
4496 | if (er)
|
4497 | onwriteError(stream, state, sync, er, cb);
|
4498 | else {
|
4499 |
|
4500 | var finished = needFinish(stream, state);
|
4501 |
|
4502 | if (!finished && !state.bufferProcessing && state.buffer.length)
|
4503 | clearBuffer(stream, state);
|
4504 |
|
4505 | if (sync) {
|
4506 | setImmediate(function() {
|
4507 | afterWrite(stream, state, finished, cb);
|
4508 | });
|
4509 | } else {
|
4510 | afterWrite(stream, state, finished, cb);
|
4511 | }
|
4512 | }
|
4513 | }
|
4514 |
|
4515 | function afterWrite(stream, state, finished, cb) {
|
4516 | if (!finished)
|
4517 | onwriteDrain(stream, state);
|
4518 | cb();
|
4519 | if (finished)
|
4520 | finishMaybe(stream, state);
|
4521 | }
|
4522 |
|
4523 |
|
4524 |
|
4525 |
|
4526 | function onwriteDrain(stream, state) {
|
4527 | if (state.length === 0 && state.needDrain) {
|
4528 | state.needDrain = false;
|
4529 | stream.emit('drain');
|
4530 | }
|
4531 | }
|
4532 |
|
4533 |
|
4534 |
|
4535 | function clearBuffer(stream, state) {
|
4536 | state.bufferProcessing = true;
|
4537 |
|
4538 | for (var c = 0; c < state.buffer.length; c++) {
|
4539 | var entry = state.buffer[c];
|
4540 | var chunk = entry.chunk;
|
4541 | var encoding = entry.encoding;
|
4542 | var cb = entry.callback;
|
4543 | var len = state.objectMode ? 1 : chunk.length;
|
4544 |
|
4545 | doWrite(stream, state, len, chunk, encoding, cb);
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 |
|
4551 | if (state.writing) {
|
4552 | c++;
|
4553 | break;
|
4554 | }
|
4555 | }
|
4556 |
|
4557 | state.bufferProcessing = false;
|
4558 | if (c < state.buffer.length)
|
4559 | state.buffer = state.buffer.slice(c);
|
4560 | else
|
4561 | state.buffer.length = 0;
|
4562 | }
|
4563 |
|
4564 | Writable.prototype._write = function(chunk, encoding, cb) {
|
4565 | cb(new Error('not implemented'));
|
4566 | };
|
4567 |
|
4568 | Writable.prototype.end = function(chunk, encoding, cb) {
|
4569 | var state = this._writableState;
|
4570 |
|
4571 | if (typeof chunk === 'function') {
|
4572 | cb = chunk;
|
4573 | chunk = null;
|
4574 | encoding = null;
|
4575 | } else if (typeof encoding === 'function') {
|
4576 | cb = encoding;
|
4577 | encoding = null;
|
4578 | }
|
4579 |
|
4580 | if (typeof chunk !== 'undefined' && chunk !== null)
|
4581 | this.write(chunk, encoding);
|
4582 |
|
4583 |
|
4584 | if (!state.ending && !state.finished)
|
4585 | endWritable(this, state, cb);
|
4586 | };
|
4587 |
|
4588 |
|
4589 | function needFinish(stream, state) {
|
4590 | return (state.ending &&
|
4591 | state.length === 0 &&
|
4592 | !state.finished &&
|
4593 | !state.writing);
|
4594 | }
|
4595 |
|
4596 | function finishMaybe(stream, state) {
|
4597 | var need = needFinish(stream, state);
|
4598 | if (need) {
|
4599 | state.finished = true;
|
4600 | stream.emit('finish');
|
4601 | }
|
4602 | return need;
|
4603 | }
|
4604 |
|
4605 | function endWritable(stream, state, cb) {
|
4606 | state.ending = true;
|
4607 | finishMaybe(stream, state);
|
4608 | if (cb) {
|
4609 | if (state.finished)
|
4610 | setImmediate(cb);
|
4611 | else
|
4612 | stream.once('finish', cb);
|
4613 | }
|
4614 | state.ended = true;
|
4615 | }
|
4616 |
|
4617 | },{"./index.js":18,"buffer":4,"inherits":14,"process/browser.js":19}],24:[function(require,module,exports){
|
4618 |
|
4619 |
|
4620 |
|
4621 |
|
4622 |
|
4623 |
|
4624 |
|
4625 |
|
4626 |
|
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 |
|
4632 |
|
4633 |
|
4634 |
|
4635 |
|
4636 |
|
4637 |
|
4638 |
|
4639 | var Buffer = require('buffer').Buffer;
|
4640 |
|
4641 | function assertEncoding(encoding) {
|
4642 | if (encoding && !Buffer.isEncoding(encoding)) {
|
4643 | throw new Error('Unknown encoding: ' + encoding);
|
4644 | }
|
4645 | }
|
4646 |
|
4647 | var StringDecoder = exports.StringDecoder = function(encoding) {
|
4648 | this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
|
4649 | assertEncoding(encoding);
|
4650 | switch (this.encoding) {
|
4651 | case 'utf8':
|
4652 |
|
4653 | this.surrogateSize = 3;
|
4654 | break;
|
4655 | case 'ucs2':
|
4656 | case 'utf16le':
|
4657 |
|
4658 | this.surrogateSize = 2;
|
4659 | this.detectIncompleteChar = utf16DetectIncompleteChar;
|
4660 | break;
|
4661 | case 'base64':
|
4662 |
|
4663 | this.surrogateSize = 3;
|
4664 | this.detectIncompleteChar = base64DetectIncompleteChar;
|
4665 | break;
|
4666 | default:
|
4667 | this.write = passThroughWrite;
|
4668 | return;
|
4669 | }
|
4670 |
|
4671 | this.charBuffer = new Buffer(6);
|
4672 | this.charReceived = 0;
|
4673 | this.charLength = 0;
|
4674 | };
|
4675 |
|
4676 |
|
4677 | StringDecoder.prototype.write = function(buffer) {
|
4678 | var charStr = '';
|
4679 | var offset = 0;
|
4680 |
|
4681 |
|
4682 | while (this.charLength) {
|
4683 |
|
4684 | var i = (buffer.length >= this.charLength - this.charReceived) ?
|
4685 | this.charLength - this.charReceived :
|
4686 | buffer.length;
|
4687 |
|
4688 |
|
4689 | buffer.copy(this.charBuffer, this.charReceived, offset, i);
|
4690 | this.charReceived += (i - offset);
|
4691 | offset = i;
|
4692 |
|
4693 | if (this.charReceived < this.charLength) {
|
4694 |
|
4695 | return '';
|
4696 | }
|
4697 |
|
4698 |
|
4699 | charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
|
4700 |
|
4701 |
|
4702 | var charCode = charStr.charCodeAt(charStr.length - 1);
|
4703 | if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
4704 | this.charLength += this.surrogateSize;
|
4705 | charStr = '';
|
4706 | continue;
|
4707 | }
|
4708 | this.charReceived = this.charLength = 0;
|
4709 |
|
4710 |
|
4711 | if (i == buffer.length) return charStr;
|
4712 |
|
4713 |
|
4714 | buffer = buffer.slice(i, buffer.length);
|
4715 | break;
|
4716 | }
|
4717 |
|
4718 | var lenIncomplete = this.detectIncompleteChar(buffer);
|
4719 |
|
4720 | var end = buffer.length;
|
4721 | if (this.charLength) {
|
4722 |
|
4723 | buffer.copy(this.charBuffer, 0, buffer.length - lenIncomplete, end);
|
4724 | this.charReceived = lenIncomplete;
|
4725 | end -= lenIncomplete;
|
4726 | }
|
4727 |
|
4728 | charStr += buffer.toString(this.encoding, 0, end);
|
4729 |
|
4730 | var end = charStr.length - 1;
|
4731 | var charCode = charStr.charCodeAt(end);
|
4732 |
|
4733 | if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
4734 | var size = this.surrogateSize;
|
4735 | this.charLength += size;
|
4736 | this.charReceived += size;
|
4737 | this.charBuffer.copy(this.charBuffer, size, 0, size);
|
4738 | this.charBuffer.write(charStr.charAt(charStr.length - 1), this.encoding);
|
4739 | return charStr.substring(0, end);
|
4740 | }
|
4741 |
|
4742 |
|
4743 | return charStr;
|
4744 | };
|
4745 |
|
4746 | StringDecoder.prototype.detectIncompleteChar = function(buffer) {
|
4747 |
|
4748 | var i = (buffer.length >= 3) ? 3 : buffer.length;
|
4749 |
|
4750 |
|
4751 |
|
4752 | for (; i > 0; i--) {
|
4753 | var c = buffer[buffer.length - i];
|
4754 |
|
4755 |
|
4756 |
|
4757 |
|
4758 | if (i == 1 && c >> 5 == 0x06) {
|
4759 | this.charLength = 2;
|
4760 | break;
|
4761 | }
|
4762 |
|
4763 |
|
4764 | if (i <= 2 && c >> 4 == 0x0E) {
|
4765 | this.charLength = 3;
|
4766 | break;
|
4767 | }
|
4768 |
|
4769 |
|
4770 | if (i <= 3 && c >> 3 == 0x1E) {
|
4771 | this.charLength = 4;
|
4772 | break;
|
4773 | }
|
4774 | }
|
4775 |
|
4776 | return i;
|
4777 | };
|
4778 |
|
4779 | StringDecoder.prototype.end = function(buffer) {
|
4780 | var res = '';
|
4781 | if (buffer && buffer.length)
|
4782 | res = this.write(buffer);
|
4783 |
|
4784 | if (this.charReceived) {
|
4785 | var cr = this.charReceived;
|
4786 | var buf = this.charBuffer;
|
4787 | var enc = this.encoding;
|
4788 | res += buf.slice(0, cr).toString(enc);
|
4789 | }
|
4790 |
|
4791 | return res;
|
4792 | };
|
4793 |
|
4794 | function passThroughWrite(buffer) {
|
4795 | return buffer.toString(this.encoding);
|
4796 | }
|
4797 |
|
4798 | function utf16DetectIncompleteChar(buffer) {
|
4799 | var incomplete = this.charReceived = buffer.length % 2;
|
4800 | this.charLength = incomplete ? 2 : 0;
|
4801 | return incomplete;
|
4802 | }
|
4803 |
|
4804 | function base64DetectIncompleteChar(buffer) {
|
4805 | var incomplete = this.charReceived = buffer.length % 3;
|
4806 | this.charLength = incomplete ? 3 : 0;
|
4807 | return incomplete;
|
4808 | }
|
4809 |
|
4810 | },{"buffer":4}],25:[function(require,module,exports){
|
4811 | module.exports = function isBuffer(arg) {
|
4812 | return arg && typeof arg === 'object'
|
4813 | && typeof arg.copy === 'function'
|
4814 | && typeof arg.fill === 'function'
|
4815 | && typeof arg.readUInt8 === 'function';
|
4816 | }
|
4817 | },{}],26:[function(require,module,exports){
|
4818 | (function (process,global){
|
4819 |
|
4820 |
|
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 |
|
4826 |
|
4827 |
|
4828 |
|
4829 |
|
4830 |
|
4831 |
|
4832 |
|
4833 |
|
4834 |
|
4835 |
|
4836 |
|
4837 |
|
4838 |
|
4839 |
|
4840 | var formatRegExp = /%[sdj%]/g;
|
4841 | exports.format = function(f) {
|
4842 | if (!isString(f)) {
|
4843 | var objects = [];
|
4844 | for (var i = 0; i < arguments.length; i++) {
|
4845 | objects.push(inspect(arguments[i]));
|
4846 | }
|
4847 | return objects.join(' ');
|
4848 | }
|
4849 |
|
4850 | var i = 1;
|
4851 | var args = arguments;
|
4852 | var len = args.length;
|
4853 | var str = String(f).replace(formatRegExp, function(x) {
|
4854 | if (x === '%%') return '%';
|
4855 | if (i >= len) return x;
|
4856 | switch (x) {
|
4857 | case '%s': return String(args[i++]);
|
4858 | case '%d': return Number(args[i++]);
|
4859 | case '%j':
|
4860 | try {
|
4861 | return JSON.stringify(args[i++]);
|
4862 | } catch (_) {
|
4863 | return '[Circular]';
|
4864 | }
|
4865 | default:
|
4866 | return x;
|
4867 | }
|
4868 | });
|
4869 | for (var x = args[i]; i < len; x = args[++i]) {
|
4870 | if (isNull(x) || !isObject(x)) {
|
4871 | str += ' ' + x;
|
4872 | } else {
|
4873 | str += ' ' + inspect(x);
|
4874 | }
|
4875 | }
|
4876 | return str;
|
4877 | };
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 | exports.deprecate = function(fn, msg) {
|
4884 |
|
4885 | if (isUndefined(global.process)) {
|
4886 | return function() {
|
4887 | return exports.deprecate(fn, msg).apply(this, arguments);
|
4888 | };
|
4889 | }
|
4890 |
|
4891 | if (process.noDeprecation === true) {
|
4892 | return fn;
|
4893 | }
|
4894 |
|
4895 | var warned = false;
|
4896 | function deprecated() {
|
4897 | if (!warned) {
|
4898 | if (process.throwDeprecation) {
|
4899 | throw new Error(msg);
|
4900 | } else if (process.traceDeprecation) {
|
4901 | console.trace(msg);
|
4902 | } else {
|
4903 | console.error(msg);
|
4904 | }
|
4905 | warned = true;
|
4906 | }
|
4907 | return fn.apply(this, arguments);
|
4908 | }
|
4909 |
|
4910 | return deprecated;
|
4911 | };
|
4912 |
|
4913 |
|
4914 | var debugs = {};
|
4915 | var debugEnviron;
|
4916 | exports.debuglog = function(set) {
|
4917 | if (isUndefined(debugEnviron))
|
4918 | debugEnviron = process.env.NODE_DEBUG || '';
|
4919 | set = set.toUpperCase();
|
4920 | if (!debugs[set]) {
|
4921 | if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
4922 | var pid = process.pid;
|
4923 | debugs[set] = function() {
|
4924 | var msg = exports.format.apply(exports, arguments);
|
4925 | console.error('%s %d: %s', set, pid, msg);
|
4926 | };
|
4927 | } else {
|
4928 | debugs[set] = function() {};
|
4929 | }
|
4930 | }
|
4931 | return debugs[set];
|
4932 | };
|
4933 |
|
4934 |
|
4935 | /**
|
4936 | * Echos the value of a value. Trys to print the value out
|
4937 | * in the best way possible given the different types.
|
4938 | *
|
4939 | * @param {Object} obj The object to print out.
|
4940 | * @param {Object} opts Optional options object that alters the output.
|
4941 | */
|
4942 |
|
4943 | function inspect(obj, opts) {
|
4944 |
|
4945 | var ctx = {
|
4946 | seen: [],
|
4947 | stylize: stylizeNoColor
|
4948 | };
|
4949 |
|
4950 | if (arguments.length >= 3) ctx.depth = arguments[2];
|
4951 | if (arguments.length >= 4) ctx.colors = arguments[3];
|
4952 | if (isBoolean(opts)) {
|
4953 |
|
4954 | ctx.showHidden = opts;
|
4955 | } else if (opts) {
|
4956 |
|
4957 | exports._extend(ctx, opts);
|
4958 | }
|
4959 |
|
4960 | if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
4961 | if (isUndefined(ctx.depth)) ctx.depth = 2;
|
4962 | if (isUndefined(ctx.colors)) ctx.colors = false;
|
4963 | if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
4964 | if (ctx.colors) ctx.stylize = stylizeWithColor;
|
4965 | return formatValue(ctx, obj, ctx.depth);
|
4966 | }
|
4967 | exports.inspect = inspect;
|
4968 |
|
4969 |
|
4970 |
|
4971 | inspect.colors = {
|
4972 | 'bold' : [1, 22],
|
4973 | 'italic' : [3, 23],
|
4974 | 'underline' : [4, 24],
|
4975 | 'inverse' : [7, 27],
|
4976 | 'white' : [37, 39],
|
4977 | 'grey' : [90, 39],
|
4978 | 'black' : [30, 39],
|
4979 | 'blue' : [34, 39],
|
4980 | 'cyan' : [36, 39],
|
4981 | 'green' : [32, 39],
|
4982 | 'magenta' : [35, 39],
|
4983 | 'red' : [31, 39],
|
4984 | 'yellow' : [33, 39]
|
4985 | };
|
4986 |
|
4987 |
|
4988 | inspect.styles = {
|
4989 | 'special': 'cyan',
|
4990 | 'number': 'yellow',
|
4991 | 'boolean': 'yellow',
|
4992 | 'undefined': 'grey',
|
4993 | 'null': 'bold',
|
4994 | 'string': 'green',
|
4995 | 'date': 'magenta',
|
4996 |
|
4997 | 'regexp': 'red'
|
4998 | };
|
4999 |
|
5000 |
|
5001 | function stylizeWithColor(str, styleType) {
|
5002 | var style = inspect.styles[styleType];
|
5003 |
|
5004 | if (style) {
|
5005 | return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
5006 | '\u001b[' + inspect.colors[style][1] + 'm';
|
5007 | } else {
|
5008 | return str;
|
5009 | }
|
5010 | }
|
5011 |
|
5012 |
|
5013 | function stylizeNoColor(str, styleType) {
|
5014 | return str;
|
5015 | }
|
5016 |
|
5017 |
|
5018 | function arrayToHash(array) {
|
5019 | var hash = {};
|
5020 |
|
5021 | array.forEach(function(val, idx) {
|
5022 | hash[val] = true;
|
5023 | });
|
5024 |
|
5025 | return hash;
|
5026 | }
|
5027 |
|
5028 |
|
5029 | function formatValue(ctx, value, recurseTimes) {
|
5030 |
|
5031 |
|
5032 | if (ctx.customInspect &&
|
5033 | value &&
|
5034 | isFunction(value.inspect) &&
|
5035 |
|
5036 | value.inspect !== exports.inspect &&
|
5037 |
|
5038 | !(value.constructor && value.constructor.prototype === value)) {
|
5039 | var ret = value.inspect(recurseTimes, ctx);
|
5040 | if (!isString(ret)) {
|
5041 | ret = formatValue(ctx, ret, recurseTimes);
|
5042 | }
|
5043 | return ret;
|
5044 | }
|
5045 |
|
5046 |
|
5047 | var primitive = formatPrimitive(ctx, value);
|
5048 | if (primitive) {
|
5049 | return primitive;
|
5050 | }
|
5051 |
|
5052 |
|
5053 | var keys = Object.keys(value);
|
5054 | var visibleKeys = arrayToHash(keys);
|
5055 |
|
5056 | if (ctx.showHidden) {
|
5057 | keys = Object.getOwnPropertyNames(value);
|
5058 | }
|
5059 |
|
5060 |
|
5061 |
|
5062 | if (isError(value)
|
5063 | && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
5064 | return formatError(value);
|
5065 | }
|
5066 |
|
5067 |
|
5068 | if (keys.length === 0) {
|
5069 | if (isFunction(value)) {
|
5070 | var name = value.name ? ': ' + value.name : '';
|
5071 | return ctx.stylize('[Function' + name + ']', 'special');
|
5072 | }
|
5073 | if (isRegExp(value)) {
|
5074 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
5075 | }
|
5076 | if (isDate(value)) {
|
5077 | return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
5078 | }
|
5079 | if (isError(value)) {
|
5080 | return formatError(value);
|
5081 | }
|
5082 | }
|
5083 |
|
5084 | var base = '', array = false, braces = ['{', '}'];
|
5085 |
|
5086 |
|
5087 | if (isArray(value)) {
|
5088 | array = true;
|
5089 | braces = ['[', ']'];
|
5090 | }
|
5091 |
|
5092 |
|
5093 | if (isFunction(value)) {
|
5094 | var n = value.name ? ': ' + value.name : '';
|
5095 | base = ' [Function' + n + ']';
|
5096 | }
|
5097 |
|
5098 |
|
5099 | if (isRegExp(value)) {
|
5100 | base = ' ' + RegExp.prototype.toString.call(value);
|
5101 | }
|
5102 |
|
5103 |
|
5104 | if (isDate(value)) {
|
5105 | base = ' ' + Date.prototype.toUTCString.call(value);
|
5106 | }
|
5107 |
|
5108 |
|
5109 | if (isError(value)) {
|
5110 | base = ' ' + formatError(value);
|
5111 | }
|
5112 |
|
5113 | if (keys.length === 0 && (!array || value.length == 0)) {
|
5114 | return braces[0] + base + braces[1];
|
5115 | }
|
5116 |
|
5117 | if (recurseTimes < 0) {
|
5118 | if (isRegExp(value)) {
|
5119 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
5120 | } else {
|
5121 | return ctx.stylize('[Object]', 'special');
|
5122 | }
|
5123 | }
|
5124 |
|
5125 | ctx.seen.push(value);
|
5126 |
|
5127 | var output;
|
5128 | if (array) {
|
5129 | output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
5130 | } else {
|
5131 | output = keys.map(function(key) {
|
5132 | return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
5133 | });
|
5134 | }
|
5135 |
|
5136 | ctx.seen.pop();
|
5137 |
|
5138 | return reduceToSingleString(output, base, braces);
|
5139 | }
|
5140 |
|
5141 |
|
5142 | function formatPrimitive(ctx, value) {
|
5143 | if (isUndefined(value))
|
5144 | return ctx.stylize('undefined', 'undefined');
|
5145 | if (isString(value)) {
|
5146 | var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
5147 | .replace(/'/g, "\\'")
|
5148 | .replace(/\\"/g, '"') + '\'';
|
5149 | return ctx.stylize(simple, 'string');
|
5150 | }
|
5151 | if (isNumber(value))
|
5152 | return ctx.stylize('' + value, 'number');
|
5153 | if (isBoolean(value))
|
5154 | return ctx.stylize('' + value, 'boolean');
|
5155 |
|
5156 | if (isNull(value))
|
5157 | return ctx.stylize('null', 'null');
|
5158 | }
|
5159 |
|
5160 |
|
5161 | function formatError(value) {
|
5162 | return '[' + Error.prototype.toString.call(value) + ']';
|
5163 | }
|
5164 |
|
5165 |
|
5166 | function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
5167 | var output = [];
|
5168 | for (var i = 0, l = value.length; i < l; ++i) {
|
5169 | if (hasOwnProperty(value, String(i))) {
|
5170 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
5171 | String(i), true));
|
5172 | } else {
|
5173 | output.push('');
|
5174 | }
|
5175 | }
|
5176 | keys.forEach(function(key) {
|
5177 | if (!key.match(/^\d+$/)) {
|
5178 | output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
5179 | key, true));
|
5180 | }
|
5181 | });
|
5182 | return output;
|
5183 | }
|
5184 |
|
5185 |
|
5186 | function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
5187 | var name, str, desc;
|
5188 | desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
5189 | if (desc.get) {
|
5190 | if (desc.set) {
|
5191 | str = ctx.stylize('[Getter/Setter]', 'special');
|
5192 | } else {
|
5193 | str = ctx.stylize('[Getter]', 'special');
|
5194 | }
|
5195 | } else {
|
5196 | if (desc.set) {
|
5197 | str = ctx.stylize('[Setter]', 'special');
|
5198 | }
|
5199 | }
|
5200 | if (!hasOwnProperty(visibleKeys, key)) {
|
5201 | name = '[' + key + ']';
|
5202 | }
|
5203 | if (!str) {
|
5204 | if (ctx.seen.indexOf(desc.value) < 0) {
|
5205 | if (isNull(recurseTimes)) {
|
5206 | str = formatValue(ctx, desc.value, null);
|
5207 | } else {
|
5208 | str = formatValue(ctx, desc.value, recurseTimes - 1);
|
5209 | }
|
5210 | if (str.indexOf('\n') > -1) {
|
5211 | if (array) {
|
5212 | str = str.split('\n').map(function(line) {
|
5213 | return ' ' + line;
|
5214 | }).join('\n').substr(2);
|
5215 | } else {
|
5216 | str = '\n' + str.split('\n').map(function(line) {
|
5217 | return ' ' + line;
|
5218 | }).join('\n');
|
5219 | }
|
5220 | }
|
5221 | } else {
|
5222 | str = ctx.stylize('[Circular]', 'special');
|
5223 | }
|
5224 | }
|
5225 | if (isUndefined(name)) {
|
5226 | if (array && key.match(/^\d+$/)) {
|
5227 | return str;
|
5228 | }
|
5229 | name = JSON.stringify('' + key);
|
5230 | if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
5231 | name = name.substr(1, name.length - 2);
|
5232 | name = ctx.stylize(name, 'name');
|
5233 | } else {
|
5234 | name = name.replace(/'/g, "\\'")
|
5235 | .replace(/\\"/g, '"')
|
5236 | .replace(/(^"|"$)/g, "'");
|
5237 | name = ctx.stylize(name, 'string');
|
5238 | }
|
5239 | }
|
5240 |
|
5241 | return name + ': ' + str;
|
5242 | }
|
5243 |
|
5244 |
|
5245 | function reduceToSingleString(output, base, braces) {
|
5246 | var numLinesEst = 0;
|
5247 | var length = output.reduce(function(prev, cur) {
|
5248 | numLinesEst++;
|
5249 | if (cur.indexOf('\n') >= 0) numLinesEst++;
|
5250 | return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
5251 | }, 0);
|
5252 |
|
5253 | if (length > 60) {
|
5254 | return braces[0] +
|
5255 | (base === '' ? '' : base + '\n ') +
|
5256 | ' ' +
|
5257 | output.join(',\n ') +
|
5258 | ' ' +
|
5259 | braces[1];
|
5260 | }
|
5261 |
|
5262 | return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
5263 | }
|
5264 |
|
5265 |
|
5266 |
|
5267 |
|
5268 | function isArray(ar) {
|
5269 | return Array.isArray(ar);
|
5270 | }
|
5271 | exports.isArray = isArray;
|
5272 |
|
5273 | function isBoolean(arg) {
|
5274 | return typeof arg === 'boolean';
|
5275 | }
|
5276 | exports.isBoolean = isBoolean;
|
5277 |
|
5278 | function isNull(arg) {
|
5279 | return arg === null;
|
5280 | }
|
5281 | exports.isNull = isNull;
|
5282 |
|
5283 | function isNullOrUndefined(arg) {
|
5284 | return arg == null;
|
5285 | }
|
5286 | exports.isNullOrUndefined = isNullOrUndefined;
|
5287 |
|
5288 | function isNumber(arg) {
|
5289 | return typeof arg === 'number';
|
5290 | }
|
5291 | exports.isNumber = isNumber;
|
5292 |
|
5293 | function isString(arg) {
|
5294 | return typeof arg === 'string';
|
5295 | }
|
5296 | exports.isString = isString;
|
5297 |
|
5298 | function isSymbol(arg) {
|
5299 | return typeof arg === 'symbol';
|
5300 | }
|
5301 | exports.isSymbol = isSymbol;
|
5302 |
|
5303 | function isUndefined(arg) {
|
5304 | return arg === void 0;
|
5305 | }
|
5306 | exports.isUndefined = isUndefined;
|
5307 |
|
5308 | function isRegExp(re) {
|
5309 | return isObject(re) && objectToString(re) === '[object RegExp]';
|
5310 | }
|
5311 | exports.isRegExp = isRegExp;
|
5312 |
|
5313 | function isObject(arg) {
|
5314 | return typeof arg === 'object' && arg !== null;
|
5315 | }
|
5316 | exports.isObject = isObject;
|
5317 |
|
5318 | function isDate(d) {
|
5319 | return isObject(d) && objectToString(d) === '[object Date]';
|
5320 | }
|
5321 | exports.isDate = isDate;
|
5322 |
|
5323 | function isError(e) {
|
5324 | return isObject(e) &&
|
5325 | (objectToString(e) === '[object Error]' || e instanceof Error);
|
5326 | }
|
5327 | exports.isError = isError;
|
5328 |
|
5329 | function isFunction(arg) {
|
5330 | return typeof arg === 'function';
|
5331 | }
|
5332 | exports.isFunction = isFunction;
|
5333 |
|
5334 | function isPrimitive(arg) {
|
5335 | return arg === null ||
|
5336 | typeof arg === 'boolean' ||
|
5337 | typeof arg === 'number' ||
|
5338 | typeof arg === 'string' ||
|
5339 | typeof arg === 'symbol' ||
|
5340 | typeof arg === 'undefined';
|
5341 | }
|
5342 | exports.isPrimitive = isPrimitive;
|
5343 |
|
5344 | exports.isBuffer = require('./support/isBuffer');
|
5345 |
|
5346 | function objectToString(o) {
|
5347 | return Object.prototype.toString.call(o);
|
5348 | }
|
5349 |
|
5350 |
|
5351 | function pad(n) {
|
5352 | return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
5353 | }
|
5354 |
|
5355 |
|
5356 | var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
5357 | 'Oct', 'Nov', 'Dec'];
|
5358 |
|
5359 |
|
5360 | function timestamp() {
|
5361 | var d = new Date();
|
5362 | var time = [pad(d.getHours()),
|
5363 | pad(d.getMinutes()),
|
5364 | pad(d.getSeconds())].join(':');
|
5365 | return [d.getDate(), months[d.getMonth()], time].join(' ');
|
5366 | }
|
5367 |
|
5368 |
|
5369 |
|
5370 | exports.log = function() {
|
5371 | console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
5372 | };
|
5373 |
|
5374 |
|
5375 |
|
5376 |
|
5377 |
|
5378 |
|
5379 |
|
5380 |
|
5381 |
|
5382 |
|
5383 |
|
5384 |
|
5385 |
|
5386 |
|
5387 |
|
5388 | exports.inherits = require('inherits');
|
5389 |
|
5390 | exports._extend = function(origin, add) {
|
5391 |
|
5392 | if (!add || !isObject(add)) return origin;
|
5393 |
|
5394 | var keys = Object.keys(add);
|
5395 | var i = keys.length;
|
5396 | while (i--) {
|
5397 | origin[keys[i]] = add[keys[i]];
|
5398 | }
|
5399 | return origin;
|
5400 | };
|
5401 |
|
5402 | function hasOwnProperty(obj, prop) {
|
5403 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
5404 | }
|
5405 |
|
5406 | }).call(this,require("/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
5407 | },{"./support/isBuffer":25,"/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":15,"inherits":14}],27:[function(require,module,exports){
|
5408 | (function (process){
|
5409 | var defined = require('defined');
|
5410 | var createDefaultStream = require('./lib/default_stream');
|
5411 | var Test = require('./lib/test');
|
5412 | var createResult = require('./lib/results');
|
5413 | var through = require('through');
|
5414 |
|
5415 | var canEmitExit = typeof process !== 'undefined' && process
|
5416 | && typeof process.on === 'function'
|
5417 | ;
|
5418 | var canExit = typeof process !== 'undefined' && process
|
5419 | && typeof process.exit === 'function'
|
5420 | ;
|
5421 |
|
5422 | var nextTick = typeof setImmediate !== 'undefined'
|
5423 | ? setImmediate
|
5424 | : process.nextTick
|
5425 | ;
|
5426 |
|
5427 | exports = module.exports = (function () {
|
5428 | var harness;
|
5429 | var lazyLoad = function () {
|
5430 | return getHarness().apply(this, arguments);
|
5431 | };
|
5432 |
|
5433 | lazyLoad.only = function () {
|
5434 | return getHarness().only.apply(this, arguments);
|
5435 | };
|
5436 |
|
5437 | lazyLoad.createStream = function (opts) {
|
5438 | if (!opts) opts = {};
|
5439 | if (!harness) {
|
5440 | var output = through();
|
5441 | getHarness({ stream: output, objectMode: opts.objectMode });
|
5442 | return output;
|
5443 | }
|
5444 | return harness.createStream(opts);
|
5445 | };
|
5446 |
|
5447 | return lazyLoad
|
5448 |
|
5449 | function getHarness (opts) {
|
5450 | if (!opts) opts = {};
|
5451 | opts.autoclose = !canEmitExit;
|
5452 | if (!harness) harness = createExitHarness(opts);
|
5453 | return harness;
|
5454 | }
|
5455 | })();
|
5456 |
|
5457 | function createExitHarness (conf) {
|
5458 | if (!conf) conf = {};
|
5459 | var harness = createHarness({
|
5460 | autoclose: defined(conf.autoclose, false)
|
5461 | });
|
5462 |
|
5463 | var stream = harness.createStream({ objectMode: conf.objectMode });
|
5464 | var es = stream.pipe(conf.stream || createDefaultStream());
|
5465 | if (canEmitExit) {
|
5466 | es.on('error', function (err) { harness._exitCode = 1 });
|
5467 | }
|
5468 |
|
5469 | var ended = false;
|
5470 | stream.on('end', function () { ended = true });
|
5471 |
|
5472 | if (conf.exit === false) return harness;
|
5473 | if (!canEmitExit || !canExit) return harness;
|
5474 |
|
5475 | var _error;
|
5476 |
|
5477 | process.on('uncaughtException', function (err) {
|
5478 | if (err && err.code === 'EPIPE' && err.errno === 'EPIPE'
|
5479 | && err.syscall === 'write') return;
|
5480 |
|
5481 | _error = err
|
5482 |
|
5483 | throw err
|
5484 | })
|
5485 |
|
5486 | process.on('exit', function (code) {
|
5487 | if (_error) {
|
5488 | return
|
5489 | }
|
5490 |
|
5491 | if (!ended) {
|
5492 | var only = harness._results._only;
|
5493 | for (var i = 0; i < harness._tests.length; i++) {
|
5494 | var t = harness._tests[i];
|
5495 | if (only && t.name !== only) continue;
|
5496 | t._exit();
|
5497 | }
|
5498 | }
|
5499 | harness.close();
|
5500 | process.exit(code || harness._exitCode);
|
5501 | });
|
5502 |
|
5503 | return harness;
|
5504 | }
|
5505 |
|
5506 | exports.createHarness = createHarness;
|
5507 | exports.Test = Test;
|
5508 | exports.test = exports;
|
5509 |
|
5510 | var exitInterval;
|
5511 |
|
5512 | function createHarness (conf_) {
|
5513 | if (!conf_) conf_ = {};
|
5514 | var results = createResult();
|
5515 | if (conf_.autoclose !== false) {
|
5516 | results.once('done', function () { results.close() });
|
5517 | }
|
5518 |
|
5519 | var test = function (name, conf, cb) {
|
5520 | var t = new Test(name, conf, cb);
|
5521 | test._tests.push(t);
|
5522 |
|
5523 | (function inspectCode (st) {
|
5524 | st.on('test', function sub (st_) {
|
5525 | inspectCode(st_);
|
5526 | });
|
5527 | st.on('result', function (r) {
|
5528 | if (!r.ok) test._exitCode = 1
|
5529 | });
|
5530 | })(t);
|
5531 |
|
5532 | results.push(t);
|
5533 | return t;
|
5534 | };
|
5535 | test._results = results;
|
5536 |
|
5537 | test._tests = [];
|
5538 |
|
5539 | test.createStream = function (opts) {
|
5540 | return results.createStream(opts);
|
5541 | };
|
5542 |
|
5543 | var only = false;
|
5544 | test.only = function (name) {
|
5545 | if (only) throw new Error('there can only be one only test');
|
5546 | results.only(name);
|
5547 | only = true;
|
5548 | return test.apply(null, arguments);
|
5549 | };
|
5550 | test._exitCode = 0;
|
5551 |
|
5552 | test.close = function () { results.close() };
|
5553 |
|
5554 | return test;
|
5555 | }
|
5556 |
|
5557 | }).call(this,require("/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))
|
5558 | },{"./lib/default_stream":28,"./lib/results":29,"./lib/test":30,"/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":15,"defined":34,"through":38}],28:[function(require,module,exports){
|
5559 | var through = require('through');
|
5560 |
|
5561 | module.exports = function () {
|
5562 | var line = '';
|
5563 | var stream = through(write, flush);
|
5564 | return stream;
|
5565 |
|
5566 | function write (buf) {
|
5567 | for (var i = 0; i < buf.length; i++) {
|
5568 | var c = typeof buf === 'string'
|
5569 | ? buf.charAt(i)
|
5570 | : String.fromCharCode(buf[i])
|
5571 | ;
|
5572 | if (c === '\n') flush();
|
5573 | else line += c;
|
5574 | }
|
5575 | }
|
5576 |
|
5577 | function flush () {
|
5578 | try { console.log(line); }
|
5579 | catch (e) { stream.emit('error', e) }
|
5580 | line = '';
|
5581 | }
|
5582 | };
|
5583 |
|
5584 | },{"through":38}],29:[function(require,module,exports){
|
5585 | (function (process){
|
5586 | var EventEmitter = require('events').EventEmitter;
|
5587 | var inherits = require('inherits');
|
5588 | var through = require('through');
|
5589 | var resumer = require('resumer');
|
5590 | var inspect = require('object-inspect');
|
5591 | var nextTick = typeof setImmediate !== 'undefined'
|
5592 | ? setImmediate
|
5593 | : process.nextTick
|
5594 | ;
|
5595 |
|
5596 | module.exports = Results;
|
5597 | inherits(Results, EventEmitter);
|
5598 |
|
5599 | function Results () {
|
5600 | if (!(this instanceof Results)) return new Results;
|
5601 | this.count = 0;
|
5602 | this.fail = 0;
|
5603 | this.pass = 0;
|
5604 | this._stream = through();
|
5605 | this.tests = [];
|
5606 | }
|
5607 |
|
5608 | Results.prototype.createStream = function (opts) {
|
5609 | if (!opts) opts = {};
|
5610 | var self = this;
|
5611 | var output, testId = 0;
|
5612 | if (opts.objectMode) {
|
5613 | output = through();
|
5614 | self.on('_push', function ontest (t, extra) {
|
5615 | if (!extra) extra = {};
|
5616 | var id = testId++;
|
5617 | t.once('prerun', function () {
|
5618 | var row = {
|
5619 | type: 'test',
|
5620 | name: t.name,
|
5621 | id: id
|
5622 | };
|
5623 | if (extra.parent) {
|
5624 | row.parent = extra.parent;
|
5625 | }
|
5626 | output.queue(row);
|
5627 | });
|
5628 | t.on('test', function (st) {
|
5629 | ontest(st, { parent: id });
|
5630 | });
|
5631 | t.on('result', function (res) {
|
5632 | res.test = id;
|
5633 | res.type = 'assert';
|
5634 | output.queue(res);
|
5635 | });
|
5636 | t.on('end', function () {
|
5637 | output.queue({ type: 'end', test: id });
|
5638 | });
|
5639 | });
|
5640 | self.on('done', function () { output.queue(null) });
|
5641 | }
|
5642 | else {
|
5643 | output = resumer();
|
5644 | output.queue('TAP version 13\n');
|
5645 | self._stream.pipe(output);
|
5646 | }
|
5647 |
|
5648 | nextTick(function next() {
|
5649 | var t;
|
5650 | while (t = getNextTest(self)) {
|
5651 | t.run();
|
5652 | if (!t.ended) return t.once('end', function(){ nextTick(next); });
|
5653 | }
|
5654 | self.emit('done');
|
5655 | });
|
5656 |
|
5657 | return output;
|
5658 | };
|
5659 |
|
5660 | Results.prototype.push = function (t) {
|
5661 | var self = this;
|
5662 | self.tests.push(t);
|
5663 | self._watch(t);
|
5664 | self.emit('_push', t);
|
5665 | };
|
5666 |
|
5667 | Results.prototype.only = function (name) {
|
5668 | if (this._only) {
|
5669 | self.count ++;
|
5670 | self.fail ++;
|
5671 | write('not ok ' + self.count + ' already called .only()\n');
|
5672 | }
|
5673 | this._only = name;
|
5674 | };
|
5675 |
|
5676 | Results.prototype._watch = function (t) {
|
5677 | var self = this;
|
5678 | var write = function (s) { self._stream.queue(s) };
|
5679 | t.once('prerun', function () {
|
5680 | write('# ' + t.name + '\n');
|
5681 | });
|
5682 |
|
5683 | t.on('result', function (res) {
|
5684 | if (typeof res === 'string') {
|
5685 | write('# ' + res + '\n');
|
5686 | return;
|
5687 | }
|
5688 | write(encodeResult(res, self.count + 1));
|
5689 | self.count ++;
|
5690 |
|
5691 | if (res.ok) self.pass ++
|
5692 | else self.fail ++
|
5693 | });
|
5694 |
|
5695 | t.on('test', function (st) { self._watch(st) });
|
5696 | };
|
5697 |
|
5698 | Results.prototype.close = function () {
|
5699 | var self = this;
|
5700 | if (self.closed) self._stream.emit('error', new Error('ALREADY CLOSED'));
|
5701 | self.closed = true;
|
5702 | var write = function (s) { self._stream.queue(s) };
|
5703 |
|
5704 | write('\n1..' + self.count + '\n');
|
5705 | write('# tests ' + self.count + '\n');
|
5706 | write('# pass ' + self.pass + '\n');
|
5707 | if (self.fail) write('# fail ' + self.fail + '\n')
|
5708 | else write('\n# ok\n')
|
5709 |
|
5710 | self._stream.queue(null);
|
5711 | };
|
5712 |
|
5713 | function encodeResult (res, count) {
|
5714 | var output = '';
|
5715 | output += (res.ok ? 'ok ' : 'not ok ') + count;
|
5716 | output += res.name ? ' ' + res.name.toString().replace(/\s+/g, ' ') : '';
|
5717 |
|
5718 | if (res.skip) output += ' # SKIP';
|
5719 | else if (res.todo) output += ' # TODO';
|
5720 |
|
5721 | output += '\n';
|
5722 | if (res.ok) return output;
|
5723 |
|
5724 | var outer = ' ';
|
5725 | var inner = outer + ' ';
|
5726 | output += outer + '---\n';
|
5727 | output += inner + 'operator: ' + res.operator + '\n';
|
5728 |
|
5729 | if (has(res, 'expected') || has(res, 'actual')) {
|
5730 | var ex = inspect(res.expected);
|
5731 | var ac = inspect(res.actual);
|
5732 |
|
5733 | if (Math.max(ex.length, ac.length) > 65) {
|
5734 | output += inner + 'expected:\n' + inner + ' ' + ex + '\n';
|
5735 | output += inner + 'actual:\n' + inner + ' ' + ac + '\n';
|
5736 | }
|
5737 | else {
|
5738 | output += inner + 'expected: ' + ex + '\n';
|
5739 | output += inner + 'actual: ' + ac + '\n';
|
5740 | }
|
5741 | }
|
5742 | if (res.at) {
|
5743 | output += inner + 'at: ' + res.at + '\n';
|
5744 | }
|
5745 | if (res.operator === 'error' && res.actual && res.actual.stack) {
|
5746 | var lines = String(res.actual.stack).split('\n');
|
5747 | output += inner + 'stack:\n';
|
5748 | output += inner + ' ' + lines[0] + '\n';
|
5749 | for (var i = 1; i < lines.length; i++) {
|
5750 | output += inner + lines[i] + '\n';
|
5751 | }
|
5752 | }
|
5753 |
|
5754 | output += outer + '...\n';
|
5755 | return output;
|
5756 | }
|
5757 |
|
5758 | function getNextTest (results) {
|
5759 | if (!results._only) {
|
5760 | return results.tests.shift();
|
5761 | }
|
5762 |
|
5763 | do {
|
5764 | var t = results.tests.shift();
|
5765 | if (!t) continue;
|
5766 | if (results._only === t.name) {
|
5767 | return t;
|
5768 | }
|
5769 | } while (results.tests.length !== 0)
|
5770 | }
|
5771 |
|
5772 | function has (obj, prop) {
|
5773 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
5774 | }
|
5775 |
|
5776 | }).call(this,require("/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))
|
5777 | },{"/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":15,"events":13,"inherits":35,"object-inspect":36,"resumer":37,"through":38}],30:[function(require,module,exports){
|
5778 | (function (process,__dirname){
|
5779 | var Stream = require('stream');
|
5780 | var deepEqual = require('deep-equal');
|
5781 | var defined = require('defined');
|
5782 | var path = require('path');
|
5783 | var inherits = require('util').inherits;
|
5784 | var EventEmitter = require('events').EventEmitter;
|
5785 |
|
5786 | module.exports = Test;
|
5787 |
|
5788 | var nextTick = typeof setImmediate !== 'undefined'
|
5789 | ? setImmediate
|
5790 | : process.nextTick
|
5791 | ;
|
5792 |
|
5793 | inherits(Test, EventEmitter);
|
5794 |
|
5795 | function Test (name_, opts_, cb_) {
|
5796 | var self = this;
|
5797 | var name = '(anonymous)';
|
5798 | var opts = {};
|
5799 | var cb;
|
5800 |
|
5801 | for (var i = 0; i < arguments.length; i++) {
|
5802 | switch (typeof arguments[i]) {
|
5803 | case 'string':
|
5804 | name = arguments[i];
|
5805 | break;
|
5806 | case 'object':
|
5807 | opts = arguments[i] || opts;
|
5808 | break;
|
5809 | case 'function':
|
5810 | cb = arguments[i];
|
5811 | }
|
5812 | }
|
5813 |
|
5814 | this.readable = true;
|
5815 | this.name = name || '(anonymous)';
|
5816 | this.assertCount = 0;
|
5817 | this.pendingCount = 0;
|
5818 | this._skip = opts.skip || false;
|
5819 | this._plan = undefined;
|
5820 | this._cb = cb;
|
5821 | this._progeny = [];
|
5822 | this._ok = true;
|
5823 | this.end = function () {
|
5824 | return Test.prototype.end.apply(self, arguments);
|
5825 | };
|
5826 | }
|
5827 |
|
5828 | Test.prototype.run = function () {
|
5829 | if (!this._cb || this._skip) {
|
5830 | return this._end();
|
5831 | }
|
5832 | this.emit('prerun');
|
5833 | try {
|
5834 | this._cb(this);
|
5835 | }
|
5836 | catch (err) {
|
5837 | this.error(err);
|
5838 | this._end();
|
5839 | return;
|
5840 | }
|
5841 | this.emit('run');
|
5842 | };
|
5843 |
|
5844 | Test.prototype.test = function (name, opts, cb) {
|
5845 | var self = this;
|
5846 | var t = new Test(name, opts, cb);
|
5847 | this._progeny.push(t);
|
5848 | this.pendingCount++;
|
5849 | this.emit('test', t);
|
5850 | t.on('prerun', function () {
|
5851 | self.assertCount++;
|
5852 | })
|
5853 |
|
5854 | if (!self._pendingAsserts()) {
|
5855 | nextTick(function () {
|
5856 | self._end();
|
5857 | });
|
5858 | }
|
5859 |
|
5860 | nextTick(function() {
|
5861 | if (!self._plan && self.pendingCount == self._progeny.length) {
|
5862 | self._end();
|
5863 | }
|
5864 | });
|
5865 | };
|
5866 |
|
5867 | Test.prototype.comment = function (msg) {
|
5868 | this.emit('result', msg.trim().replace(/^#\s*/, ''));
|
5869 | };
|
5870 |
|
5871 | Test.prototype.plan = function (n) {
|
5872 | this._plan = n;
|
5873 | this.emit('plan', n);
|
5874 | };
|
5875 |
|
5876 | Test.prototype.end = function (err) {
|
5877 | var self = this;
|
5878 | if (arguments.length >= 1) {
|
5879 | this.ifError(err);
|
5880 | }
|
5881 |
|
5882 | if (this.calledEnd) {
|
5883 | this.fail('.end() called twice');
|
5884 | }
|
5885 | this.calledEnd = true;
|
5886 | this._end();
|
5887 | };
|
5888 |
|
5889 | Test.prototype._end = function (err) {
|
5890 | var self = this;
|
5891 | if (this._progeny.length) {
|
5892 | var t = this._progeny.shift();
|
5893 | t.on('end', function () { self._end() });
|
5894 | t.run();
|
5895 | return;
|
5896 | }
|
5897 |
|
5898 | if (!this.ended) this.emit('end');
|
5899 | var pendingAsserts = this._pendingAsserts();
|
5900 | if (!this._planError && this._plan !== undefined && pendingAsserts) {
|
5901 | this._planError = true;
|
5902 | this.fail('plan != count', {
|
5903 | expected : this._plan,
|
5904 | actual : this.assertCount
|
5905 | });
|
5906 | }
|
5907 | this.ended = true;
|
5908 | };
|
5909 |
|
5910 | Test.prototype._exit = function () {
|
5911 | if (this._plan !== undefined &&
|
5912 | !this._planError && this.assertCount !== this._plan) {
|
5913 | this._planError = true;
|
5914 | this.fail('plan != count', {
|
5915 | expected : this._plan,
|
5916 | actual : this.assertCount,
|
5917 | exiting : true
|
5918 | });
|
5919 | }
|
5920 | else if (!this.ended) {
|
5921 | this.fail('test exited without ending', {
|
5922 | exiting: true
|
5923 | });
|
5924 | }
|
5925 | };
|
5926 |
|
5927 | Test.prototype._pendingAsserts = function () {
|
5928 | if (this._plan === undefined) {
|
5929 | return 1;
|
5930 | }
|
5931 | else {
|
5932 | return this._plan - (this._progeny.length + this.assertCount);
|
5933 | }
|
5934 | };
|
5935 |
|
5936 | Test.prototype._assert = function assert (ok, opts) {
|
5937 | var self = this;
|
5938 | var extra = opts.extra || {};
|
5939 |
|
5940 | var res = {
|
5941 | id : self.assertCount ++,
|
5942 | ok : Boolean(ok),
|
5943 | skip : defined(extra.skip, opts.skip),
|
5944 | name : defined(extra.message, opts.message, '(unnamed assert)'),
|
5945 | operator : defined(extra.operator, opts.operator)
|
5946 | };
|
5947 | if (has(opts, 'actual') || has(extra, 'actual')) {
|
5948 | res.actual = defined(extra.actual, opts.actual);
|
5949 | }
|
5950 | if (has(opts, 'expected') || has(extra, 'expected')) {
|
5951 | res.expected = defined(extra.expected, opts.expected);
|
5952 | }
|
5953 | this._ok = Boolean(this._ok && ok);
|
5954 |
|
5955 | if (!ok) {
|
5956 | res.error = defined(extra.error, opts.error, new Error(res.name));
|
5957 | }
|
5958 |
|
5959 | var e = new Error('exception');
|
5960 | var err = (e.stack || '').split('\n');
|
5961 | var dir = path.dirname(__dirname) + '/';
|
5962 |
|
5963 | for (var i = 0; i < err.length; i++) {
|
5964 | var m = /^\s*\bat\s+(.+)/.exec(err[i]);
|
5965 | if (!m) continue;
|
5966 |
|
5967 | var s = m[1].split(/\s+/);
|
5968 | var filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[1]);
|
5969 | if (!filem) {
|
5970 | filem = /(\/[^:\s]+:(\d+)(?::(\d+))?)/.exec(s[3]);
|
5971 |
|
5972 | if (!filem) continue;
|
5973 | }
|
5974 |
|
5975 | if (filem[1].slice(0, dir.length) === dir) continue;
|
5976 |
|
5977 | res.functionName = s[0];
|
5978 | res.file = filem[1];
|
5979 | res.line = Number(filem[2]);
|
5980 | if (filem[3]) res.column = filem[3];
|
5981 |
|
5982 | res.at = m[1];
|
5983 | break;
|
5984 | }
|
5985 |
|
5986 | self.emit('result', res);
|
5987 |
|
5988 | var pendingAsserts = self._pendingAsserts();
|
5989 | if (!pendingAsserts) {
|
5990 | if (extra.exiting) {
|
5991 | self._end();
|
5992 | } else {
|
5993 | nextTick(function () {
|
5994 | self._end();
|
5995 | });
|
5996 | }
|
5997 | }
|
5998 |
|
5999 | if (!self._planError && pendingAsserts < 0) {
|
6000 | self._planError = true;
|
6001 | self.fail('plan != count', {
|
6002 | expected : self._plan,
|
6003 | actual : self._plan - pendingAsserts
|
6004 | });
|
6005 | }
|
6006 | };
|
6007 |
|
6008 | Test.prototype.fail = function (msg, extra) {
|
6009 | this._assert(false, {
|
6010 | message : msg,
|
6011 | operator : 'fail',
|
6012 | extra : extra
|
6013 | });
|
6014 | };
|
6015 |
|
6016 | Test.prototype.pass = function (msg, extra) {
|
6017 | this._assert(true, {
|
6018 | message : msg,
|
6019 | operator : 'pass',
|
6020 | extra : extra
|
6021 | });
|
6022 | };
|
6023 |
|
6024 | Test.prototype.skip = function (msg, extra) {
|
6025 | this._assert(true, {
|
6026 | message : msg,
|
6027 | operator : 'skip',
|
6028 | skip : true,
|
6029 | extra : extra
|
6030 | });
|
6031 | };
|
6032 |
|
6033 | Test.prototype.ok
|
6034 | = Test.prototype['true']
|
6035 | = Test.prototype.assert
|
6036 | = function (value, msg, extra) {
|
6037 | this._assert(value, {
|
6038 | message : msg,
|
6039 | operator : 'ok',
|
6040 | expected : true,
|
6041 | actual : value,
|
6042 | extra : extra
|
6043 | });
|
6044 | };
|
6045 |
|
6046 | Test.prototype.notOk
|
6047 | = Test.prototype['false']
|
6048 | = Test.prototype.notok
|
6049 | = function (value, msg, extra) {
|
6050 | this._assert(!value, {
|
6051 | message : msg,
|
6052 | operator : 'notOk',
|
6053 | expected : false,
|
6054 | actual : value,
|
6055 | extra : extra
|
6056 | });
|
6057 | };
|
6058 |
|
6059 | Test.prototype.error
|
6060 | = Test.prototype.ifError
|
6061 | = Test.prototype.ifErr
|
6062 | = Test.prototype.iferror
|
6063 | = function (err, msg, extra) {
|
6064 | this._assert(!err, {
|
6065 | message : defined(msg, String(err)),
|
6066 | operator : 'error',
|
6067 | actual : err,
|
6068 | extra : extra
|
6069 | });
|
6070 | };
|
6071 |
|
6072 | Test.prototype.equal
|
6073 | = Test.prototype.equals
|
6074 | = Test.prototype.isEqual
|
6075 | = Test.prototype.is
|
6076 | = Test.prototype.strictEqual
|
6077 | = Test.prototype.strictEquals
|
6078 | = function (a, b, msg, extra) {
|
6079 | this._assert(a === b, {
|
6080 | message : defined(msg, 'should be equal'),
|
6081 | operator : 'equal',
|
6082 | actual : a,
|
6083 | expected : b,
|
6084 | extra : extra
|
6085 | });
|
6086 | };
|
6087 |
|
6088 | Test.prototype.notEqual
|
6089 | = Test.prototype.notEquals
|
6090 | = Test.prototype.notStrictEqual
|
6091 | = Test.prototype.notStrictEquals
|
6092 | = Test.prototype.isNotEqual
|
6093 | = Test.prototype.isNot
|
6094 | = Test.prototype.not
|
6095 | = Test.prototype.doesNotEqual
|
6096 | = Test.prototype.isInequal
|
6097 | = function (a, b, msg, extra) {
|
6098 | this._assert(a !== b, {
|
6099 | message : defined(msg, 'should not be equal'),
|
6100 | operator : 'notEqual',
|
6101 | actual : a,
|
6102 | notExpected : b,
|
6103 | extra : extra
|
6104 | });
|
6105 | };
|
6106 |
|
6107 | Test.prototype.deepEqual
|
6108 | = Test.prototype.deepEquals
|
6109 | = Test.prototype.isEquivalent
|
6110 | = Test.prototype.same
|
6111 | = function (a, b, msg, extra) {
|
6112 | this._assert(deepEqual(a, b, { strict: true }), {
|
6113 | message : defined(msg, 'should be equivalent'),
|
6114 | operator : 'deepEqual',
|
6115 | actual : a,
|
6116 | expected : b,
|
6117 | extra : extra
|
6118 | });
|
6119 | };
|
6120 |
|
6121 | Test.prototype.deepLooseEqual
|
6122 | = Test.prototype.looseEqual
|
6123 | = Test.prototype.looseEquals
|
6124 | = function (a, b, msg, extra) {
|
6125 | this._assert(deepEqual(a, b), {
|
6126 | message : defined(msg, 'should be equivalent'),
|
6127 | operator : 'deepLooseEqual',
|
6128 | actual : a,
|
6129 | expected : b,
|
6130 | extra : extra
|
6131 | });
|
6132 | };
|
6133 |
|
6134 | Test.prototype.notDeepEqual
|
6135 | = Test.prototype.notEquivalent
|
6136 | = Test.prototype.notDeeply
|
6137 | = Test.prototype.notSame
|
6138 | = Test.prototype.isNotDeepEqual
|
6139 | = Test.prototype.isNotDeeply
|
6140 | = Test.prototype.isNotEquivalent
|
6141 | = Test.prototype.isInequivalent
|
6142 | = function (a, b, msg, extra) {
|
6143 | this._assert(!deepEqual(a, b, { strict: true }), {
|
6144 | message : defined(msg, 'should not be equivalent'),
|
6145 | operator : 'notDeepEqual',
|
6146 | actual : a,
|
6147 | notExpected : b,
|
6148 | extra : extra
|
6149 | });
|
6150 | };
|
6151 |
|
6152 | Test.prototype.notDeepLooseEqual
|
6153 | = Test.prototype.notLooseEqual
|
6154 | = Test.prototype.notLooseEquals
|
6155 | = function (a, b, msg, extra) {
|
6156 | this._assert(deepEqual(a, b), {
|
6157 | message : defined(msg, 'should be equivalent'),
|
6158 | operator : 'notDeepLooseEqual',
|
6159 | actual : a,
|
6160 | expected : b,
|
6161 | extra : extra
|
6162 | });
|
6163 | };
|
6164 |
|
6165 | Test.prototype['throws'] = function (fn, expected, msg, extra) {
|
6166 | if (typeof expected === 'string') {
|
6167 | msg = expected;
|
6168 | expected = undefined;
|
6169 | }
|
6170 | var caught = undefined;
|
6171 | try {
|
6172 | fn();
|
6173 | }
|
6174 | catch (err) {
|
6175 | caught = { error : err };
|
6176 | var message = err.message;
|
6177 | delete err.message;
|
6178 | err.message = message;
|
6179 | }
|
6180 |
|
6181 | var passed = caught;
|
6182 |
|
6183 | if (expected instanceof RegExp) {
|
6184 | passed = expected.test(caught && caught.error);
|
6185 | expected = String(expected);
|
6186 | }
|
6187 |
|
6188 | this._assert(passed, {
|
6189 | message : defined(msg, 'should throw'),
|
6190 | operator : 'throws',
|
6191 | actual : caught && caught.error,
|
6192 | expected : expected,
|
6193 | error: !passed && caught && caught.error,
|
6194 | extra : extra
|
6195 | });
|
6196 | };
|
6197 |
|
6198 | Test.prototype.doesNotThrow = function (fn, expected, msg, extra) {
|
6199 | if (typeof expected === 'string') {
|
6200 | msg = expected;
|
6201 | expected = undefined;
|
6202 | }
|
6203 | var caught = undefined;
|
6204 | try {
|
6205 | fn();
|
6206 | }
|
6207 | catch (err) {
|
6208 | caught = { error : err };
|
6209 | }
|
6210 | this._assert(!caught, {
|
6211 | message : defined(msg, 'should not throw'),
|
6212 | operator : 'throws',
|
6213 | actual : caught && caught.error,
|
6214 | expected : expected,
|
6215 | error : caught && caught.error,
|
6216 | extra : extra
|
6217 | });
|
6218 | };
|
6219 |
|
6220 | function has (obj, prop) {
|
6221 | return Object.prototype.hasOwnProperty.call(obj, prop);
|
6222 | }
|
6223 |
|
6224 |
|
6225 |
|
6226 | }).call(this,require("/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/../node_modules/tape/lib")
|
6227 | },{"/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":15,"deep-equal":31,"defined":34,"events":13,"path":16,"stream":18,"util":26}],31:[function(require,module,exports){
|
6228 | var pSlice = Array.prototype.slice;
|
6229 | var objectKeys = require('./lib/keys.js');
|
6230 | var isArguments = require('./lib/is_arguments.js');
|
6231 |
|
6232 | var deepEqual = module.exports = function (actual, expected, opts) {
|
6233 | if (!opts) opts = {};
|
6234 |
|
6235 | if (actual === expected) {
|
6236 | return true;
|
6237 |
|
6238 | } else if (actual instanceof Date && expected instanceof Date) {
|
6239 | return actual.getTime() === expected.getTime();
|
6240 |
|
6241 |
|
6242 |
|
6243 | } else if (typeof actual != 'object' && typeof expected != 'object') {
|
6244 | return opts.strict ? actual === expected : actual == expected;
|
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 | } else {
|
6253 | return objEquiv(actual, expected, opts);
|
6254 | }
|
6255 | }
|
6256 |
|
6257 | function isUndefinedOrNull(value) {
|
6258 | return value === null || value === undefined;
|
6259 | }
|
6260 |
|
6261 | function isBuffer (x) {
|
6262 | if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
|
6263 | if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
|
6264 | return false;
|
6265 | }
|
6266 | if (x.length > 0 && typeof x[0] !== 'number') return false;
|
6267 | return true;
|
6268 | }
|
6269 |
|
6270 | function objEquiv(a, b, opts) {
|
6271 | var i, key;
|
6272 | if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
|
6273 | return false;
|
6274 |
|
6275 | if (a.prototype !== b.prototype) return false;
|
6276 |
|
6277 |
|
6278 | if (isArguments(a)) {
|
6279 | if (!isArguments(b)) {
|
6280 | return false;
|
6281 | }
|
6282 | a = pSlice.call(a);
|
6283 | b = pSlice.call(b);
|
6284 | return deepEqual(a, b, opts);
|
6285 | }
|
6286 | if (isBuffer(a)) {
|
6287 | if (!isBuffer(b)) {
|
6288 | return false;
|
6289 | }
|
6290 | if (a.length !== b.length) return false;
|
6291 | for (i = 0; i < a.length; i++) {
|
6292 | if (a[i] !== b[i]) return false;
|
6293 | }
|
6294 | return true;
|
6295 | }
|
6296 | try {
|
6297 | var ka = objectKeys(a),
|
6298 | kb = objectKeys(b);
|
6299 | } catch (e) {
|
6300 | return false;
|
6301 | }
|
6302 |
|
6303 |
|
6304 | if (ka.length != kb.length)
|
6305 | return false;
|
6306 |
|
6307 | ka.sort();
|
6308 | kb.sort();
|
6309 |
|
6310 | for (i = ka.length - 1; i >= 0; i--) {
|
6311 | if (ka[i] != kb[i])
|
6312 | return false;
|
6313 | }
|
6314 |
|
6315 |
|
6316 | for (i = ka.length - 1; i >= 0; i--) {
|
6317 | key = ka[i];
|
6318 | if (!deepEqual(a[key], b[key], opts)) return false;
|
6319 | }
|
6320 | return true;
|
6321 | }
|
6322 |
|
6323 | },{"./lib/is_arguments.js":32,"./lib/keys.js":33}],32:[function(require,module,exports){
|
6324 | var supportsArgumentsClass = (function(){
|
6325 | return Object.prototype.toString.call(arguments)
|
6326 | })() == '[object Arguments]';
|
6327 |
|
6328 | exports = module.exports = supportsArgumentsClass ? supported : unsupported;
|
6329 |
|
6330 | exports.supported = supported;
|
6331 | function supported(object) {
|
6332 | return Object.prototype.toString.call(object) == '[object Arguments]';
|
6333 | };
|
6334 |
|
6335 | exports.unsupported = unsupported;
|
6336 | function unsupported(object){
|
6337 | return object &&
|
6338 | typeof object == 'object' &&
|
6339 | typeof object.length == 'number' &&
|
6340 | Object.prototype.hasOwnProperty.call(object, 'callee') &&
|
6341 | !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
|
6342 | false;
|
6343 | };
|
6344 |
|
6345 | },{}],33:[function(require,module,exports){
|
6346 | exports = module.exports = typeof Object.keys === 'function'
|
6347 | ? Object.keys : shim;
|
6348 |
|
6349 | exports.shim = shim;
|
6350 | function shim (obj) {
|
6351 | var keys = [];
|
6352 | for (var key in obj) keys.push(key);
|
6353 | return keys;
|
6354 | }
|
6355 |
|
6356 | },{}],34:[function(require,module,exports){
|
6357 | module.exports = function () {
|
6358 | for (var i = 0; i < arguments.length; i++) {
|
6359 | if (arguments[i] !== undefined) return arguments[i];
|
6360 | }
|
6361 | };
|
6362 |
|
6363 | },{}],35:[function(require,module,exports){
|
6364 | module.exports=require(14)
|
6365 | },{}],36:[function(require,module,exports){
|
6366 | module.exports = function inspect_ (obj, opts, depth, seen) {
|
6367 | if (!opts) opts = {};
|
6368 |
|
6369 | var maxDepth = opts.depth === undefined ? 5 : opts.depth;
|
6370 | if (depth === undefined) depth = 0;
|
6371 | if (depth > maxDepth && maxDepth > 0) return '...';
|
6372 |
|
6373 | if (seen === undefined) seen = [];
|
6374 | else if (indexOf(seen, obj) >= 0) {
|
6375 | return '[Circular]';
|
6376 | }
|
6377 |
|
6378 | function inspect (value, from) {
|
6379 | if (from) {
|
6380 | seen = seen.slice();
|
6381 | seen.push(from);
|
6382 | }
|
6383 | return inspect_(value, opts, depth + 1, seen);
|
6384 | }
|
6385 |
|
6386 | if (typeof obj === 'string') {
|
6387 | return "'" + obj.replace(/(['\\])/g, '\\$1') + "'";
|
6388 | }
|
6389 | else if (typeof obj === 'function') {
|
6390 | var name = nameOf(obj);
|
6391 | return '[Function' + (name ? ': ' + name : '') + ']';
|
6392 | }
|
6393 | else if (obj === null) {
|
6394 | return 'null';
|
6395 | }
|
6396 | else if (isElement(obj)) {
|
6397 | var s = '<' + String(obj.nodeName).toLowerCase();
|
6398 | var attrs = obj.attributes || [];
|
6399 | for (var i = 0; i < attrs.length; i++) {
|
6400 | s += ' ' + attrs[i].name + '="' + quote(attrs[i].value) + '"';
|
6401 | }
|
6402 | s += '>';
|
6403 | if (obj.childNodes && obj.childNodes.length) s += '...';
|
6404 | s += '</' + String(obj.tagName).toLowerCase() + '>';
|
6405 | return s;
|
6406 | }
|
6407 | else if (isArray(obj)) {
|
6408 | if (obj.length === 0) return '[]';
|
6409 | var xs = Array(obj.length);
|
6410 | for (var i = 0; i < obj.length; i++) {
|
6411 | xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
|
6412 | }
|
6413 | return '[ ' + xs.join(', ') + ' ]';
|
6414 | }
|
6415 | else if (typeof obj === 'object' && typeof obj.inspect === 'function') {
|
6416 | return obj.inspect();
|
6417 | }
|
6418 | else if (typeof obj === 'object' && !isDate(obj) && !isRegExp(obj)) {
|
6419 | var xs = [], keys = [];
|
6420 | for (var key in obj) {
|
6421 | if (has(obj, key)) keys.push(key);
|
6422 | }
|
6423 | keys.sort();
|
6424 | for (var i = 0; i < keys.length; i++) {
|
6425 | var key = keys[i];
|
6426 | if (/[^\w$]/.test(key)) {
|
6427 | xs.push(inspect(key) + ': ' + inspect(obj[key], obj));
|
6428 | }
|
6429 | else xs.push(key + ': ' + inspect(obj[key], obj));
|
6430 | }
|
6431 | if (xs.length === 0) return '{}';
|
6432 | return '{ ' + xs.join(', ') + ' }';
|
6433 | }
|
6434 | else return String(obj);
|
6435 | };
|
6436 |
|
6437 | function quote (s) {
|
6438 | return String(s).replace(/"/g, '"');
|
6439 | }
|
6440 |
|
6441 | function isArray (obj) {
|
6442 | return {}.toString.call(obj) === '[object Array]';
|
6443 | }
|
6444 |
|
6445 | function isDate (obj) {
|
6446 | return {}.toString.call(obj) === '[object Date]';
|
6447 | }
|
6448 |
|
6449 | function isRegExp (obj) {
|
6450 | return {}.toString.call(obj) === '[object RegExp]';
|
6451 | }
|
6452 |
|
6453 | function has (obj, key) {
|
6454 | if (!{}.hasOwnProperty) return key in obj;
|
6455 | return {}.hasOwnProperty.call(obj, key);
|
6456 | }
|
6457 |
|
6458 | function nameOf (f) {
|
6459 | if (f.name) return f.name;
|
6460 | var m = f.toString().match(/^function\s*([\w$]+)/);
|
6461 | if (m) return m[1];
|
6462 | }
|
6463 |
|
6464 | function indexOf (xs, x) {
|
6465 | if (xs.indexOf) return xs.indexOf(x);
|
6466 | for (var i = 0, l = xs.length; i < l; i++) {
|
6467 | if (xs[i] === x) return i;
|
6468 | }
|
6469 | return -1;
|
6470 | }
|
6471 |
|
6472 | function isElement (x) {
|
6473 | if (!x || typeof x !== 'object') return false;
|
6474 | if (typeof HTMLElement !== 'undefined') {
|
6475 | return x instanceof HTMLElement;
|
6476 | }
|
6477 | else return typeof x.nodeName === 'string'
|
6478 | && typeof x.getAttribute === 'function'
|
6479 | ;
|
6480 | }
|
6481 |
|
6482 | },{}],37:[function(require,module,exports){
|
6483 | (function (process){
|
6484 | var through = require('through');
|
6485 | var nextTick = typeof setImmediate !== 'undefined'
|
6486 | ? setImmediate
|
6487 | : process.nextTick
|
6488 | ;
|
6489 |
|
6490 | module.exports = function (write, end) {
|
6491 | var tr = through(write, end);
|
6492 | tr.pause();
|
6493 | var resume = tr.resume;
|
6494 | var pause = tr.pause;
|
6495 | var paused = false;
|
6496 |
|
6497 | tr.pause = function () {
|
6498 | paused = true;
|
6499 | return pause.apply(this, arguments);
|
6500 | };
|
6501 |
|
6502 | tr.resume = function () {
|
6503 | paused = false;
|
6504 | return resume.apply(this, arguments);
|
6505 | };
|
6506 |
|
6507 | nextTick(function () {
|
6508 | if (!paused) tr.resume();
|
6509 | });
|
6510 |
|
6511 | return tr;
|
6512 | };
|
6513 |
|
6514 | }).call(this,require("/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))
|
6515 | },{"/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":15,"through":38}],38:[function(require,module,exports){
|
6516 | (function (process){
|
6517 | var Stream = require('stream')
|
6518 |
|
6519 |
|
6520 |
|
6521 |
|
6522 |
|
6523 |
|
6524 | exports = module.exports = through
|
6525 | through.through = through
|
6526 |
|
6527 |
|
6528 |
|
6529 | function through (write, end, opts) {
|
6530 | write = write || function (data) { this.queue(data) }
|
6531 | end = end || function () { this.queue(null) }
|
6532 |
|
6533 | var ended = false, destroyed = false, buffer = [], _ended = false
|
6534 | var stream = new Stream()
|
6535 | stream.readable = stream.writable = true
|
6536 | stream.paused = false
|
6537 |
|
6538 |
|
6539 | stream.autoDestroy = !(opts && opts.autoDestroy === false)
|
6540 |
|
6541 | stream.write = function (data) {
|
6542 | write.call(this, data)
|
6543 | return !stream.paused
|
6544 | }
|
6545 |
|
6546 | function drain() {
|
6547 | while(buffer.length && !stream.paused) {
|
6548 | var data = buffer.shift()
|
6549 | if(null === data)
|
6550 | return stream.emit('end')
|
6551 | else
|
6552 | stream.emit('data', data)
|
6553 | }
|
6554 | }
|
6555 |
|
6556 | stream.queue = stream.push = function (data) {
|
6557 |
|
6558 | if(_ended) return stream
|
6559 | if(data == null) _ended = true
|
6560 | buffer.push(data)
|
6561 | drain()
|
6562 | return stream
|
6563 | }
|
6564 |
|
6565 |
|
6566 |
|
6567 |
|
6568 |
|
6569 |
|
6570 |
|
6571 | stream.on('end', function () {
|
6572 | stream.readable = false
|
6573 | if(!stream.writable && stream.autoDestroy)
|
6574 | process.nextTick(function () {
|
6575 | stream.destroy()
|
6576 | })
|
6577 | })
|
6578 |
|
6579 | function _end () {
|
6580 | stream.writable = false
|
6581 | end.call(stream)
|
6582 | if(!stream.readable && stream.autoDestroy)
|
6583 | stream.destroy()
|
6584 | }
|
6585 |
|
6586 | stream.end = function (data) {
|
6587 | if(ended) return
|
6588 | ended = true
|
6589 | if(arguments.length) stream.write(data)
|
6590 | _end()
|
6591 | return stream
|
6592 | }
|
6593 |
|
6594 | stream.destroy = function () {
|
6595 | if(destroyed) return
|
6596 | destroyed = true
|
6597 | ended = true
|
6598 | buffer.length = 0
|
6599 | stream.writable = stream.readable = false
|
6600 | stream.emit('close')
|
6601 | return stream
|
6602 | }
|
6603 |
|
6604 | stream.pause = function () {
|
6605 | if(stream.paused) return
|
6606 | stream.paused = true
|
6607 | return stream
|
6608 | }
|
6609 |
|
6610 | stream.resume = function () {
|
6611 | if(stream.paused) {
|
6612 | stream.paused = false
|
6613 | stream.emit('resume')
|
6614 | }
|
6615 | drain()
|
6616 |
|
6617 |
|
6618 | if(!stream.paused)
|
6619 | stream.emit('drain')
|
6620 | return stream
|
6621 | }
|
6622 | return stream
|
6623 | }
|
6624 |
|
6625 |
|
6626 | }).call(this,require("/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))
|
6627 | },{"/Users/scott/Code/object-hash/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":15,"stream":18}],39:[function(require,module,exports){
|
6628 | var test = require('tape');
|
6629 | var hash = require('../index');
|
6630 | var validSha1 = /^[0-9a-f]{40}$/i;
|
6631 |
|
6632 | test('throws when nothing to hash', function (assert) {
|
6633 | assert.plan(2);
|
6634 | assert.throws(hash, 'no arguments');
|
6635 | assert.throws(function(){
|
6636 | hash(undefined, {algorithm: 'md5'});
|
6637 | }, 'undefined');
|
6638 | });
|
6639 |
|
6640 | test('throws when passed an invalid options', function(assert){
|
6641 | assert.plan(2);
|
6642 | assert.throws(function(){
|
6643 | hash({foo: 'bar'}, {algorithm: 'shalala'});
|
6644 | }, 'bad algorithm');
|
6645 | assert.throws(function(){
|
6646 | hash({foo: 'bar'}, {encoding: 'base16'});
|
6647 | }, 'bad encoding');
|
6648 | });
|
6649 |
|
6650 | test('hashes non-object types', function(assert){
|
6651 | assert.plan(4);
|
6652 | var func = function(a){ return a + 1; };
|
6653 | assert.ok(validSha1.test(hash('Shazbot!')), 'hash string');
|
6654 | assert.ok(validSha1.test(hash(42)), 'hash number');
|
6655 | assert.ok(validSha1.test(hash(true)), 'hash bool');
|
6656 | assert.ok(validSha1.test(hash(func)), 'hash function');
|
6657 | });
|
6658 |
|
6659 | test('hashes special object types', function(assert){
|
6660 | assert.plan(8);
|
6661 | var dt = new Date();
|
6662 | dt.setDate(dt.getDate() + 1);
|
6663 |
|
6664 | assert.ok(validSha1.test(hash([1,2,3,4])), 'hash array');
|
6665 | assert.notEqual(hash([1,2,3,4]), hash([4,3,2,1]), 'different arrays not equal');
|
6666 | assert.ok(validSha1.test(hash(new Date())), 'hash date');
|
6667 | assert.notEqual(hash(new Date()), hash(dt), 'different dates not equal');
|
6668 | assert.ok(validSha1.test(hash(null)), 'hash Null');
|
6669 | assert.ok(validSha1.test(hash(Number.NaN)), 'hash NaN');
|
6670 | assert.ok(validSha1.test(hash({ foo: undefined })), 'hash Undefined value');
|
6671 | assert.ok(validSha1.test(hash(new RegExp())), 'hash regex');
|
6672 | });
|
6673 |
|
6674 | test('hashes a simple object', function(assert){
|
6675 | assert.plan(1);
|
6676 | assert.ok(validSha1.test(hash({foo: 'bar', bar: 'baz'})), 'hash object');
|
6677 | });
|
6678 |
|
6679 | test('hashes identical objects with different key ordering', function(assert){
|
6680 | assert.plan(2);
|
6681 | var hash1 = hash({foo: 'bar', bar: 'baz'});
|
6682 | var hash2 = hash({bar: 'baz', foo: 'bar'});
|
6683 | var hash3 = hash({bar: 'foo', foo: 'baz'});
|
6684 | assert.equal(hash1, hash2, 'hashes are equal');
|
6685 | assert.notEqual(hash1, hash3, 'different objects not equal');
|
6686 | });
|
6687 |
|
6688 | test('only hashes object keys when excludeValues option is set', function(assert){
|
6689 | assert.plan(2);
|
6690 | var hash1 = hash({foo: false, bar: 'OK'}, { excludeValues: true });
|
6691 | var hash2 = hash({foo: true, bar: 'NO'}, { excludeValues: true });
|
6692 | var hash3 = hash({foo: true, bar: 'OK', baz: false}, { excludeValues: true });
|
6693 | assert.equal(hash1, hash2, 'values not in hash digest');
|
6694 | assert.notEqual(hash1, hash3, 'different keys not equal');
|
6695 | });
|
6696 |
|
6697 | test('array values are hashed', function(assert){
|
6698 | assert.plan(1);
|
6699 | var hash1 = hash({foo: ['bar', 'baz'], bax: true });
|
6700 | var hash2 = hash({foo: ['baz', 'bar'], bax: true });
|
6701 | assert.notEqual(hash1, hash2, 'different array orders are unique');
|
6702 | });
|
6703 |
|
6704 | test('nested object values are hashed', function(assert){
|
6705 | assert.plan(2);
|
6706 | var hash1 = hash({foo: {bar: true, bax: 1}});
|
6707 | var hash2 = hash({foo: {bar: true, bax: 1}});
|
6708 | var hash3 = hash({foo: {bar: false, bax: 1}});
|
6709 | assert.equal(hash1, hash2, 'hashes are equal');
|
6710 | assert.notEqual(hash1, hash3, 'different objects not equal');
|
6711 | });
|
6712 |
|
6713 | test('sugar methods should be equivalent', function(assert){
|
6714 | assert.plan(3);
|
6715 | var obj = {foo: 'bar', baz: true};
|
6716 | assert.equal(hash.keys(obj), hash(obj, {excludeValues: true}), 'keys');
|
6717 | assert.equal(hash.MD5(obj), hash(obj, {algorithm: 'md5'}), 'md5');
|
6718 | assert.equal(hash.keysMD5(obj),
|
6719 | hash(obj, {algorithm: 'md5', excludeValues: true}), 'keys md5');
|
6720 | });
|
6721 |
|
6722 |
|
6723 | test('array of nested object values are hashed', function(assert){
|
6724 | assert.plan(2);
|
6725 | var hash1 = hash({foo: [ {bar: true, bax: 1}, {bar: false, bax: 2} ] });
|
6726 | var hash2 = hash({foo: [ {bar: true, bax: 1}, {bar: false, bax: 2} ] });
|
6727 | var hash3 = hash({foo: [ {bar: false, bax: 2} ] });
|
6728 | assert.equal(hash1, hash2, 'hashes are equal');
|
6729 | assert.notEqual(hash1, hash3, 'different objects not equal');
|
6730 | });
|
6731 |
|
6732 | },{"../index":1,"tape":27}]},{},[39]) |
\ | No newline at end of file |