flymis/WebRoot/dojojs/src/lang/repr.js
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.lang.repr");
dojo.require("dojo.lang.common");
dojo.require("dojo.AdapterRegistry");
dojo.require("dojo.string.extras");
dojo.lang.reprRegistry = new dojo.AdapterRegistry();
dojo.lang.registerRepr = function(/*String*/name, /*Function*/check, /*Function*/wrap, /*Boolean?*/override){
// summary:
// Register a repr function. repr functions should take
// one argument and return a string representation of it
// suitable for developers, primarily used when debugging.
//
// If override is given, it is used as the highest priority
// repr, otherwise it will be used as the lowest.
dojo.lang.reprRegistry.register(name, check, wrap, override);
};
dojo.lang.repr = function(/*Object*/obj){
// summary: Return a "programmer representation" for an object
// description: returns a string representation of an object suitable for developers, primarily used when debugging
if(typeof(obj) == "undefined"){
// obj: undefined
return "undefined"; // String
}else if(obj === null){
// obj: null
return "null"; // String
}
try{
if(typeof(obj["__repr__"]) == 'function'){
return obj["__repr__"]();
}else if((typeof(obj["repr"]) == 'function')&&(obj.repr != arguments.callee)){
return obj["repr"]();
}
return dojo.lang.reprRegistry.match(obj);
}catch(e){
if(typeof(obj.NAME) == 'string' && (
obj.toString == Function.prototype.toString ||
obj.toString == Object.prototype.toString
)){
return obj.NAME; // String
}
}
if(typeof(obj) == "function"){
// obj: Function
obj = (obj + "").replace(/^\s+/, "");
后面还有 25 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。