Skip to content

Commit

Permalink
v0.5.0-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenvachon committed May 4, 2019
1 parent e4ece2a commit 966febc
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 75 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
coverage/
lib-es5/
node_modules/
.nyc_output/
package-lock.json
4 changes: 3 additions & 1 deletion .travis.yml
@@ -1,5 +1,7 @@
language: node_js
node_js:
- 6
- 8
- 10
- 12
- node
script: npm run ci
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -11,7 +11,7 @@ Note: this library is not responsible for parsing any HTML.

## Installation

[Node.js](http://nodejs.org/) `>= 6` is required. To install, type this at the command line:
[Node.js](http://nodejs.org/) `>= 8` is required. To install, type this at the command line:
```shell
npm install robot-directives
```
Expand Down Expand Up @@ -118,7 +118,7 @@ The HTTP user-agent to use when retrieving instructions via `is()` and `isNot()`


[npm-image]: https://img.shields.io/npm/v/robot-directives.svg
[npm-url]: https://npmjs.org/package/robot-directives
[npm-url]: https://npmjs.com/package/robot-directives
[travis-image]: https://img.shields.io/travis/stevenvachon/robot-directives.svg
[travis-url]: https://travis-ci.org/stevenvachon/robot-directives
[coveralls-image]: https://img.shields.io/coveralls/stevenvachon/robot-directives.svg
Expand Down
28 changes: 13 additions & 15 deletions lib/group.js
Expand Up @@ -5,21 +5,19 @@ const removeNo = require("./removeNo");


const blank = () =>
{
return {
all: null,
archive: null,
cache: null,
follow: null,
imageindex: null,
index: null,
none: null,
odp: null,
snippet: null,
translate: null,
unavailable_after: null
};
};
({
all: null,
archive: null,
cache: null,
follow: null,
imageindex: null,
index: null,
none: null,
odp: null,
snippet: null,
translate: null,
unavailable_after: null
});



Expand Down
6 changes: 3 additions & 3 deletions lib/index.js
Expand Up @@ -11,7 +11,7 @@ const deepFreeze = require("deep-freeze-node");
const defaultOptions =
{
allIsReadonly: true,
currentTime: function(){ return Date.now() },
currentTime: () => Date.now(),
restrictive: true,
userAgent: ""
};
Expand All @@ -29,7 +29,7 @@ const is = (instance, directive, options, inverted, any) =>
else
{
// TODO :: use evaluate-value
options = Object.assign({}, instance.options, options);
options = { ...instance.options, ...options };

if (options.userAgent !== instance.options.userAgent)
{
Expand Down Expand Up @@ -85,7 +85,7 @@ class RobotDirectives
this.directives = { robots: group.initial() };
this.directives_flat = { robots: this.directives.robots };

this.options = Object.assign({}, defaultOptions, options);
this.options = { ...defaultOptions, ...options };

this.bot = parseBotAgent(this.options.userAgent);

Expand Down
34 changes: 20 additions & 14 deletions package.json
@@ -1,32 +1,38 @@
{
"name": "robot-directives",
"description": "Parse robot directives within HTML meta and/or HTTP headers.",
"version": "0.4.0",
"version": "0.5.0-alpha",
"license": "MIT",
"author": "Steven Vachon <contact@svachon.com> (https://www.svachon.com/)",
"author": "Steven Vachon <contact@svachon.com> (https://svachon.com)",
"repository": "github:stevenvachon/robot-directives",
"main": "lib",
"repository": "stevenvachon/robot-directives",
"browser": "lib-es5",
"dependencies": {
"deep-freeze-node": "^1.1.2",
"isbot": "^2.0.3",
"useragent": "^2.1.13"
"deep-freeze-node": "^1.1.3",
"isbot": "^2.2.1",
"useragent": "^2.3.0"
},
"devDependencies": {
"chai": "^4.0.2",
"coveralls": "^2.13.1",
"mocha": "^3.4.2",
"nyc": "^11.0.2"
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"chai": "^4.2.0",
"coveralls": "^3.0.3",
"mocha": "^6.1.4",
"nyc": "^14.0.0"
},
"engines": {
"node": ">= 6"
"node": ">= 8"
},
"scripts": {
"ci": "npm run test && nyc report --reporter=text-lcov | coveralls",
"posttest": "nyc report --reporter=html",
"test": "nyc --reporter=text-summary mocha test.js --reporter=spec --check-leaks --bail"
"posttest": "nyc report --reporter=text-summary --reporter=html",
"prepublishOnly": "npm test && babel lib/ --out-dir=lib-es5/ --presets=@babel/env --source-maps",
"test": "nyc --silent mocha test.js --check-leaks --bail"
},
"files": [
"lib"
"lib",
"lib-es5"
],
"keywords": [
"crawlers",
Expand Down

0 comments on commit 966febc

Please sign in to comment.