New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sheet-router

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sheet-router - npm Package Compare versions

Comparing version 4.0.0-0 to 4.0.1

test/href.js

18

create-location.js

@@ -21,5 +21,5 @@ const document = require('global/document')

search: document.location.search,
hash: document.location.hash
hash: document.location.hash,
href: document.location.href
}
newLocation.href = createHref(newLocation)
return newLocation

@@ -30,3 +30,2 @@ } else {

const newLocation = parseUrl(patch)
newLocation.href = createHref(newLocation)
return newLocation

@@ -36,3 +35,2 @@ } else {

const newLocation = xtend(state, patch)
newLocation.href = createHref(newLocation)
return newLocation

@@ -42,11 +40,2 @@ }

// compute a href similar to node's href
// (obj) -> str
function createHref (location) {
var ret = location.pathname
if (location.hash) ret += (location.hash)
if (location.search) ret += (location.search)
return ret
}
// parse a URL into a kv object inside the browser

@@ -59,3 +48,4 @@ // str -> obj

return {
href: a.pathname,
href: a.href,
pathname: a.pathname,
search: a.search,

@@ -62,0 +52,0 @@ hash: a.hash

@@ -11,4 +11,4 @@ const window = require('global/window')

// trailing '#' so empty links work as expected.
// fn(str) -> null
function href (cb) {
// (fn(str), obj?) -> undefined
function href (cb, root) {
assert.equal(typeof cb, 'function', 'sheet-router/href: cb must be a function')

@@ -20,3 +20,3 @@

const node = (function traverse (node) {
if (!node) return
if (!node || node === root) return
if (node.localName !== 'a') return traverse(node.parentNode)

@@ -23,0 +23,0 @@ if (node.href === undefined) return traverse(node.parentNode)

{
"name": "sheet-router",
"version": "4.0.0-0",
"version": "4.0.1",
"description": "Fast, modular client router",

@@ -34,2 +34,3 @@ "main": "index.js",

"noop2": "^2.0.0",
"sinon": "^1.17.5",
"standard": "^5.4.1",

@@ -36,0 +37,0 @@ "tape": "^4.4.0",

@@ -92,2 +92,11 @@ # sheet-router [![stability][0]][1]

Also, if you pass an optional `root` node reference as a second argument to `href`, it will never intercept clicks outside that node. This is useful when your app is confined to a widget in a larger document.
```js
href(function (href) {
router(href)
console.log('link was clicked: ' + href)
}, document.getElementById("app-root"))
```
### qs

@@ -94,0 +103,0 @@ Sometimes [query strings][mdn-qs] must be decoded. In order to do this, the

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc