How to use the titanium/util.format function in titanium

To help you get started, we’ve selected a few titanium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tonylukasavage / ti-mocha / src / titanium.js View on Github external
if (args.length === 0) {
				if (isStudio) {
					args.push(util.cursor.reset + ' ' + util.cursor.reset);
				} else {
					args.push(util.cursor.resetLine);
				}
			} else {
				var prefix = util.cursor.resetLine;
				if (!isStudio) {
					// Clear the existing line of text using ANSI codes, get rid of those pesky [INFO] prefixes
					args[0] = prefix + (args[0] || '').toString().split(/(?:\r\n|\n|\r)/).join('\n' + prefix);
				}
			}

			// Use the util.js format() port to get node.js-like console functions
			Ti.API.log(type === 'log' ? 'info' : type, util.format.apply(this, args));
		}

		// If the output file exists, write the content to the file as well
		if (mocha._ti_output_file) {
			mocha._ti_output_file.append(util.format.apply(this, rawArgs).replace(/\x1B\[[0-9;]*[a-zA-Z]/g, ''));
		}
	};
}

titanium

TiDev Titanium Command line

Apache-2.0
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis