UNPKG

@cloudinary/url-gen

Version:

Cloudinary URL-Gen SDK ========================= [![Build Status](https://api.travis-ci.com/cloudinary/js-url-gen.svg?branch=master)](https://app.travis-ci.com/github/cloudinary/js-url-gen) ## About The Cloudinary URL-Gen SDK allows you to quickly and eas

18 lines (14 loc) 585 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); // Based on CGI::unescape. In addition does not escape / : // smart_escape = (string)-> // encodeURIComponent(string).replace(/%3A/g, ":").replace(/%2F/g, "/") function smartEscape(string, unsafe) { if (unsafe === void 0) { unsafe = /([^a-zA-Z0-9_.\-\/:]+)/g; } return string.replace(unsafe, function (match) { return match.split("").map(function (c) { return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }).join(""); }); } exports.smartEscape = smartEscape;