SkillAction.wLayer.setTimeMechine(null, skill.duration*_.TIME.SEC, null, null, function(){ _(oriObjArr).each(function(v, k){ v.force = oriForceMap[v.objID]; v.findAttackZoneFitEnemy(); }) });
test("mixin", function() { _.mixin({ myReverse: function(string) { return string.split('').reverse().join(''); } }); equal(_.myReverse('panacea'), 'aecanap', 'mixed in a function to _'); equal(_('champ').myReverse(), 'pmahc', 'mixed in a function to the OOP wrapper'); });
React.createClass({ onRebuildProject: function(projectName) { ProjectActions.run(projectName); }, onCancelBuild: function(buildId) { BuildActions.cancel(buildId); }, render: template.locals(_({ Link: Router.Link, utils: utils }).extend(CommonComponents)) })
_(O.entries (((typeof tests === 'function') && _.fromPairs ([[name, tests]])) || tests)) .map (function (keyValue) { var test = new Test ({ proto: proto, name: keyValue[0], routine: keyValue[1], suite: name, context: context }) test.complete (function () { if (!(test.hasLog = (test.logCalls.length > 0))) { if (test.failed) { log.red ('FAIL') } else if (test.verbose) { log.green ('PASS') } } }) return test })
var extendProject = function(project) { if (project.playbooks) { _(project).defaults({ playbookCommand: 'ANSIBLE_FORCE_COLOR=true ansible-playbook' }); } return project; }
test("last", function() { equal(_.last([1,2,3]), 3, 'can pull out the last element of an array'); equal(_.last([1,2,3], 0).join(', '), "", 'can pass an index to last'); equal(_.last([1,2,3], 2).join(', '), '2, 3', 'can pass an index to last'); equal(_.last([1,2,3], 5).join(', '), '1, 2, 3', 'can pass an index to last'); var result = (function(){ return _(arguments).last(); })(1, 2, 3, 4); equal(result, 4, 'works on an arguments object'); result = _.map([[1,2,3],[1,2,3]], _.last); equal(result.join(','), '3,3', 'works well with _.map'); equal(_.last(null), undefined, 'handles nulls'); });
_(['builds', 'projects']).each(function(resourceName) { var resource = require('./' + resourceName)(app); resource.use(errorHandler(app)); });
test("tap", function() { var intercepted = null; var interceptor = function(obj) { intercepted = obj; }; var returned = _.tap(1, interceptor); equal(intercepted, 1, "passes tapped object to interceptor"); equal(returned, 1, "returns tapped object"); returned = _([1,2,3]).chain(). map(function(n){ return n * 2; }). max(). tap(interceptor). value(); ok(returned == 6 && intercepted == 6, 'can use tapped objects in a chain'); });
test("rest", function() { var numbers = [1, 2, 3, 4]; equal(_.rest(numbers).join(", "), "2, 3, 4", 'working rest()'); equal(_.rest(numbers, 0).join(", "), "1, 2, 3, 4", 'working rest(0)'); equal(_.rest(numbers, 2).join(', '), '3, 4', 'rest can take an index'); var result = (function(){ return _(arguments).tail(); })(1, 2, 3, 4); equal(result.join(', '), '2, 3, 4', 'aliased as tail and works on arguments object'); result = _.map([[1,2,3],[1,2,3]], _.rest); equal(_.flatten(result).join(','), '2,3,2,3', 'works well with _.map'); result = (function(){ return _(arguments).drop(); })(1, 2, 3, 4); equal(result.join(', '), '2, 3, 4', 'aliased as drop and works on arguments object'); });
test('include', function() { ok(_.include([1,2,3], 2), 'two is in the array'); ok(!_.include([1,3,9], 2), 'two is not in the array'); ok(_.contains({moe:1, larry:3, curly:9}, 3) === true, '_.include on objects checks their values'); ok(_([1,2,3]).include(2), 'OO-style include'); });
test("initial", function() { equal(_.initial([1,2,3,4,5]).join(", "), "1, 2, 3, 4", 'working initial()'); equal(_.initial([1,2,3,4],2).join(", "), "1, 2", 'initial can take an index'); var result = (function(){ return _(arguments).initial(); })(1, 2, 3, 4); equal(result.join(", "), "1, 2, 3", 'initial works on arguments object'); result = _.map([[1,2,3],[1,2,3]], _.initial); equal(_.flatten(result).join(','), '1,2,1,2', 'initial works with _.map'); });
test("intersection", function() { var stooges = ['moe', 'curly', 'larry'], leaders = ['moe', 'groucho']; equal(_.intersection(stooges, leaders).join(''), 'moe', 'can take the set intersection of two arrays'); equal(_(stooges).intersection(leaders).join(''), 'moe', 'can perform an OO-style intersection'); var result = (function(){ return _.intersection(arguments, leaders); })('moe', 'curly', 'larry'); equal(result.join(''), 'moe', 'works on an arguments object'); var theSixStooges = ['moe', 'moe', 'curly', 'curly', 'larry', 'larry']; equal(_.intersection(theSixStooges, leaders).join(''), 'moe', 'returns a duplicate-free array'); });
React.createClass({ mixins: [ Reflux.connect(buildsStore, 'items') ], onCancelBuild: function(buildId) { BuildActions.cancel(buildId); }, render: template.locals(_({ Link: Router.Link }).extend(CommonComponents)) })
SkillAction.wLayer.setTimeMechine(null, skill.duration*_.TIME.SEC, null, null, function(){ _(oriObjArr).each(function(v, k){ v.force = oriForceMap[v.objID]; v.findAttackZoneFitEnemy(); }) });