url

This tag does URL encode and decode

Created by: hackvertor
Installed 1 times

Category: Convert

Created on: Friday, September 20, 2024 at 11:11:12 AM

Updated on: Tuesday, January 7, 2025 at 10:58:57 PM

This is a built in tag
Tag arguments
[]
Code
class url {
  encode(input) {
    return encodeURIComponent(input);
  }

  decode(input) {
    return decodeURIComponent(input);
  }

  matches(input) {
    if (!/%[a-f0-9]{2}/i.test(input)) {
      return null;
    }
    // Do don't this normally, this is just for the URL encoding specific case
    return /^[\s\S]+$/i.exec(input);
  }
}