NG1NDEX
Server IP : 150.95.80.236  /  Your IP : 3.144.224.32
Web Server : Apache
System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : social-telecare ( 10000)
PHP Version : 7.4.33
Disable Function : opcache_get_status
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/vhosts/pcu.in.th/uat.pcu.in.th/demo15/src/plugins/formvalidation/dist/amd/validators/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/vhosts/pcu.in.th/uat.pcu.in.th/demo15/src/plugins/formvalidation/dist/amd/validators/stringLength.js
define(["require", "exports", "../utils/format"], function (require, exports, format_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    function stringLength() {
        var utf8Length = function (str) {
            var s = str.length;
            for (var i = str.length - 1; i >= 0; i--) {
                var code = str.charCodeAt(i);
                if (code > 0x7f && code <= 0x7ff) {
                    s++;
                }
                else if (code > 0x7ff && code <= 0xffff) {
                    s += 2;
                }
                if (code >= 0xdc00 && code <= 0xdfff) {
                    i--;
                }
            }
            return "" + s;
        };
        return {
            validate: function (input) {
                var opts = Object.assign({}, {
                    message: '',
                    trim: false,
                    utf8Bytes: false,
                }, input.options);
                var v = opts.trim === true || "" + opts.trim === 'true' ? input.value.trim() : input.value;
                if (v === '') {
                    return { valid: true };
                }
                var min = opts.min ? "" + opts.min : '';
                var max = opts.max ? "" + opts.max : '';
                var length = opts.utf8Bytes ? utf8Length(v) : v.length;
                var isValid = true;
                var msg = input.l10n ? opts.message || input.l10n.stringLength.default : opts.message;
                if ((min && length < parseInt(min, 10)) || (max && length > parseInt(max, 10))) {
                    isValid = false;
                }
                switch (true) {
                    case !!min && !!max:
                        msg = (0, format_1.default)(input.l10n ? opts.message || input.l10n.stringLength.between : opts.message, [
                            min,
                            max,
                        ]);
                        break;
                    case !!min:
                        msg = (0, format_1.default)(input.l10n ? opts.message || input.l10n.stringLength.more : opts.message, "" + parseInt(min, 10));
                        break;
                    case !!max:
                        msg = (0, format_1.default)(input.l10n ? opts.message || input.l10n.stringLength.less : opts.message, "" + parseInt(max, 10));
                        break;
                    default:
                        break;
                }
                return {
                    message: msg,
                    valid: isValid,
                };
            },
        };
    }
    exports.default = stringLength;
});

Anon7 - 2022
AnonSec Team