forked from shouldjs/should.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwarn.js
27 lines (22 loc) · 938 Bytes
/
warn.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var WARN = '\u001b[33mWARN\u001b[39m';
function generateDeprecated(lines) {
return function(show) {
if(!show) return;
lines.concat(sharedPart).forEach(function(line) {
console.warn(WARN, line);
});
}
}
var sharedPart = [
'To disable any warnings add \u001b[33mshould.warn = false\u001b[39m',
'If you think that is not right, raise issue on github https://github.com/shouldjs/should.js/issues'
];
exports.staticShouldUnWrap = generateDeprecated([
'Static version of should was called with primitive type wrapper like should(new Number(10))',
'current version will unwrap it to assert on primitive value for you',
'but that will be changed in future versions, make sure you know what are you doing'
]);
exports.nonStrictEql = generateDeprecated([
'Strict version of eql return different result for this comparison',
'it means that e.g { a: 10 } is equal to { a: "10" }, make sure it is expected'
]);