1
1
! function ( e ) { if ( "object" == typeof exports && "undefined" != typeof module ) module . exports = e ( ) ; else if ( "function" == typeof define && define . amd ) define ( [ ] , e ) ; else { var f ; "undefined" != typeof window ?f = window :"undefined" != typeof global ?f = global :"undefined" != typeof self && ( f = self ) , f . empower = e ( ) } } ( function ( ) { var define , module , exports ; return ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( _dereq_ , module , exports ) {
2
2
/**
3
- * empower.js - Power Assert feature enhancer for assert function/object.
3
+ * empower - Power Assert feature enhancer for assert function/object.
4
4
*
5
5
* https://github.com/twada/empower
6
6
*
7
7
* Copyright (c) 2013-2014 Takuto Wada
8
8
* Licensed under the MIT license.
9
9
* https://github.com/twada/empower/blob/master/MIT-LICENSE.txt
10
10
*/
11
- 'use strict' ;
12
-
13
- var extend = _dereq_ ( 'node.extend' ) ,
14
- escallmatch = _dereq_ ( 'escallmatch' ) ,
15
- isPhantom = typeof window !== 'undefined' && typeof window . callPhantom === 'function' ;
16
-
17
- function defaultOptions ( ) {
18
- return {
19
- destructive : false ,
20
- modifyMessageOnFail : false ,
21
- saveContextOnFail : false ,
22
- targetMethods : {
23
- oneArg : [
24
- 'ok'
25
- ] ,
26
- twoArgs : [
27
- 'equal' ,
28
- 'notEqual' ,
29
- 'strictEqual' ,
30
- 'notStrictEqual' ,
31
- 'deepEqual' ,
32
- 'notDeepEqual'
33
- ]
34
- } ,
35
- patterns : [
36
- 'assert(value, [message])' ,
37
- 'assert.ok(value, [message])' ,
38
- 'assert.equal(actual, expected, [message])' ,
39
- 'assert.notEqual(actual, expected, [message])' ,
40
- 'assert.strictEqual(actual, expected, [message])' ,
41
- 'assert.notStrictEqual(actual, expected, [message])' ,
42
- 'assert.deepEqual(actual, expected, [message])' ,
43
- 'assert.notDeepEqual(actual, expected, [message])'
44
- ]
45
- } ;
46
- }
47
-
11
+ var defaultOptions = _dereq_ ( './lib/default-options' ) ,
12
+ enhancer = _dereq_ ( './lib/enhancer' ) ,
13
+ extend = _dereq_ ( 'node.extend' ) ;
48
14
49
15
/**
50
16
* Enhance Power Assert feature to assert function/object.
@@ -65,38 +31,60 @@ function empower (assert, formatter, options) {
65
31
config = extend ( defaultOptions ( ) , ( options || { } ) ) ;
66
32
switch ( typeOfAssert ) {
67
33
case 'function' :
68
- return empowerAssertFunction ( assert , formatter , config ) ;
34
+ return enhancer . empowerAssertFunction ( assert , formatter , config ) ;
69
35
case 'object' :
70
- return empowerAssertObject ( assert , formatter , config ) ;
36
+ return enhancer . empowerAssertObject ( assert , formatter , config ) ;
71
37
default :
72
38
throw new Error ( 'Cannot be here' ) ;
73
39
}
74
40
}
75
41
76
-
77
42
function isEmpowered ( assertObjectOrFunction ) {
78
43
return ( typeof assertObjectOrFunction . _capt === 'function' ) && ( typeof assertObjectOrFunction . _expr === 'function' ) ;
79
44
}
80
45
46
+ empower . defaultOptions = defaultOptions ;
47
+ module . exports = empower ;
81
48
82
- function empowerAssertObject ( assertObject , formatter , config ) {
83
- var enhancement = enhance ( assertObject , formatter , config ) ,
84
- target = config . destructive ? assertObject : Object . create ( assertObject ) ;
85
- return extend ( target , enhancement ) ;
86
- }
49
+ } , { "./lib/default-options" :2 , "./lib/enhancer" :4 , "node.extend" :15 } ] , 2 :[ function ( _dereq_ , module , exports ) {
50
+ 'use strict' ;
87
51
52
+ module . exports = function defaultOptions ( ) {
53
+ return {
54
+ destructive : false ,
55
+ modifyMessageOnFail : false ,
56
+ saveContextOnFail : false ,
57
+ targetMethods : {
58
+ oneArg : [
59
+ 'ok'
60
+ ] ,
61
+ twoArgs : [
62
+ 'equal' ,
63
+ 'notEqual' ,
64
+ 'strictEqual' ,
65
+ 'notStrictEqual' ,
66
+ 'deepEqual' ,
67
+ 'notDeepEqual'
68
+ ]
69
+ } ,
70
+ patterns : [
71
+ 'assert(value, [message])' ,
72
+ 'assert.ok(value, [message])' ,
73
+ 'assert.equal(actual, expected, [message])' ,
74
+ 'assert.notEqual(actual, expected, [message])' ,
75
+ 'assert.strictEqual(actual, expected, [message])' ,
76
+ 'assert.notStrictEqual(actual, expected, [message])' ,
77
+ 'assert.deepEqual(actual, expected, [message])' ,
78
+ 'assert.notDeepEqual(actual, expected, [message])'
79
+ ]
80
+ } ;
81
+ } ;
88
82
89
- function empowerAssertFunction ( assertFunction , formatter , config ) {
90
- if ( config . destructive ) {
91
- throw new Error ( 'cannot use destructive:true to function.' ) ;
92
- }
93
- var enhancement = enhance ( assertFunction , formatter , config ) ,
94
- powerAssert = function powerAssert ( context , message ) {
95
- enhancement ( context , message ) ;
96
- } ;
97
- extend ( powerAssert , assertFunction ) ;
98
- return extend ( powerAssert , enhancement ) ;
99
- }
83
+ } , { } ] , 3 :[ function ( _dereq_ , module , exports ) {
84
+ 'use strict' ;
85
+
86
+ var escallmatch = _dereq_ ( 'escallmatch' ) ,
87
+ isPhantom = typeof window !== 'undefined' && typeof window . callPhantom === 'function' ;
100
88
101
89
102
90
function enhance ( target , formatter , config ) {
@@ -264,11 +252,38 @@ function decorateTwoArgs (target, baseAssert, doPowerAssert) {
264
252
} ;
265
253
}
266
254
255
+ module . exports = enhance ;
267
256
268
- empower . defaultOptions = defaultOptions ;
269
- module . exports = empower ;
257
+ } , { "escallmatch" : 5 } ] , 4 : [ function ( _dereq_ , module , exports ) {
258
+ 'use strict' ;
270
259
271
- } , { "escallmatch" :2 , "node.extend" :12 } ] , 2 :[ function ( _dereq_ , module , exports ) {
260
+ var extend = _dereq_ ( 'node.extend' ) ,
261
+ enhance = _dereq_ ( './enhance' ) ;
262
+
263
+ function empowerAssertObject ( assertObject , formatter , config ) {
264
+ var enhancement = enhance ( assertObject , formatter , config ) ,
265
+ target = config . destructive ? assertObject : Object . create ( assertObject ) ;
266
+ return extend ( target , enhancement ) ;
267
+ }
268
+
269
+ function empowerAssertFunction ( assertFunction , formatter , config ) {
270
+ if ( config . destructive ) {
271
+ throw new Error ( 'cannot use destructive:true to function.' ) ;
272
+ }
273
+ var enhancement = enhance ( assertFunction , formatter , config ) ,
274
+ powerAssert = function powerAssert ( context , message ) {
275
+ enhancement ( context , message ) ;
276
+ } ;
277
+ extend ( powerAssert , assertFunction ) ;
278
+ return extend ( powerAssert , enhancement ) ;
279
+ }
280
+
281
+ module . exports = {
282
+ empowerAssertObject : empowerAssertObject ,
283
+ empowerAssertFunction : empowerAssertFunction
284
+ } ;
285
+
286
+ } , { "./enhance" :3 , "node.extend" :15 } ] , 5 :[ function ( _dereq_ , module , exports ) {
272
287
/**
273
288
* escallmatch:
274
289
* ECMAScript CallExpression matcher made from function/method signature
@@ -436,7 +451,7 @@ function extractExpressionFrom (tree) {
436
451
437
452
module . exports = createMatcher ;
438
453
439
- } , { "deep-equal" :3 , "esprima" :6 , "espurify" :7 , "estraverse" :11 } ] , 3 :[ function ( _dereq_ , module , exports ) {
454
+ } , { "deep-equal" :6 , "esprima" :9 , "espurify" :10 , "estraverse" :14 } ] , 6 :[ function ( _dereq_ , module , exports ) {
440
455
var pSlice = Array . prototype . slice ;
441
456
var objectKeys = _dereq_ ( './lib/keys.js' ) ;
442
457
var isArguments = _dereq_ ( './lib/is_arguments.js' ) ;
@@ -532,7 +547,7 @@ function objEquiv(a, b, opts) {
532
547
return true ;
533
548
}
534
549
535
- } , { "./lib/is_arguments.js" :4 , "./lib/keys.js" :5 } ] , 4 :[ function ( _dereq_ , module , exports ) {
550
+ } , { "./lib/is_arguments.js" :7 , "./lib/keys.js" :8 } ] , 7 :[ function ( _dereq_ , module , exports ) {
536
551
var supportsArgumentsClass = ( function ( ) {
537
552
return Object . prototype . toString . call ( arguments )
538
553
} ) ( ) == '[object Arguments]' ;
@@ -554,7 +569,7 @@ function unsupported(object){
554
569
false ;
555
570
} ;
556
571
557
- } , { } ] , 5 :[ function ( _dereq_ , module , exports ) {
572
+ } , { } ] , 8 :[ function ( _dereq_ , module , exports ) {
558
573
exports = module . exports = typeof Object . keys === 'function'
559
574
? Object . keys : shim ;
560
575
@@ -565,7 +580,7 @@ function shim (obj) {
565
580
return keys ;
566
581
}
567
582
568
- } , { } ] , 6 :[ function ( _dereq_ , module , exports ) {
583
+ } , { } ] , 9 :[ function ( _dereq_ , module , exports ) {
569
584
/*
570
585
Copyright (C) 2013 Ariya Hidayat <[email protected] >
571
586
Copyright (C) 2013 Thaddee Tyl <[email protected] >
@@ -4323,7 +4338,7 @@ parseStatement: true, parseSourceElement: true */
4323
4338
} ) ) ;
4324
4339
/* vim: set sw=4 ts=4 et tw=80 : */
4325
4340
4326
- } , { } ] , 7 :[ function ( _dereq_ , module , exports ) {
4341
+ } , { } ] , 10 :[ function ( _dereq_ , module , exports ) {
4327
4342
/**
4328
4343
* espurify - Clone new AST without extra properties
4329
4344
*
@@ -4365,7 +4380,7 @@ function isSupportedKey (type, key) {
4365
4380
4366
4381
module . exports = espurify ;
4367
4382
4368
- } , { "./lib/ast-deepcopy" :8 , "./lib/ast-properties" :9 , "traverse" :10 } ] , 8 :[ function ( _dereq_ , module , exports ) {
4383
+ } , { "./lib/ast-deepcopy" :11 , "./lib/ast-properties" :12 , "traverse" :13 } ] , 11 :[ function ( _dereq_ , module , exports ) {
4369
4384
/**
4370
4385
* Copyright (C) 2012 Yusuke Suzuki (twitter: @Constellation) and other contributors.
4371
4386
* Released under the BSD license.
@@ -4404,7 +4419,7 @@ function deepCopy (obj) {
4404
4419
4405
4420
module . exports = deepCopy ;
4406
4421
4407
- } , { } ] , 9 :[ function ( _dereq_ , module , exports ) {
4422
+ } , { } ] , 12 :[ function ( _dereq_ , module , exports ) {
4408
4423
module . exports = {
4409
4424
AssignmentExpression : [ 'type' , 'operator' , 'left' , 'right' ] ,
4410
4425
ArrayExpression : [ 'type' , 'elements' ] ,
@@ -4457,7 +4472,7 @@ module.exports = {
4457
4472
YieldExpression : [ 'type' , 'argument' ]
4458
4473
} ;
4459
4474
4460
- } , { } ] , 10 :[ function ( _dereq_ , module , exports ) {
4475
+ } , { } ] , 13 :[ function ( _dereq_ , module , exports ) {
4461
4476
var traverse = module . exports = function ( obj ) {
4462
4477
return new Traverse ( obj ) ;
4463
4478
} ;
@@ -4773,7 +4788,7 @@ var hasOwnProperty = Object.hasOwnProperty || function (obj, key) {
4773
4788
return key in obj ;
4774
4789
} ;
4775
4790
4776
- } , { } ] , 11 :[ function ( _dereq_ , module , exports ) {
4791
+ } , { } ] , 14 :[ function ( _dereq_ , module , exports ) {
4777
4792
/*
4778
4793
Copyright (C) 2012-2013 Yusuke Suzuki <[email protected] >
4779
4794
Copyright (C) 2012 Ariya Hidayat <[email protected] >
@@ -5464,11 +5479,11 @@ var hasOwnProperty = Object.hasOwnProperty || function (obj, key) {
5464
5479
} ) ) ;
5465
5480
/* vim: set sw=4 ts=4 et tw=80 : */
5466
5481
5467
- } , { } ] , 12 :[ function ( _dereq_ , module , exports ) {
5482
+ } , { } ] , 15 :[ function ( _dereq_ , module , exports ) {
5468
5483
module . exports = _dereq_ ( './lib/extend' ) ;
5469
5484
5470
5485
5471
- } , { "./lib/extend" :13 } ] , 13 :[ function ( _dereq_ , module , exports ) {
5486
+ } , { "./lib/extend" :16 } ] , 16 :[ function ( _dereq_ , module , exports ) {
5472
5487
/*!
5473
5488
* node.extend
5474
5489
* Copyright 2011, John Resig
@@ -5552,7 +5567,7 @@ extend.version = '1.0.8';
5552
5567
module . exports = extend ;
5553
5568
5554
5569
5555
- } , { "is" :14 } ] , 14 :[ function ( _dereq_ , module , exports ) {
5570
+ } , { "is" :17 } ] , 17 :[ function ( _dereq_ , module , exports ) {
5556
5571
5557
5572
/**!
5558
5573
* is
0 commit comments