META-INF.resources.bower_components.globalize.src.util.remove-literal-quotes.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-globalize Show documentation
Show all versions of jwebmp-globalize Show documentation
The JWebSwing implementation for a full Globalization
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);
};
});