All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.globalize.src.util.remove-literal-quotes.js Maven / Gradle / Ivy

There is a newer version: 1.2.2.1-jre17
Show newest version
define(function () {

    /**
     * removeLiteralQuotes( string )
     *
     * Return:
     * - `` if input string is `''`.
     * - `o'clock` if input string is `'o''clock'`.
     * - `foo` if input string is `foo`, i.e., return the same value in case it isn't a single-quoted
     *   string.
     */
    return function (string) {
        if (string[0] + string[string.length - 1] !== "''") {
            return string;
        }
        if (string === "''") {
            return "";
        }
        return string.replace(/''/g, "'").slice(1, -1);
    };

});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy