You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2016/09/05 07:01:25 UTC

[3/6] incubator-ponymail git commit: add a remove-by-value func for arrays

add a remove-by-value func for arrays


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/794d93ec
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/794d93ec
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/794d93ec

Branch: refs/heads/coffee-and-cake
Commit: 794d93ec2a75405372bb768833970711ec3f2e31
Parents: 5feeaef
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 09:00:12 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 09:00:12 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/misc.coffee | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/794d93ec/site/js/coffee/misc.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/misc.coffee b/site/js/coffee/misc.coffee
index 4fb4044..3bbcbc0 100644
--- a/site/js/coffee/misc.coffee
+++ b/site/js/coffee/misc.coffee
@@ -63,3 +63,12 @@ isHash = (value) ->
     value and
         typeof value is 'object' and
         not isArray(value)
+
+### Remove an array element by value ###
+Array.prototype.remove = (val) ->
+    for item, i in this
+        if item == val
+            this.splice(i, 1)
+            return this
+    return this;
+