Skip to content

Instantly share code, notes, and snippets.

@slacktracer
Last active August 29, 2015 14:14
Show Gist options
  • Save slacktracer/6f190734535de7640b2f to your computer and use it in GitHub Desktop.
Save slacktracer/6f190734535de7640b2f to your computer and use it in GitHub Desktop.
field(player);
Hello, World!
<a
data-ng-click="main.currentView = 'views/other.html'"
href="#"
>
Testing
</a>
//
function field(player) {
var
index;
if (player && typeof player === 'object') {
index = game.field.indexOf(player);
if (index !== -1) {
return game.field.splice(index, 1);
}
game.field.push(player);
game.field.ids.push(player);
return true;
}
if (player && typeof player === 'string') {
index = game.field.ids.indexOf(player);
if (index !== -1) {
return game.field[index];
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment