From: Jay Freeman (saurik) Date: Wed, 23 Dec 2015 18:59:49 +0000 (-0800) Subject: Provide toCYON for more built-in JavaScript types. X-Git-Tag: v0.9.590~136 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/a4e76c785372fe91fd71f5ac721190cecf432942?ds=sidebyside Provide toCYON for more built-in JavaScript types. --- diff --git a/libcycript.cy b/libcycript.cy index 79a1735..dd7e2ac 100644 --- a/libcycript.cy +++ b/libcycript.cy @@ -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;