Skip to content

Commit

Permalink
Revert the lib part of the lebab commit (9b8157b) so uglify doesn't b…
Browse files Browse the repository at this point in the history
…reak when building the bookmarklet
  • Loading branch information
papandreou committed Jan 7, 2019
1 parent f23db21 commit 38adf53
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/uninspected.js
@@ -1,7 +1,7 @@
/*global console, navigator*/
const unexpected = require('unexpected').clone();
var unexpected = require('unexpected').clone();

const originalConsole = console; // Take a copy so we don't loop infinitely when someone goes: console=uninspected;console.log('foo');
var originalConsole = console; // Take a copy so we don't loop infinitely when someone goes: console=uninspected;console.log('foo');

unexpected.installPlugin(require('magicpen-prism'));

Expand All @@ -10,11 +10,11 @@ function uninspected() {
return uninspected.log.apply(uninspected, arguments);
}

uninspected.inspect = (obj, options) => {
uninspected.inspect = function(obj, options) {
if (!options || typeof options !== 'object') {
options = {};
}
const depth =
var depth =
options.depth === null
? Infinity
: options.depth || uninspected.defaultDepth;
Expand All @@ -35,7 +35,7 @@ if (uninspected.outputFormat === 'html') {
uninspected.outputFormat = 'text';
}

const isChrome =
var isChrome =
typeof navigator !== 'undefined' &&
navigator &&
typeof navigator.userAgent === 'string' &&
Expand All @@ -47,11 +47,11 @@ function createOutput() {
);
}

['log', 'info', 'warn', 'error'].forEach(methodName => {
['log', 'info', 'warn', 'error'].forEach(function(methodName) {
uninspected[methodName] = function() {
// ...
const output = createOutput();
Array.prototype.forEach.call(arguments, (obj, i) => {
var output = createOutput();
Array.prototype.forEach.call(arguments, function(obj, i) {
if (i > 0) {
output.sp();
}
Expand All @@ -73,12 +73,12 @@ function createOutput() {

uninspected.dir = originalConsole.dir.bind(originalConsole);

uninspected.assert = subject => {
uninspected.assert = function(subject) {
unexpected(subject, 'to be truthy');
};

uninspected.diff = (a, b) => {
const result = unexpected.diff(a, b, createOutput());
uninspected.diff = function(a, b) {
var result = unexpected.diff(a, b, createOutput());
if (result && result.diff) {
uninspected.log(result.diff);
} else if (unexpected.equal(a, b)) {
Expand All @@ -97,7 +97,7 @@ uninspected.diff = (a, b) => {
};

// Support trace, time, timeEnd etc.
Object.keys(originalConsole).forEach(key => {
Object.keys(originalConsole).forEach(function(key) {
if (typeof originalConsole[key] === 'function' && !uninspected[key]) {
uninspected[key] = function() {
// ...
Expand Down

0 comments on commit 38adf53

Please sign in to comment.