@@ -4982,6 +4982,197 @@ module.exports = function (chai, util) {
4982
4982
new Assertion ( exp , msg , assert . notDeepInclude , true ) . not . deep . include ( inc ) ;
4983
4983
} ;
4984
4984
4985
+ /**
4986
+ * ### .nestedInclude(haystack, needle, [message])
4987
+ *
4988
+ * Asserts that 'haystack' includes 'needle'.
4989
+ * Can be used to assert the inclusion of a subset of properties in an
4990
+ * object.
4991
+ * Enables the use of dot- and bracket-notation for referencing nested
4992
+ * properties.
4993
+ * '[]' and '.' in property names can be escaped using double backslashes.
4994
+ *
4995
+ * assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'});
4996
+ * assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'});
4997
+ *
4998
+ * @name nestedInclude
4999
+ * @param {Object } haystack
5000
+ * @param {Object } needle
5001
+ * @param {String } message
5002
+ * @namespace Assert
5003
+ * @api public
5004
+ */
5005
+
5006
+ assert . nestedInclude = function ( exp , inc , msg ) {
5007
+ new Assertion ( exp , msg , assert . nestedInclude , true ) . nested . include ( inc ) ;
5008
+ } ;
5009
+
5010
+ /**
5011
+ * ### .notNestedInclude(haystack, needle, [message])
5012
+ *
5013
+ * Asserts that 'haystack' does not include 'needle'.
5014
+ * Can be used to assert the absence of a subset of properties in an
5015
+ * object.
5016
+ * Enables the use of dot- and bracket-notation for referencing nested
5017
+ * properties.
5018
+ * '[]' and '.' in property names can be escaped using double backslashes.
5019
+ *
5020
+ * assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'});
5021
+ * assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'});
5022
+ *
5023
+ * @name notNestedInclude
5024
+ * @param {Object } haystack
5025
+ * @param {Object } needle
5026
+ * @param {String } message
5027
+ * @namespace Assert
5028
+ * @api public
5029
+ */
5030
+
5031
+ assert . notNestedInclude = function ( exp , inc , msg ) {
5032
+ new Assertion ( exp , msg , assert . notNestedInclude , true )
5033
+ . not . nested . include ( inc ) ;
5034
+ } ;
5035
+
5036
+ /**
5037
+ * ### .deepNestedInclude(haystack, needle, [message])
5038
+ *
5039
+ * Asserts that 'haystack' includes 'needle'.
5040
+ * Can be used to assert the inclusion of a subset of properties in an
5041
+ * object while checking for deep equality.
5042
+ * Enables the use of dot- and bracket-notation for referencing nested
5043
+ * properties.
5044
+ * '[]' and '.' in property names can be escaped using double backslashes.
5045
+ *
5046
+ * assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}});
5047
+ * assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}});
5048
+ *
5049
+ * @name deepNestedInclude
5050
+ * @param {Object } haystack
5051
+ * @param {Object } needle
5052
+ * @param {String } message
5053
+ * @namespace Assert
5054
+ * @api public
5055
+ */
5056
+
5057
+ assert . deepNestedInclude = function ( exp , inc , msg ) {
5058
+ new Assertion ( exp , msg , assert . deepNestedInclude , true )
5059
+ . deep . nested . include ( inc ) ;
5060
+ } ;
5061
+
5062
+ /**
5063
+ * ### .notDeepNestedInclude(haystack, needle, [message])
5064
+ *
5065
+ * Asserts that 'haystack' does not include 'needle'.
5066
+ * Can be used to assert the absence of a subset of properties in an
5067
+ * object while checking for deep equality.
5068
+ * Enables the use of dot- and bracket-notation for referencing nested
5069
+ * properties.
5070
+ * '[]' and '.' in property names can be escaped using double backslashes.
5071
+ *
5072
+ * assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}})
5073
+ * assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}});
5074
+ *
5075
+ * @name notDeepNestedInclude
5076
+ * @param {Object } haystack
5077
+ * @param {Object } needle
5078
+ * @param {String } message
5079
+ * @namespace Assert
5080
+ * @api public
5081
+ */
5082
+
5083
+ assert . notDeepNestedInclude = function ( exp , inc , msg ) {
5084
+ new Assertion ( exp , msg , assert . notDeepNestedInclude , true )
5085
+ . not . deep . nested . include ( inc ) ;
5086
+ } ;
5087
+
5088
+ /**
5089
+ * ### .ownInclude(haystack, needle, [message])
5090
+ *
5091
+ * Asserts that 'haystack' includes 'needle'.
5092
+ * Can be used to assert the inclusion of a subset of properties in an
5093
+ * object while ignoring inherited properties.
5094
+ *
5095
+ * assert.ownInclude({ a: 1 }, { a: 1 });
5096
+ *
5097
+ * @name ownInclude
5098
+ * @param {Object } haystack
5099
+ * @param {Object } needle
5100
+ * @param {String } message
5101
+ * @namespace Assert
5102
+ * @api public
5103
+ */
5104
+
5105
+ assert . ownInclude = function ( exp , inc , msg ) {
5106
+ new Assertion ( exp , msg , assert . ownInclude , true ) . own . include ( inc ) ;
5107
+ } ;
5108
+
5109
+ /**
5110
+ * ### .notOwnInclude(haystack, needle, [message])
5111
+ *
5112
+ * Asserts that 'haystack' includes 'needle'.
5113
+ * Can be used to assert the absence of a subset of properties in an
5114
+ * object while ignoring inherited properties.
5115
+ *
5116
+ * Object.prototype.b = 2;
5117
+ *
5118
+ * assert.notOwnInclude({ a: 1 }, { b: 2 });
5119
+ *
5120
+ * @name notOwnInclude
5121
+ * @param {Object } haystack
5122
+ * @param {Object } needle
5123
+ * @param {String } message
5124
+ * @namespace Assert
5125
+ * @api public
5126
+ */
5127
+
5128
+ assert . notOwnInclude = function ( exp , inc , msg ) {
5129
+ new Assertion ( exp , msg , assert . notOwnInclude , true ) . not . own . include ( inc ) ;
5130
+ } ;
5131
+
5132
+ /**
5133
+ * ### .deepOwnInclude(haystack, needle, [message])
5134
+ *
5135
+ * Asserts that 'haystack' includes 'needle'.
5136
+ * Can be used to assert the inclusion of a subset of properties in an
5137
+ * object while ignoring inherited properties and checking for deep equality.
5138
+ *
5139
+ * assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}});
5140
+ *
5141
+ * @name deepOwnInclude
5142
+ * @param {Object } haystack
5143
+ * @param {Object } needle
5144
+ * @param {String } message
5145
+ * @namespace Assert
5146
+ * @api public
5147
+ */
5148
+
5149
+ assert . deepOwnInclude = function ( exp , inc , msg ) {
5150
+ new Assertion ( exp , msg , assert . deepOwnInclude , true )
5151
+ . deep . own . include ( inc ) ;
5152
+ } ;
5153
+
5154
+ /**
5155
+ * ### .notDeepOwnInclude(haystack, needle, [message])
5156
+ *
5157
+ * Asserts that 'haystack' includes 'needle'.
5158
+ * Can be used to assert the absence of a subset of properties in an
5159
+ * object while ignoring inherited properties and checking for deep equality.
5160
+ *
5161
+ * assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}});
5162
+ *
5163
+ * @name notDeepOwnInclude
5164
+ * @param {Object } haystack
5165
+ * @param {Object } needle
5166
+ * @param {String } message
5167
+ * @namespace Assert
5168
+ * @api public
5169
+ */
5170
+
5171
+ assert . notDeepOwnInclude = function ( exp , inc , msg ) {
5172
+ new Assertion ( exp , msg , assert . notDeepOwnInclude , true )
5173
+ . not . deep . own . include ( inc ) ;
5174
+ } ;
5175
+
4985
5176
/**
4986
5177
* ### .match(value, regexp, [message])
4987
5178
*
@@ -7146,7 +7337,16 @@ var canSetPrototype = typeof Object.setPrototypeOf === 'function';
7146
7337
// However, some of functions' own props are not configurable and should be skipped.
7147
7338
var testFn = function ( ) { } ;
7148
7339
var excludeNames = Object . getOwnPropertyNames ( testFn ) . filter ( function ( name ) {
7149
- return ! Object . getOwnPropertyDescriptor ( testFn , name ) . configurable ;
7340
+ var propDesc = Object . getOwnPropertyDescriptor ( testFn , name ) ;
7341
+
7342
+ // Note: PhantomJS 1.x includes `callee` as one of `testFn`'s own properties,
7343
+ // but then returns `undefined` as the property descriptor for `callee`. As a
7344
+ // workaround, we perform an otherwise unnecessary type-check for `propDesc`,
7345
+ // and then filter it out if it's not an object as it should be.
7346
+ if ( typeof propDesc !== 'object' )
7347
+ return true ;
7348
+
7349
+ return ! propDesc . configurable ;
7150
7350
} ) ;
7151
7351
7152
7352
// Cache `Function` properties
@@ -10409,6 +10609,7 @@ module.exports = {
10409
10609
10410
10610
} , { } ] , 39 :[ function ( require , module , exports ) {
10411
10611
'use strict' ;
10612
+
10412
10613
/* !
10413
10614
* type-detect
10414
10615
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
@@ -10431,7 +10632,7 @@ var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().e
10431
10632
var mapIteratorPrototype = mapEntriesExists && Object . getPrototypeOf ( new Map ( ) . entries ( ) ) ;
10432
10633
var arrayIteratorExists = symbolIteratorExists && typeof Array . prototype [ Symbol . iterator ] === 'function' ;
10433
10634
var arrayIteratorPrototype = arrayIteratorExists && Object . getPrototypeOf ( [ ] [ Symbol . iterator ] ( ) ) ;
10434
- var stringIteratorExists = symbolIteratorExists && typeof Array . prototype [ Symbol . iterator ] === 'function' ;
10635
+ var stringIteratorExists = symbolIteratorExists && typeof String . prototype [ Symbol . iterator ] === 'function' ;
10435
10636
var stringIteratorPrototype = stringIteratorExists && Object . getPrototypeOf ( '' [ Symbol . iterator ] ( ) ) ;
10436
10637
var toStringLeftSliceLength = 8 ;
10437
10638
var toStringRightSliceLength = - 1 ;
@@ -10501,7 +10702,10 @@ module.exports = function typeDetect(obj) {
10501
10702
* Post:
10502
10703
* array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled)
10503
10704
*/
10504
- if ( Array . isArray ( obj ) ) {
10705
+ if (
10706
+ Array . isArray ( obj ) &&
10707
+ ( symbolToStringTagExists === false || ! ( Symbol . toStringTag in obj ) )
10708
+ ) {
10505
10709
return 'Array' ;
10506
10710
}
10507
10711
@@ -10795,7 +10999,7 @@ module.exports={
10795
10999
"Veselin Todorov <hi@vesln.com>" ,
10796
11000
"John Firebaugh <john.firebaugh@gmail.com>"
10797
11001
] ,
10798
- "version" : "4.0.0-canary.2 " ,
11002
+ "version" : "4.0.0" ,
10799
11003
"repository" : {
10800
11004
"type" : "git" ,
10801
11005
"url" : "https://github.com/chaijs/chai"
0 commit comments