mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
Update vendors.
This commit is contained in:
91
vendor/qunit-extras/qunit-extras.js
vendored
91
vendor/qunit-extras/qunit-extras.js
vendored
@@ -84,6 +84,19 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is the language type of `Object`.
|
||||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
||||
*/
|
||||
function isObject(value) {
|
||||
var type = typeof value;
|
||||
return type == 'function' || (value && type == 'object') || false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string with `text` repeated `n` number of times.
|
||||
*
|
||||
@@ -151,25 +164,18 @@
|
||||
modulePrinted;
|
||||
|
||||
/** Object shortcuts */
|
||||
var console = context.console,
|
||||
phantom = context.phantom,
|
||||
process = phantom || context.process,
|
||||
var phantom = context.phantom,
|
||||
define = context.define,
|
||||
document = !phantom && context.document,
|
||||
java = !document && context.java;
|
||||
process = phantom || context.process,
|
||||
amd = define && define.amd,
|
||||
console = context.console,
|
||||
java = !document && context.java,
|
||||
print = context.print,
|
||||
require = context.require;
|
||||
|
||||
/** Detect the OS of the platform */
|
||||
var os = (function() {
|
||||
if (java) {
|
||||
return java.lang.System.getProperty('os.name');
|
||||
}
|
||||
if (phantom) {
|
||||
return require('system').os.name;
|
||||
}
|
||||
if (process) {
|
||||
return process.platform;
|
||||
}
|
||||
return '';
|
||||
}());
|
||||
/** Detects if running on Node.js */
|
||||
var isNode = isObject(process) && typeof process.on == 'function';
|
||||
|
||||
/** Detects if running in a PhantomJS web page */
|
||||
var isPhantomPage = typeof context.callPhantom == 'function';
|
||||
@@ -178,7 +184,18 @@
|
||||
var isSilent = document && !isPhantomPage;
|
||||
|
||||
/** Used to indicate if running in Windows */
|
||||
var isWindows = /\bwin/i.test(os);
|
||||
var isWindows = isNode && process.platform == 'win32';
|
||||
|
||||
/** Used to indicate if ANSI escape codes are supported */
|
||||
var isAnsiSupported = (function() {
|
||||
if (isNode && process.stdout && !process.stdout.isTTY) {
|
||||
return false;
|
||||
}
|
||||
if (isWindows || getEnv('COLORTERM')) {
|
||||
return true;
|
||||
}
|
||||
return /^(?:ansi|cygwin|linux|screen|xterm|vt100)$|color/i.test(getEnv('TERM'));
|
||||
}());
|
||||
|
||||
/** Used to display the wait throbber */
|
||||
var throbberDelay = 500,
|
||||
@@ -267,6 +284,27 @@
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Gets the environment variable value by a given name.
|
||||
*
|
||||
* @private
|
||||
* @param {string} name The name of the environment variable to get.
|
||||
* @returns {*} Returns the environment variable value.
|
||||
*/
|
||||
function getEnv(name) {
|
||||
if (isNode) {
|
||||
return process.env[name];
|
||||
}
|
||||
if (java) {
|
||||
return java.lang.System.getenv(name);
|
||||
}
|
||||
if (!amd && typeof require == 'function') {
|
||||
try {
|
||||
return require('system').env[name];
|
||||
} catch(e) { }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds text color to the terminal output of `string`.
|
||||
*
|
||||
@@ -276,10 +314,9 @@
|
||||
* @returns {string} Returns the colored string.
|
||||
*/
|
||||
function color(colorName, string) {
|
||||
var code = ansiCodes[colorName];
|
||||
return isWindows
|
||||
? string
|
||||
: ('\x1B[' + code + 'm' + string + '\x1B[0m');
|
||||
return isAnsiSupported
|
||||
? ('\x1B[' + ansiCodes[colorName] + 'm' + string + '\x1B[0m')
|
||||
: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -289,9 +326,7 @@
|
||||
* @param {string} [text=''] The text to log.
|
||||
*/
|
||||
var logInline = (function() {
|
||||
// exit early if not Node.js
|
||||
if (!(typeof process == 'object' && process &&
|
||||
process.on && process.stdout && process.platform != 'win32')) {
|
||||
if (!isNode || isWindows) {
|
||||
return function() {};
|
||||
}
|
||||
// cleanup any inline logs when exited via `ctrl+c`
|
||||
@@ -613,7 +648,11 @@
|
||||
|
||||
// add `console.log` support to Narwhal, Rhino, and RingoJS
|
||||
if (!console) {
|
||||
console = context.console = { 'log': context.print };
|
||||
console = context.console = { 'log': function() {} };
|
||||
}
|
||||
// RingoJS removes ANSI escape codes in `console.log`, but not in `print`
|
||||
if (java && typeof print == 'function') {
|
||||
console.log = print;
|
||||
}
|
||||
// start log throbber
|
||||
if (!isSilent) {
|
||||
|
||||
Reference in New Issue
Block a user