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

robots-txt-parse

Package Overview
Dependencies
Maintainers
5
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

robots-txt-parse - npm Package Compare versions

Comparing version 0.0.4 to 1.0.0

.circleci/config.yml

1

lib/parse.js

@@ -32,2 +32,3 @@ 'use strict';

case 'disallow':
case 'noindex':
return {

@@ -34,0 +35,0 @@ type: GROUP_MEMBER,

9

package.json
{
"name": "robots-txt-parse",
"version": "0.0.4",
"version": "1.0.0",
"description": "Streaming parser for robots.txt files",
"main": "lib/parse.js",
"repository": {
"type": "git",
"url": "https://github.com/Woorank/robots-txt-parse"
},
"scripts": {
"test": "mocha -R spec ./test",
"test-watch": "mocha -w -R spec ./test"
"test-watch": "mocha -w -R spec ./test",
"version": "echo $npm_package_version"
},

@@ -10,0 +15,0 @@ "author": "Jan Potoms",

@@ -14,3 +14,2 @@ /*global describe, it*/

stream = fs.createReadStream(fixturePath);
stream.pause();
return stream;

@@ -21,3 +20,3 @@ }

describe('parser', function () {
it('should parse a simple group', function (done) {

@@ -32,3 +31,3 @@ parse(getFixture('single-group'))

assert.isObject(group);
assert.property(group, 'agents');

@@ -38,3 +37,3 @@ assert.isArray(group.agents);

assert.strictEqual(group.agents[0], '*');
assert.property(group, 'rules');

@@ -44,7 +43,7 @@ assert.isArray(group.rules);

var rule = group.rules[0];
assert.isObject(rule);
assert.propertyVal(rule, 'rule', 'disallow');
assert.propertyVal(rule, 'path', '/');
done();

@@ -54,3 +53,3 @@ })

});
it('should parse multiple agents', function (done) {

@@ -62,3 +61,3 @@ parse(getFixture('multiple-agents'))

assert.deepPropertyVal(parsed, 'groups[0].agents[2]', 'agent2');
done();

@@ -68,3 +67,3 @@ })

});
it('should ignore group members outside of a group', function (done) {

@@ -75,3 +74,3 @@ parse(getFixture('member-outside'))

assert.lengthOf(parsed.groups[0].agents, 1);
done();

@@ -81,3 +80,3 @@ })

});
it('should parse extensions', function (done) {

@@ -94,3 +93,3 @@ parse(getFixture('with-sitemap'))

});
it('should parse multiple groups', function (done) {

@@ -113,3 +112,3 @@ parse(getFixture('multiple-groups'))

assert.deepPropertyVal(parsed, 'groups[2].rules[0].path', '/path3');
done();

@@ -119,3 +118,24 @@ })

});
it('should parse noindex', function (done) {
parse(getFixture('noindex'))
.then(function (parsed) {
assert.deepPropertyVal(parsed, 'groups[0].agents[0]', '*');
assert.deepPropertyVal(parsed, 'groups[0].rules[0].rule', 'allow');
assert.deepPropertyVal(parsed, 'groups[0].rules[0].path', '/path1');
assert.deepPropertyVal(parsed, 'groups[0].rules[1].rule', 'disallow');
assert.deepPropertyVal(parsed, 'groups[0].rules[1].path', '/*/path2/');
assert.deepPropertyVal(parsed, 'groups[0].rules[2].rule', 'noindex');
assert.deepPropertyVal(parsed, 'groups[0].rules[2].path', '/*/path2/');
assert.deepPropertyVal(parsed, 'groups[0].rules[3].rule', 'noindex');
assert.deepPropertyVal(parsed, 'groups[0].rules[3].path', '/*/path3/');
done();
})
.catch(done);
});
});
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