Skip to content

Instantly share code, notes, and snippets.

@Erutan409
Last active May 7, 2022 01:05

Revisions

  1. Erutan409 revised this gist May 28, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion constructor.name.polyfill.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    if (!Object.constructor.prototype.hasOwnProperty('name')) {
    Object.defineProperty(Object.constructor.prototype, 'name', {
    get: function () {
    return this.toString().replace(/^\S+\s+(\w+)[\S\s]+$/, '$1');
    return this.toString().trim().replace(/^\S+\s+(\w+)[\S\s]+$/, '$1');
    }
    })
    }
  2. Erutan409 revised this gist Mar 25, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion constructor.name.polyfill.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    (function () {
    if (!Object.constructor.prototype.hasOwnProperty('name')) {
    Object.defineProperty(Object.constructor.prototype, 'name', {
    get: function name() {
    get: function () {
    return this.toString().replace(/^\S+\s+(\w+)[\S\s]+$/, '$1');
    }
    })
  3. Erutan409 revised this gist Mar 11, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion constructor.name.polyfill.js
    Original file line number Diff line number Diff line change
    @@ -5,5 +5,5 @@
    return this.toString().replace(/^\S+\s+(\w+)[\S\s]+$/, '$1');
    }
    })
    } //
    }
    })();
  4. Erutan409 revised this gist Mar 11, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion constructor.name.polyfill.js
    Original file line number Diff line number Diff line change
    @@ -5,5 +5,5 @@
    return this.toString().replace(/^\S+\s+(\w+)[\S\s]+$/, '$1');
    }
    })
    }
    } //
    })();
  5. Erutan409 revised this gist Mar 11, 2019. No changes.
  6. Erutan409 created this gist Mar 11, 2019.
    9 changes: 9 additions & 0 deletions constructor.name.polyfill.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    (function () {
    if (!Object.constructor.prototype.hasOwnProperty('name')) {
    Object.defineProperty(Object.constructor.prototype, 'name', {
    get: function name() {
    return this.toString().replace(/^\S+\s+(\w+)[\S\s]+$/, '$1');
    }
    })
    }
    })();