mirror of
https://github.com/JasonYANG170/IOTConnect-Web.git
synced 2024-11-23 20:26:28 +00:00
19 lines
376 B
JavaScript
19 lines
376 B
JavaScript
"use strict";
|
|
|
|
var ensureString = require("type/string/ensure");
|
|
|
|
module.exports = function (str) {
|
|
var quote, i, char;
|
|
str = ensureString(str);
|
|
quote = str[0];
|
|
if (quote !== "'" && quote !== "\"") return false;
|
|
i = 0;
|
|
char = str[++i];
|
|
while (char) {
|
|
if (char === quote) break;
|
|
if (char === "\\") ++i;
|
|
char = str[++i];
|
|
}
|
|
return Boolean(char && !str[i + 1]);
|
|
};
|