UNPKG

@azizbecha/strkit

Version:

strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.

28 lines 994 B
(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = encodeURL; /** * Encodes a URL or a string to ensure it is safe for use in a URL. * Converts special characters into their percent-encoded representations. * * @param url - The string or URL to encode. * @returns The encoded URL. * * @example * encodeURL("https://example.com/query?name=John Doe&age=25"); * // Output: "https://example.com/query?name=John%20Doe&age=25" */ function encodeURL(url) { return encodeURIComponent(url); } }); //# sourceMappingURL=encodeURL.js.map