Comparing version 0.6.2 to 0.6.3
{ | ||
"name": "annotate", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"main": "./lib/annotate.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
(function(root, factory) { | ||
if (typeof exports === 'object') { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like environments that support module.exports, | ||
// like Node. | ||
module.exports = factory(require('is-js')); | ||
} else if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module. | ||
var nodeColors = { | ||
red: function(str) { | ||
return ['\033[31m' + str + '\033[0m']; | ||
}, | ||
green: function(str) { | ||
return ['\033[32m' + str + '\033[0m']; | ||
}, | ||
yellow: function(str) { | ||
return ['\033[33m' + str + '\033[0m']; | ||
} | ||
}; | ||
var browserColors = { | ||
red: function(str) { | ||
return ['%c' + str, 'color: red']; | ||
}, | ||
green: function(str) { | ||
return ['%c' + str, 'color: green']; | ||
}, | ||
yellow: function(str) { | ||
return ['%c' + str, 'color: yellow']; | ||
} | ||
}; | ||
if(typeof exports === 'object') { | ||
module.exports = factory(require('is-js'), nodeColors); | ||
} else if(typeof define === 'function' && define.amd) { | ||
define(['is-js'], function(is) { | ||
return (root.annotate = factory(is)); | ||
return (root.annotate = factory(is, browserColors)); | ||
}); | ||
} else { | ||
// Browser globals (root is window) | ||
root.annotate = factory(root.is); | ||
root.annotate = factory(root.is, browserColors); | ||
} | ||
}(this, function(is) { | ||
}(this, function(is, colors) { | ||
return function() { | ||
@@ -24,3 +43,3 @@ var doc = arguments[1]; | ||
var ret = function() { | ||
console.warn(red('\n"' + name + '" is missing dispatcher!')); | ||
warn(colors.red('\n"' + name + '" is missing dispatcher!')); | ||
}; | ||
@@ -94,3 +113,3 @@ | ||
warn('precondition', failedPre, n, args); | ||
warnPost('precondition', failedPre, n, args); | ||
}; | ||
@@ -120,3 +139,3 @@ } | ||
if(!postcondition.apply(undefined, [res].concat(args))) { | ||
warn('postcondition', postcondition, name, args); | ||
warnPost('postcondition', postcondition, name, args); | ||
@@ -127,22 +146,12 @@ return false; | ||
console.log(res, postconditions, args); | ||
return res; | ||
} | ||
function warn(prefix, fn, name, args) { | ||
console.warn('\n' + yellow(name) + ' ' + prefix + '\n' + fn + '\nfailed with parameters (' + green(args.join(', ')) + ')!'); | ||
function warnPost(prefix, fn, name, args) { | ||
warn(['\n'].concat(colors.yellow(name)).concat([prefix, '\n', fn, '\n', 'failed with parameters (']).concat(colors.green(args.join(', '))).concat([')!'])); | ||
} | ||
function red(str) { | ||
return '\033[31m' + str + '\033[0m'; | ||
function warn(o) { | ||
console.warn.apply(console, o); | ||
} | ||
function green(str) { | ||
return '\033[32m' + str + '\033[0m'; | ||
} | ||
function yellow(str) { | ||
return '\033[33m' + str + '\033[0m'; | ||
} | ||
})); |
@@ -5,3 +5,3 @@ { | ||
"author": "Juho Vepsalainen <bebraw@gmail.com>", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
@@ -8,0 +8,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12046
7
227
1