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

anumargak

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anumargak - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

6

package.json
{
"name": "anumargak",
"version": "2.0.0",
"version": "2.0.1",
"description": "Amazing fast multipurpose simple to use web/ HTTP router",

@@ -35,5 +35,5 @@ "main": "./src/letsRoute.js",

"benchmark": "^2.1.4",
"find-my-way": "^1.15.1",
"find-my-way": "^1.15.4",
"jasmine": "^3.2.0",
"jasmine-core": "^3.2.0",
"jasmine-core": "^3.2.1",
"mock-req": "^0.2.0",

@@ -40,0 +40,0 @@ "mock-res": "^0.5.0",

@@ -13,3 +13,3 @@ # अनुमार्गक (anumargak)

<a href="https://www.patreon.com/bePatron?u=9531404" data-patreon-widget-type="become-patron-button"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patron!" width="200" /></a>
<a href="https://www.paypal.me/amitguptagwl"> <img src="https://funcards.github.io/match-it/static/img/support_paypal.svg" alt="Paypal donate button" width="200"/></a>
<a href="http://paypal.me/amitkumarguptagwl"> <img src="https://funcards.github.io/match-it/static/img/support_paypal.svg" alt="Paypal donate button" width="200"/></a>

@@ -180,9 +180,9 @@ ## Features

## lookup(request, response)
## lookup(request, response, store)
This method reads *request* object to fetch url, method, and `accept-version` header to find matching route and then run the handler.
The handler should accept: request, response, and params. params is an object of path parameters.
The handler should accept: request, response, and store. *request._path.params* is an object of path parameters.
Lookup method also save _path, _queryStr, and _hashStr in request object to save re-effort of spliting them.
Lookup method also save _path, _queryStr, and _hashStr in request object to save re-effort of spliting them. *_path* is an object with two properties: url, params.

@@ -318,5 +318,22 @@ ## count

## Integration with other web frameworks
### Worth to mention
[Muneem](https://github.com/node-muneem/muneem) framework is already based on Anumargak. To use it with express js;
```js
const app = require("express")();
const Anumargak = require("anumargak");
const router = new Anumargak();
app.use((req,res) => router.lookup(req, res));
router.on("GET", "/", (req, res) => {
//..
});
app.listen(3002);
```
## Worth to mention
- **[निम्न (NIMN)](https://github.com/nimndata/spec)** : Save up to 85% network bandwidth and storage space.

@@ -337,2 +354,2 @@ - **[imglab](https://github.com/NaturalIntelligence/imglab)** : Speedup and simplify image labeling / annotation process online. Supports multiple formats, one click annotation, easy interface and much more.

I initially used *find-my-way* npm package for [मुनीम (Muneem)](https://github.com/muneem4node/muneem) framework. But then I realized that lookup for static URLs is comparitively slower. Hence I develop this library. If you notice, I tried to keep the naming convention and syntaxes common wherever possible to reduce the time to switch from one library to another and to keep learning curve smaller.
I initially used *find-my-way* npm package for [मुनीम (Muneem)](https://github.com/muneem4node/muneem) framework. But then I realized that lookup for static URLs is comparitively slower. Hence I develop this library. If you notice, I tried to keep the naming convention and syntaxes common wherever possible to reduce the time to switch from one library to another and to keep learning curve smaller.

@@ -19,3 +19,3 @@ 'use strict'

const supportedEvents = [ "request", "found", "not found", "route", "default" ];
const supportedEvents = [ "request", "found", "not found", "route", "default" , "end"];

@@ -40,2 +40,9 @@ Anumargak.prototype._onEvent = function (eventName, fn) {

Anumargak.prototype.on = function (method, url, options, fn, extraData) {
if (Array.isArray(url)) {
for (var i = 0; i < url.length; i++) {
this.on(method, url[i], options, fn, extraData);
}
return this;
}
if (typeof url === 'function') {

@@ -51,3 +58,7 @@ this._onEvent(method, url);

if (typeof method === "string") {
this._on(method, url, options, fn, extraData);
if( method.toLocaleLowerCase() === 'all'){
this.all(url, options, fn, extraData);
}else{
this._on(method, url, options, fn, extraData);
}
} else if (Array.isArray(method)) {

@@ -351,2 +362,3 @@ for (var i = 0; i < method.length; i++) {

}
this.eventEmitter.emit("end", req, res);

@@ -530,2 +542,2 @@

}
module.exports = Anumargak;
module.exports = Anumargak;

Sorry, the diff of this file is not supported yet

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