Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

grapnel

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grapnel - npm Package Compare versions

Comparing version
0.6.3
to
0.6.4
+2
-2
bower.json
{
"name": "grapnel",
"version": "0.6.3",
"homepage": "https://github.com/bytecipher/grapnel",
"homepage": "https://github.com/baseprime/grapnel",
"authors": [
"Greg Sabia Tucker <greg@bytecipher.io>"
"Greg Sabia Tucker <greg@narrowlabs.com>"
],

@@ -8,0 +8,0 @@ "description": "The smallest (1100 bytes gzipped!) JavaScript Router with PushState & Named Parameters",

/****
* Grapnel
* https://github.com/bytecipher/grapnel
* https://github.com/baseprime/grapnel
*
* @author Greg Sabia Tucker <greg@bytecipher.io>
* @link http://bytecipher.io
* @version 0.6.3
* @author Greg Sabia Tucker <greg@narrowlabs.com>
* @link http://basepri.me
* @version 0.6.4
*

@@ -12,2 +12,2 @@ * Released under MIT License. See LICENSE.txt or http://opensource.org/licenses/MIT

!function(a){function b(b){"use strict";var c=this;return this.events={},this.state=null,this.options=b||{},this.options.env=this.options.env||(0===Object.keys(a).length&&process&&process.browser!==!0?"server":"client"),this.options.mode=this.options.mode||("server"!==this.options.env&&this.options.pushState&&a.history&&a.history.pushState?"pushState":"hashchange"),this.version="0.6.3","function"==typeof a.addEventListener&&(a.addEventListener("hashchange",function(){c.trigger("hashchange")}),a.addEventListener("popstate",function(a){return c.state&&null===c.state.previousState?!1:void c.trigger("navigate")})),this}function c(a,b){this.stack=c.global.slice(0),this.router=a,this.runCallback=!0,this.callbackRan=!1,this.propagateEvent=!0,this.value=a.path();for(var d in b)this[d]=b[d];return this}function d(a){this.route=a,this.keys=[],this.regex=b.regexRoute(a,this.keys)}b.regexRoute=function(a,b,c,d){return a instanceof RegExp?a:(a instanceof Array&&(a="("+a.join("|")+")"),a=a.concat(d?"":"/?").replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,function(a,c,d,e,f,g){return b.push({name:e,optional:!!g}),c=c||"",""+(g?"":c)+"(?:"+(g?c:"")+(d||"")+(f||d&&"([^/.]+?)"||"([^/]+?)")+")"+(g||"")}).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)"),new RegExp("^"+a+"$",c?"":"i"))},b._forEach=function(a,b){return"function"==typeof Array.prototype.forEach?Array.prototype.forEach.call(a,b):function(a,b){for(var c=0,d=this.length;d>c;++c)a.call(b,this[c],c,this)}.call(a,b)},b.prototype.get=b.prototype.add=function(a){var b=this,e=Array.prototype.slice.call(arguments,1,-1),f=Array.prototype.slice.call(arguments,-1)[0],g=new d(a),h=function(){var d=g.parse(b.path());if(d.match){var h={route:a,params:d.params,req:d,regex:d.match},i=new c(b,h).enqueue(e.concat(f));if(b.trigger("match",i,d),!i.runCallback)return b;if(i.previousState=b.state,b.state=i,i.parent()&&i.parent().propagateEvent===!1)return i.propagateEvent=!1,b;i.callback()}return b},i="pushState"!==b.options.mode&&"server"!==b.options.env?"hashchange":"navigate";return h().on(i,h)},b.prototype.trigger=function(a){var c=this,d=Array.prototype.slice.call(arguments,1);return this.events[a]&&b._forEach(this.events[a],function(a){a.apply(c,d)}),this},b.prototype.on=b.prototype.bind=function(a,c){var d=this,e=a.split(" ");return b._forEach(e,function(a){d.events[a]?d.events[a].push(c):d.events[a]=[c]}),this},b.prototype.once=function(a,b){var c=!1;return this.on(a,function(){return c?!1:(c=!0,b.apply(this,arguments),b=null,!0)})},b.prototype.context=function(a){var b=this,c=Array.prototype.slice.call(arguments,1);return function(){var d=arguments[0],e=arguments.length>2?Array.prototype.slice.call(arguments,1,-1):[],f=Array.prototype.slice.call(arguments,-1)[0],g="/"!==a.slice(-1)&&"/"!==d&&""!==d?a+"/":a,h="/"!==d.substr(0,1)?d:d.substr(1),i=g+h;return b.add.apply(b,[i].concat(c).concat(e).concat([f]))}},b.prototype.navigate=function(a){return this.path(a).trigger("navigate")},b.prototype.path=function(b){var c,d=this;return"string"==typeof b?("pushState"===d.options.mode?(c=d.options.root?d.options.root+b:b,a.history.pushState({},null,c)):a.location?a.location.hash=(d.options.hashBang?"!":"")+b:a._pathname=b||"",this):"undefined"==typeof b?c="pushState"===d.options.mode?a.location.pathname.replace(d.options.root,""):"pushState"!==d.options.mode&&a.location?a.location.hash?a.location.hash.split(d.options.hashBang?"#!":"#")[1]:"":a._pathname||"":b===!1?("pushState"===d.options.mode?a.history.pushState({},null,d.options.root||"/"):a.location&&(a.location.hash=d.options.hashBang?"!":""),d):void 0},b.listen=function(){var a,c;return arguments[0]&&arguments[1]?(a=arguments[0],c=arguments[1]):c=arguments[0],function(){for(var a in c)this.add.call(this,a,c[a]);return this}.call(new b(a||{}))},c.global=[],c.prototype.preventDefault=function(){this.runCallback=!1},c.prototype.stopPropagation=function(){this.propagateEvent=!1},c.prototype.parent=function(){var a=!(!this.previousState||!this.previousState.value||this.previousState.value!=this.value);return a?this.previousState:!1},c.prototype.callback=function(){this.callbackRan=!0,this.timeStamp=Date.now(),this.next()},c.prototype.enqueue=function(a,b){for(var c=Array.isArray(a)?b<a.length?a.reverse():a:[a];c.length;)this.stack.splice(b||this.stack.length+1,0,c.shift());return this},c.prototype.next=function(){var a=this;return this.stack.shift().call(this.router,this.req,this,function(){a.next.call(a)})},d.prototype.parse=function(a){var c=a.match(this.regex),d=this,e={params:{},keys:this.keys,matches:(c||[]).slice(1),match:c};return b._forEach(e.matches,function(a,b){var c=d.keys[b]&&d.keys[b].name?d.keys[b].name:b;e.params[c]=a?decodeURIComponent(a):void 0}),e},b.CallStack=c,b.Request=d,"function"!=typeof a.define||a.define.amd.grapnel?"object"==typeof module&&"object"==typeof module.exports?module.exports=exports=b:a.Grapnel=b:a.define(function(c,d,e){return a.define.amd.grapnel=!0,b})}.call({},"object"==typeof window?window:this);
!function(a){function b(b){"use strict";var c=this;return this.events={},this.state=null,this.options=b||{},this.options.env=this.options.env||(0===Object.keys(a).length&&process&&process.browser!==!0?"server":"client"),this.options.mode=this.options.mode||("server"!==this.options.env&&this.options.pushState&&a.history&&a.history.pushState?"pushState":"hashchange"),this.version="0.6.4","function"==typeof a.addEventListener&&(a.addEventListener("hashchange",function(){c.trigger("hashchange")}),a.addEventListener("popstate",function(a){return(!c.state||null!==c.state.previousState)&&void c.trigger("navigate")})),this}function c(a,b){this.stack=c.global.slice(0),this.router=a,this.runCallback=!0,this.callbackRan=!1,this.propagateEvent=!0,this.value=a.path();for(var d in b)this[d]=b[d];return this}function d(a){this.route=a,this.keys=[],this.regex=b.regexRoute(a,this.keys)}b.regexRoute=function(a,b,c,d){return a instanceof RegExp?a:(a instanceof Array&&(a="("+a.join("|")+")"),a=a.concat(d?"":"/?").replace(/\/\(/g,"(?:/").replace(/\+/g,"__plus__").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,function(a,c,d,e,f,g){return b.push({name:e,optional:!!g}),c=c||"",""+(g?"":c)+"(?:"+(g?c:"")+(d||"")+(f||d&&"([^/.]+?)"||"([^/]+?)")+")"+(g||"")}).replace(/([\/.])/g,"\\$1").replace(/__plus__/g,"(.+)").replace(/\*/g,"(.*)"),new RegExp("^"+a+"$",c?"":"i"))},b._forEach=function(a,b){return"function"==typeof Array.prototype.forEach?Array.prototype.forEach.call(a,b):function(a,b){for(var c=0,d=this.length;c<d;++c)a.call(b,this[c],c,this)}.call(a,b)},b.prototype.get=b.prototype.add=function(a){var b=this,e=Array.prototype.slice.call(arguments,1,-1),f=Array.prototype.slice.call(arguments,-1)[0],g=new d(a),h=function(){var d=g.parse(b.path());if(d.match){var h={route:a,params:d.params,req:d,regex:d.match},i=new c(b,h).enqueue(e.concat(f));if(b.trigger("match",i,d),!i.runCallback)return b;if(i.previousState=b.state,b.state=i,i.parent()&&i.parent().propagateEvent===!1)return i.propagateEvent=!1,b;i.callback()}return b},i="pushState"!==b.options.mode&&"server"!==b.options.env?"hashchange":"navigate";return h().on(i,h)},b.prototype.trigger=function(a){var c=this,d=Array.prototype.slice.call(arguments,1);return this.events[a]&&b._forEach(this.events[a],function(a){a.apply(c,d)}),this},b.prototype.on=b.prototype.bind=function(a,c){var d=this,e=a.split(" ");return b._forEach(e,function(a){d.events[a]?d.events[a].push(c):d.events[a]=[c]}),this},b.prototype.once=function(a,b){var c=!1;return this.on(a,function(){return!c&&(c=!0,b.apply(this,arguments),b=null,!0)})},b.prototype.context=function(a){var b=this,c=Array.prototype.slice.call(arguments,1);return function(){var d=arguments[0],e=arguments.length>2?Array.prototype.slice.call(arguments,1,-1):[],f=Array.prototype.slice.call(arguments,-1)[0],g="/"!==a.slice(-1)&&"/"!==d&&""!==d?a+"/":a,h="/"!==d.substr(0,1)?d:d.substr(1),i=g+h;return b.add.apply(b,[i].concat(c).concat(e).concat([f]))}},b.prototype.navigate=function(a){return this.path(a).trigger("navigate")},b.prototype.path=function(b){var c,d=this;return"string"==typeof b?("pushState"===d.options.mode?(c=d.options.root?d.options.root+b:b,a.history.pushState({},null,c)):a.location?a.location.hash=(d.options.hashBang?"!":"")+b:a._pathname=b||"",this):"undefined"==typeof b?c="pushState"===d.options.mode?a.location.pathname.replace(d.options.root,""):"pushState"!==d.options.mode&&a.location?a.location.hash?a.location.hash.split(d.options.hashBang?"#!":"#")[1]:"":a._pathname||"":b===!1?("pushState"===d.options.mode?a.history.pushState({},null,d.options.root||"/"):a.location&&(a.location.hash=d.options.hashBang?"!":""),d):void 0},b.listen=function(){var a,c;return arguments[0]&&arguments[1]?(a=arguments[0],c=arguments[1]):c=arguments[0],function(){for(var a in c)this.add.call(this,a,c[a]);return this}.call(new b(a||{}))},c.global=[],c.prototype.preventDefault=function(){this.runCallback=!1},c.prototype.stopPropagation=function(){this.propagateEvent=!1},c.prototype.parent=function(){var a=!(!this.previousState||!this.previousState.value||this.previousState.value!=this.value);return!!a&&this.previousState},c.prototype.callback=function(){this.callbackRan=!0,this.timeStamp=Date.now(),this.next()},c.prototype.enqueue=function(a,b){for(var c=Array.isArray(a)?b<a.length?a.reverse():a:[a];c.length;)this.stack.splice(b||this.stack.length+1,0,c.shift());return this},c.prototype.next=function(){var a=this;return this.stack.shift().call(this.router,this.req,this,function(){a.next.call(a)})},d.prototype.parse=function(a){var c=a.match(this.regex),d=this,e={params:{},keys:this.keys,matches:(c||[]).slice(1),match:c};return b._forEach(e.matches,function(a,b){var c=d.keys[b]&&d.keys[b].name?d.keys[b].name:b;e.params[c]=a?decodeURIComponent(a):void 0}),e},b.CallStack=c,b.Request=d,"function"!=typeof a.define||a.define.amd.grapnel?"object"==typeof module&&"object"==typeof module.exports?module.exports=exports=b:a.Grapnel=b:a.define(function(c,d,e){return a.define.amd.grapnel=!0,b})}.call({},"object"==typeof window?window:this);

@@ -9,3 +9,3 @@

" * Grapnel\n"+
" * https://github.com/bytecipher/grapnel\n"+
" * https://github.com/baseprime/grapnel\n"+
" *\n"+

@@ -12,0 +12,0 @@ " * @author <%= pkg.author %>\n"+

@@ -1,2 +0,2 @@

Copyright (c) 2012 Greg Sabia Tucker, http://bytecipher.io
Copyright (c) 2012 Greg Sabia Tucker, http://basepri.me

@@ -3,0 +3,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

{
"name": "grapnel",
"version": "0.6.3",
"version": "0.6.4",
"description": "The smallest JavaScript Router with PushState & Named Parameter support",

@@ -11,3 +11,3 @@ "main": "src/grapnel.js",

"type": "git",
"url": "https://github.com/bytecipher/grapnel.git"
"url": "https://github.com/baseprime/grapnel.git"
},

@@ -32,7 +32,7 @@ "keywords": [

],
"author": "Greg Sabia Tucker <greg@bytecipher.io>",
"link": "http://bytecipher.io",
"author": "Greg Sabia Tucker <greg@narrowlabs.com>",
"link": "http://basepri.me",
"license": "MIT",
"bugs": {
"url": "https://github.com/bytecipher/grapnel/issues"
"url": "https://github.com/baseprime/grapnel/issues"
},

@@ -39,0 +39,0 @@ "homepage": "http://grapnel.js.org",

@@ -10,4 +10,4 @@ Grapnel

- [Production](https://raw.githubusercontent.com/bytecipher/grapnel/master/dist/grapnel.min.js)
- [Development](https://raw.githubusercontent.com/bytecipher/grapnel/master/src/grapnel.js)
- [Production](https://raw.githubusercontent.com/baseprime/grapnel/master/dist/grapnel.min.js)
- [Development](https://raw.githubusercontent.com/baseprime/grapnel/master/src/grapnel.js)

@@ -22,3 +22,3 @@ **Install with npm**

```
**Server only:** (with HTTP methods added, [more info](https://github.com/bytecipher/grapnel/tree/server-router))
**Server only:** (with HTTP methods added, [more info](https://github.com/baseprime/grapnel/tree/server-router))
```bash

@@ -127,3 +127,3 @@ npm install grapnel-server

**This is now simplified as a separate package** ([more info](https://github.com/bytecipher/bytecipher/tree/server-router))
**This is now simplified as a separate package** ([more info](https://github.com/baseprime/grapnel/tree/server-router))
```bash

@@ -130,0 +130,0 @@ npm install grapnel-server

/****
* Grapnel
* https://github.com/bytecipher/grapnel
* https://github.com/baseprime/grapnel
*
* @author Greg Sabia Tucker <greg@bytecipher.io>
* @link http://bytecipher.io
* @version 0.6.3
* @author Greg Sabia Tucker <greg@narrowlabs.com>
* @link http://basepri.me
* @version 0.6.4
*

@@ -23,3 +23,3 @@ * Released under MIT License. See LICENSE.txt or http://opensource.org/licenses/MIT

this.options.mode = this.options.mode || (!!(this.options.env !== 'server' && this.options.pushState && root.history && root.history.pushState) ? 'pushState' : 'hashchange');
this.version = '0.6.3'; // Version
this.version = '0.6.4'; // Version

@@ -26,0 +26,0 @@ if ('function' === typeof root.addEventListener) {