UNPKG

@pivoto/core

Version:

![build](https://img.shields.io/badge/build-passing-success.svg)

74 lines (64 loc) 1.45 kB
// noinspection DuplicatedCode import {formatDate, parseDate} from './date'; import {trim} from "./string"; import {hashCode} from './hash'; export function enhance() { // @ts-ignore if (!Date.format) Date.format = formatDate; // @ts-ignore if (!Date.deformat) Date.deformat = parseDate; // @ts-ignore if (!Date.prototype.format) { Object.defineProperty(Date.prototype, 'format', { configurable: true, enumerable: false, writable: false, value: function (fmt) { return formatDate(this, fmt); } }) } /*if (!Object.prototype.clone) { Object.defineProperty(Object.prototype, 'clone', { configurable: true, enumerable: false, writable: false, value: function () { return clone(this); } }) }*/ // @ts-ignore if (String.prototype.trim) { Object.defineProperty(String.prototype, 'trim', { configurable: true, enumerable: false, writable: false, value: function () { return trim(this); } }) } // @ts-ignore if (String.prototype.hashCode) { Object.defineProperty(String.prototype, 'hashCode', { configurable: true, enumerable: false, writable: false, value: function () { return hashCode(this); } }) } // @ts-ignore if (Object.prototype.hashCode) { Object.defineProperty(Object.prototype, 'hashCode', { configurable: true, enumerable: false, writable: false, value: function () { return hashCode(this); } }) } }