]> git.saurik.com Git - cycript.git/commitdiff
Provide toCYON for more built-in JavaScript types.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 23 Dec 2015 18:59:49 +0000 (10:59 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 23 Dec 2015 18:59:49 +0000 (10:59 -0800)
libcycript.cy

index 79a1735279be94a6e900f1af24ca3b47f50c0d92..dd7e2ac1aa43314c86b6528137d167dbcc64ffba 100644 (file)
@@ -35,6 +35,12 @@ let $cy_set = function(object, properties) {
         });
 };
 
+$cy_set(Boolean.prototype, {
+    toCYON: function() {
+        return `new Boolean(${this.toString()})`;
+    },
+});
+
 $cy_set(Date.prototype, {
     toCYON: function() {
         return `new ${this.constructor.name}(${this.toUTCString().toCYON()})`;
@@ -52,6 +58,18 @@ $cy_set(Error.prototype, {
     },
 });
 
+$cy_set(Number.prototype, {
+    toCYON: function() {
+        return `new Number(${this.toString()})`;
+    },
+});
+
+$cy_set(RegExp.prototype, {
+    toCYON: function() {
+        return this.toString();
+    },
+});
+
 let IsFile = function(path) {
     // XXX: this doesn't work on symlinks, but I don't want to fix stat :/
     return access(path, F_OK) == 0 && access(path + '/', F_OK) == -1;