Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
url-lib
Advanced tools
Readme
A simple, lightweight string utility for Node and browsers that supports serializing and parsing URLs and query strings.
The primary use case is for building string URLs with query parameters for the Fetch API that is polyfilled in the browser via fetch
and in Node via node-fetch
libraries. isomorphic-fetch
combines the two.
url-lib
is derived from the Uize.Url
module that is a part of the open-source UIZE JavaScript Framework. It is stable, dependency-free, heavily-tested and well-documented.
Install via npm:
npm install --save url-lib
Install via Yarn:
yarn add url-lib
Use with Node, webpack or browserify:
import * as urllib from 'url-lib'; // ES6+
var urllib = require('url-lib'); // ES5-
import {formatUrl} from 'url-lib'
const url = formatUrl('http://www.benmvp.com/search?sort=recent&results=20&pg=1', {
sort: 'popular', // overwrites existing `sort` param in URL
category: 'holiday',
type: 'all',
results: 100, // overwrites existing `results` param in URL
})
With the above code, url
will be 'http://www.benmvp.com/search?sort=popular&results=100&pg=1&category=holiday&type=all'
Check out the docs for more usage examples or try out url-lib
in your browser!
formatQuery
- Serializes the properties of a params object to produce a URL query string.formatUrl
- Serializes the specified URL path with properties of a params object to produce a URL.parseQuery
- Parses query parameters from a string, returning the query parameters as an object.getCacheDefeatStr
- Returns a string value (generated using the time and a random number) that can be used as a query parameter value to cause a URL to be unique in order to defeat caching.parseUrl
- Parses the specified URL string into an object containing properties for the various logical segments.Contributions are welcome! See CONTRIBUTING for more details.
We take the stability of this utility package very seriously. url-lib
follows the SemVer standard for versioning.
All updates must pass the CI build while maintaining 100% code coverage.
MIT. Copyright (c) 2016- Ben Ilegbodu.
FAQs
A simple, lightweight string utility for Node and browsers that supports serializing and parsing URLs and query strings.
The npm package url-lib receives a total of 1,367 weekly downloads. As such, url-lib popularity was classified as popular.
We found that url-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.