UNPKG

nhb-toolbox

Version:

A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.

13 lines (12 loc) 577 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.palindromePlugin = void 0; const guards_1 = require("../../string/guards"); const palindromePlugin = ($Chronos) => { $Chronos.prototype.isPalindromeDate = function (shortYear = false) { const padded = this.formatStrict(shortYear ? 'YY-MM-DD' : 'YYYY-MM-DD'); const normal = this.formatStrict(shortYear ? 'YY-M-D' : 'YYYY-M-D'); return (0, guards_1.isPalindrome)(padded) || (0, guards_1.isPalindrome)(normal); }; }; exports.palindromePlugin = palindromePlugin;