Created
May 7, 2012 22:53
-
-
Save stucox/2631190 to your computer and use it in GitHub Desktop.
Patch for pyjon to support Underscore.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pyjon/interpr.py b/pyjon/interpr.py | |
index 5520d95..4c639b4 100644 | |
--- a/pyjon/interpr.py | |
+++ b/pyjon/interpr.py | |
@@ -1467,6 +1467,11 @@ class array_proto(list, Prototype): | |
def pop(self): return list.pop(self) | |
@publicmethod | |
+ def sort(self, sortfn=None): | |
+ list.sort(self, sortfn) | |
+ return self | |
+ | |
+ @publicmethod | |
def slice(this, s=0, i=None): | |
if i == None: i = len(this) | |
return array_proto(*this[s:i]) | |
@@ -1518,6 +1523,7 @@ class Array(JS_Function): | |
def __getattr__(self, k): | |
if k == 'constructor': return array | |
elif k == '__proto__': return array_prototype | |
+ elif k == 'isArray': return isArray | |
else: Prototype.__getattr__(self, k) | |
def __newInstance__(self, *args): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment