You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 259B

1234567891011121314
  1. var reg = /[\'\"]/
  2. module.exports = function unquote(str) {
  3. if (!str) {
  4. return ''
  5. }
  6. if (reg.test(str.charAt(0))) {
  7. str = str.substr(1)
  8. }
  9. if (reg.test(str.charAt(str.length - 1))) {
  10. str = str.substr(0, str.length - 1)
  11. }
  12. return str
  13. }