本文整理汇总了TypeScript中underscore._类的典型用法代码示例。如果您正苦于以下问题:TypeScript _类的具体用法?TypeScript _怎么用?TypeScript _使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了_类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: run
run(parsers:IParser[]){
if(_.isUndefined(parsers)){
parsers = [];
}
parsers.push(new Haskell.HaskellParser());
var config = new Config.Config().getConfig();
var server = new Server.Server(process.env.PORT || config.port, config);
var watchPaths = [config.projectSource + "/dist/test/"];
var fileWatcher = new FileWatcher.FileWatcher(watchPaths, path => {
try{
for(var i = 0; i< parsers.length; i++){
var contents = parsers[i].parseFile(path);
server.notifyConnections(contents);
console.log((path + " changed").cyan);
return;
}
}
catch(e){
}
});
server.start();
open("http://localhost:" + server.port);
}
开发者ID:devshorts,项目名称:htf-viewer,代码行数:34,代码来源:app.ts
示例2: function
value: function(unit: WorldObject, spell, target) {
if (_.isString(spell)) {
checkParams('cast', arguments, WorldObject, String, WorldObject);
attemptSpellcast(state, unit, new SpellTarget(target.id, undefined), spell);
} else {
if (target instanceof WorldObject) {
checkParams('cast', arguments, WorldObject, Spell, WorldObject);
attemptSpellcast(state, unit, new SpellTarget(target.id, undefined), spell.name);
} else if (_.isArray(target)) {
checkParams('cast', arguments, WorldObject, Spell, Array);
attemptSpellcast(state, unit, new SpellTarget(target.id, undefined), spell.name);
} else {
throw new Error('Unknown arguments passed to `cast`');
}
}
}
开发者ID:rmx,项目名称:encounter,代码行数:16,代码来源:Global.ts
示例3: isCompatibleType
function isCompatibleType(value, type, typeName: string): boolean {
if (type === Function) {
return _.isFunction(value);
} else if (type === Object) {
return _.isObject(value);
} else if (type === Array) {
return _.isArray(value);
} else if (type === String || type === Number || type === Boolean) {
return type === value.constructor;
} else {
return typeName === value.constructor.name;
}
}
开发者ID:rmx,项目名称:encounter,代码行数:17,代码来源:Env.ts
示例4: getConfig
getConfig():ConfigData{
var defaults:ConfigData = {
projectSource: process.cwd(),
port: 3000
};
var config = defaults;
var overrideConfigPath = process.cwd() + "/hconfig.json";
if(fs.existsSync(overrideConfigPath)){
console.log(("found config path @ " + overrideConfigPath).yellow);
config = _.defaults(JSON.parse(fs.readFileSync(overrideConfigPath).toString()), defaults);
}
else{
console.log("using default config".yellow);
}
console.log(("Source Dir: " + config.projectSource).green);
console.log(("Port: " + config.port).green);
return config;
}
开发者ID:devshorts,项目名称:htf-viewer,代码行数:24,代码来源:config.ts
示例5:
var result = underscore._.find(values,function(value:T){underscore._.isEqual(obj , value)})
开发者ID:Villaz,项目名称:Icarus,代码行数:1,代码来源:map.ts
示例6: getTexture
getTexture(name: string): Texture {
return _.find(this.textures, texture => {
return texture.type == name;
});
}
开发者ID:rmx,项目名称:encounter,代码行数:5,代码来源:Skybox.ts
注:本文中的underscore._类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论