Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

robots-txt-guard

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

robots-txt-guard - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

15

lib/guard.js

@@ -69,5 +69,18 @@ 'use strict';

function isDissalowAll(userAgent) {
var group = findGroup(userAgent);
if (group) {
var allowRules = group.rules.filter(function (rule) {
return rule.allow;
});
return allowRules.length <= 0;
}
// no group matched? assume allowed
return false;
}
return {
isAllowed: isAllowed
isAllowed: isAllowed,
isDissalowAll: isDissalowAll
};
};

4

package.json
{
"name": "robots-txt-guard",
"version": "0.0.2",
"version": "0.1.0",
"description": "Validate urls against robots.txt rules.",

@@ -14,5 +14,5 @@ "main": "lib/guard.js",

"chai": "^1.9.1",
"mocha": "^1.18.2"
"mocha": "^2.0.1"
},
"dependencies": {}
}

@@ -100,3 +100,26 @@ /*global describe, it*/

});
it('should detect disallow all', function () {
// both groups should behave the same, regardless of the order of the rules
var robotsTxt = guard({
groups: [{
agents: [ '*' ],
rules: [
{ rule: 'disallow', path: '/' }
]
}, {
agents: [ 'googlebot' ],
rules: [
{ rule: 'disallow', path: '/' },
{ rule: 'allow', path: '/fish' }
]
}]
});
assert.isTrue(robotsTxt.isDissalowAll('somebot'));
assert.isFalse(robotsTxt.isDissalowAll('googlebot'));
});
});
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