diff options
| author | Stephen Blott | 2015-02-09 11:40:53 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-02-09 11:40:53 +0000 |
| commit | 0bf605a934115083e700f5de090f39841417482a (patch) | |
| tree | 408c191bd702da6847bca9943f6eba93ad28b209 /lib/utils.coffee | |
| parent | ac648a0e9f53c2fc359daa68309c25dd8c9db031 (diff) | |
| parent | ed306994697f6f9f5e13f9d018b5c7ffa2fff680 (diff) | |
| download | vimium-0bf605a934115083e700f5de090f39841417482a.tar.bz2 | |
Merge branch 'visual-and-edit-modes'
Conflicts:
background_scripts/main.coffee
content_scripts/vimium_frontend.coffee
lib/keyboard_utils.coffee
Diffstat (limited to 'lib/utils.coffee')
| -rw-r--r-- | lib/utils.coffee | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee index 661f7e84..64c87842 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -152,6 +152,23 @@ Utils = # locale-sensitive uppercase detection hasUpperCase: (s) -> s.toLowerCase() != s + # Give objects (including elements) distinct identities. + getIdentity: do -> + identities = [] + + (obj) -> + index = identities.indexOf obj + if index < 0 + index = identities.length + identities.push obj + "identity-" + index + + # Return a copy of object, but with some of its properties omitted. + copyObjectOmittingProperties: (obj, properties...) -> + obj = extend {}, obj + delete obj[property] for property in properties + obj + # This creates a new function out of an existing function, where the new function takes fewer arguments. This # allows us to pass around functions instead of functions + a partial list of arguments. Function::curry = -> |
