
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Simple reactive URL object
Note: uses Proxy, check browser support before using.
npm i unurl
const { url, onChange } = require('unurl')
onChange(() => {
// Fires when url changes
})
function changeURL() {
url.pathname = '/new-path'
url.searchParams.append('foo', 'bar')
}
const { url } = require('unurl')
const { connect } = require('unurl/react')
const ReactComponentConnectStyle = connect(() => {
// re-renders when url changes
})
const { useUrl } = require('unurl/react')
const ReactComponentEffectStyle = () => {
const url = useUrl()
// re-renders when url changes
}
const { url, searchParams, onChange, listen } = require('unurl')
urlA Proxy of new URL that fires onChange whenever a property is changed.
@property {string} hostname A String containing the domain of the URL.@property {string} pathname A String containing an initial '/' followed by the path of the URL.searchParamssearchParams but in an object-form with values parsed for easier consumption.
| Querystring | Object | Remark |
|---|---|---|
?a=b | { a: 'b' } | key=value converted to { key: value } |
?a=1 | { a: 1 } | JSON parsed ('1'1) |
?a, ?a= | { a: true } | Existence of key inferred as value true |
?a=1,b | { a: [1, 'b'] } | Comma-separated parsed as array |
onChangeA function to register a callback that's fired whenever url is changed, or when listening to browser events.
@param {function} callback Callback to fire when url changes@returns {function} unRegister Frees the callback from firing anymorelistenListen to browser events: click (on an <a> element), popstate, and hashchange to fire onChange.
@param {object} [opts]@param {Boolean|Object} [opts.click={}] Listen to click events on all <a> elements. Will prevent if href is from the same (current) hostname. Options will be passed to addEventListener.@returns {function} removeListener Removes and frees the attached event listenersReact-specific helper functions.
const { connect, useUrl } = require('unurl/react')
connectConverts a React Component into one that re-renders whenever url changes.
@param {ReactComponent|Function} component React Component or a function to wrap@returns {ReactComponent} component Wrapper Component that renders the above componentuseUrlFAQs
Simple reactive URL-like object
We found that unurl 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.