UNPKG

coersystem

Version:

Library for Angular projects

167 lines (161 loc) 5.1 kB
import { Collections, Dates, Strings, Tools } from 'coersystem/tools'; Array.prototype.distinct = function () { return Collections.Distinct(this); }; Array.prototype.except = function (exceptions) { return Collections.Except(this, exceptions); }; Date.prototype.getOffset = function () { return Dates.GetOffset(); }; Date.prototype.getLastDay = function () { return Dates.GetLastDay(this); }; Date.prototype.isValidDate = function () { return Dates.IsValidDate(this); }; Date.prototype.getCurrentDate = function () { return Dates.GetCurrentDate(); }; Date.prototype.toLocalZone = function () { return Dates.ToLocalZone(this); }; Date.prototype.toUTC = function () { return Dates.ToUTC(this); }; Date.prototype.toFormatDB = function () { return Dates.ToFormatDB(this); }; Date.prototype.toFormatDate = function (format) { return Dates.ToFormatDate(this, format); }; Date.prototype.toFormatDateTime = function (ampm = true, format) { return Dates.ToFormatDateTime(this, ampm, format); }; Date.prototype.addMilliseconds = function (milliseconds = 1) { return Dates.AddMilliseconds(this, milliseconds); }; Date.prototype.addSeconds = function (seconds = 1) { return Dates.AddSeconds(this, seconds); }; Date.prototype.addMinutes = function (minutes = 1) { return Dates.AddMinutes(this, minutes); }; Date.prototype.addHours = function (hours = 1) { return Dates.AddHours(this, hours); }; Date.prototype.addDays = function (days = 1) { return Dates.AddDays(this, days); }; Date.prototype.addWeeks = function (weeks = 1) { return Dates.AddWeeks(this, weeks); }; Date.prototype.addMonths = function (months = 1) { return Dates.AddMonths(this, months); }; Date.prototype.addYears = function (years = 1) { return Dates.AddYears(this, years); }; Date.prototype.setMillisecond = function (millisecond = 0) { return Dates.SetMillisecond(this, millisecond); }; Date.prototype.setSecond = function (second = 0) { return Dates.SetSecond(this, second); }; Date.prototype.setMinute = function (minute = 0) { return Dates.SetMinute(this, minute); }; Date.prototype.setHour = function (hour = 0) { return Dates.SetHour(this, hour); }; Date.prototype.setFirstHour = function () { return Dates.SetFirstHour(this); }; Date.prototype.setLastHour = function () { return Dates.SetLastHour(this); }; Date.prototype.setDay = function (day = 1) { return Dates.SetDay(this, day); }; Date.prototype.setFirstDay = function () { return Dates.SetFirstDay(this); }; Date.prototype.setLastDay = function () { return Dates.SetLastDay(this); }; Date.prototype.getDiffNow = function (unit = 'minutes') { return Dates.GetDiffNow(this, unit); }; Date.prototype.getDiff = function (date, unit = 'minutes') { return Dates.GetDiff(this, date, unit); }; //import { Tools } from "coersystem/tools"; // //declare global { // interface Object { // // /** Avoid Null value */ // AvoidNull<T>(type: 'string' | 'number' | 'boolean' | null): T; // // /** Get properties of an object */ // GetPropertyList(): string[]; // // /** Break reference of a object or array */ // BreakReference<T>(object: T): T; // } //} // //Object.prototype.AvoidNull = function<T>(type: 'string' | 'number' | 'boolean' | null = null): T { // return Tools.AvoidNull<T>(this as T, type); //} // //Object.prototype.GetPropertyList = function(): string[] { // return Tools.GetPropertyList(this); //} // //Object.prototype.BreakReference = function<T>(): T { // return Tools.BreakReference<T>(this as T); //} String.prototype.firstCharToLower = function () { return Strings.FirstCharToLower(this.toString()); }; String.prototype.firstCharToUpper = function () { return Strings.FirstCharToUpper(this.toString()); }; String.prototype.cleanUpBlanks = function () { return Strings.CleanUpBlanks(this.toString()); }; String.prototype.toTitle = function () { return Strings.ToTitle(this.toString()); }; String.prototype.removeWhiteSpaces = function () { return Strings.RemoveWhiteSpaces(this.toString()); }; String.prototype.removeLastChar = function () { return Strings.RemoveLastChar(this.toString()); }; String.prototype.removeAccents = function (except = []) { return Strings.RemoveAccents(this.toString(), except); }; String.prototype.removeSpecialCharacters = function () { return Strings.RemoveSpecialCharacters(this.toString()); }; String.prototype.onlyAlphanumeric = function () { return Strings.OnlyAlphanumeric(this.toString()); }; String.prototype.onlyNumbers = function () { return Strings.OnlyNumbers(this.toString()); }; String.prototype.equals = function (value, sensitive = false) { return Strings.Equals(this.toString(), value, sensitive); }; String.prototype.isOnlyWhiteSpace = function () { return Tools.IsOnlyWhiteSpace(this); }; String.prototype.isNotOnlyWhiteSpace = function () { return Tools.IsNotOnlyWhiteSpace(this); }; /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=coersystem-extensions.mjs.map