Skip to content

Latest commit

 

History

History
28 lines (26 loc) · 546 Bytes

javascript.md

File metadata and controls

28 lines (26 loc) · 546 Bytes

javascript

multi line string

/**
 * @description get multi line string method
 * @param {Function}
 * @return {String}
 */
function getString(fn) {
	var s = fn.toString();
	s = s.substring(s.indexOf('/*') + 2, s.lastIndexOf('*/'));
	s = s.replace(/^*?!?(@preserve)?\r?\n?|\r?\n?$/g, '');
	return s;
}

get object type

/**
 * @description get object type
 * @param {Object}
 * @return {String}
 */
function getType(o) {
	return Object.prototype.toString.call(o).match(/ (\w+)/)[1].toLowerCase();
}