Skip to content

Instantly share code, notes, and snippets.

@cjohansen
Created October 25, 2010 21:54
Show Gist options
  • Save cjohansen/645863 to your computer and use it in GitHub Desktop.
Save cjohansen/645863 to your computer and use it in GitHub Desktop.
var mylib = {};
mylib.format = (function () {
function format(object) {
if (Object.prototype.toString.call(objec) == "[object Array]") {
return format.array(object);
}
if (typeof object == "function") {
return format.func(object);
}
if (typeof object == "object") {
return format.object(object);
}
return "" + object;
}
format.array = function (array) {
// ...
};
format.func = function (array) {
// ...
};
format.object = function (array) {
// ...
};
return format;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment