Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/magento/module-ui/view/base/web/js/lib/validation/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-ui/view/base/web/js/lib/validation/utils.js
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @api
 */
define(function () {
    'use strict';

    var utils = {
        /**
         * Check if string is empty with trim.
         *
         * @param {String} value
         * @return {Boolean}
         */
        isEmpty: function (value) {
            return value === '' || value == null || value.length === 0 || /^\s+$/.test(value);
        },

        /**
         * Check if string is empty no trim.
         *
         * @param {String} value
         * @return {Boolean}
         */
        isEmptyNoTrim: function (value) {
            return value === '' || value == null || value.length === 0;
        },

        /**
         * Checks if {value} is between numbers {from} and {to}.
         *
         * @param {String} value
         * @param {String} from
         * @param {String} to
         * @return {Boolean}
         */
        isBetween: function (value, from, to) {
            return (from === null || from === '' || value >= utils.parseNumber(from)) &&
                   (to === null || to === '' || value <= utils.parseNumber(to));
        },

        /**
         * Parse price string.
         *
         * @param {String} value
         * @return {Number}
         */
        parseNumber: function (value) {
            var isDot, isComa;

            if (typeof value !== 'string') {
                return parseFloat(value);
            }
            isDot = value.indexOf('.');
            isComa = value.indexOf(',');

            if (isDot !== -1 && isComa !== -1) {
                if (isComa > isDot) {
                    value = value.replace('.', '').replace(',', '.');
                } else {
                    value = value.replace(',', '');
                }
            } else if (isComa !== -1) {
                value = value.replace(',', '.');
            }

            return parseFloat(value);
        },

        /**
         * Removes HTML tags and space characters, numbers and punctuation.
         *
         * @param {String} value -  Value being stripped.
         * @return {String}
         */
        stripHtml: function (value) {
            return value.replace(/<.[^<>]*?>/g, ' ').replace(/&nbsp;|&#160;/gi, ' ')
                .replace(/[0-9.(),;:!?%#$'"_+=\/-]*/g, '');
        }
    };

    return utils;
});

Spamworldpro Mini