Socket
Socket
Sign inDemoInstall

sitemapper

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sitemapper - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

25

lib/sitemapper.js

@@ -65,2 +65,10 @@ /* global require,module */

/**
* Callback for the getSites method
*
* @callback getSitesCallback
* @param {Object} error - error from callback
* @param {Array} sites - an Array of sitemaps
*/
/**
* Timeout in milliseconds

@@ -277,12 +285,23 @@ *

/**
* /**
* Gets the sites from a sitemap.xml with a given URL
* @deprecated
* @param {string} url - url to query
* @param {getSitesCallback} callback - callback for sites and error
* @callback
*/
}, {
key: 'getSites',
value: function getSites() {
var url = arguments.length <= 0 || arguments[0] === undefined ? this.url : arguments[0];
value: function getSites(url, callback) {
if (url === undefined) url = this.url;
(0, _deprecate2['default'])('Please upgrade to sitemapper@2.0.0 to use promises instead of callbacks.' + 'Use `.fetch()` instead of .getSites(). see http://github.com/hawaiianchimp/sitemapper ' + 'for more info.');
return this.fetch(url);
var err = {};
var sites = [];
this.fetch(url).then(function (response) {
sites = response.sites;
})['catch'](function (error) {
err = error;
});
return callback(err, sites);
}

@@ -289,0 +308,0 @@ }], [{

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

});
describe('getSites method', function () {
it('getSites should be backwards compatible', function (done) {
this.timeout(30000);
var url = 'http://wp.seantburke.com/sitemap.xml';
sitemapper.getSites(url, function (err, sites) {
sites.should.be.Array;
(0, _isUrl2['default'])(sites[0]).should.be['true'];
done();
});
});
});
});//# sourceMappingURL=test.map

4

package.json
{
"name": "sitemapper",
"version": "2.0.0",
"version": "2.1.0",
"description": "Parser for XML Sitemaps to be used with Robots.txt and web crawlers",

@@ -35,2 +35,3 @@ "keywords": [

"build": "npm run clean && broccoli build lib",
"preinstall": "rm -rf node_modules",
"postinstall": "npm run build",

@@ -78,3 +79,2 @@ "prestart": "npm run build",

"dependencies": {
"deprecate": "^0.1.0",
"es6-promise": "^3.2.1",

@@ -81,0 +81,0 @@ "request-promise": "^4.1.0",

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

## Sitemap-parser
## Sitemap-parser
[![Build Status](https://travis-ci.org/hawaiianchimp/sitemapper.svg?branch=master)](https://travis-ci.org/hawaiianchimp/sitemapper) [![Monthly Downloads](https://img.shields.io/npm/dm/sitemapper.svg)](https://www.npmjs.com/package/sitemapper)

@@ -7,8 +7,26 @@ [![npm version](https://badge.fury.io/js/sitemapper.svg)](https://badge.fury.io/js/sitemapper)

Parse through sitemaps to get all the urls for your crawler.
Parse through a sitemaps xml to get all the urls for your crawler.
##Version 2
#### Simple Implementation in ES5
### Installation
```bash
npm install sitemapper --save
```
### Simple Example
```javascript
var Sitemapper = require('sitemapper');
var sitemap = new Sitemapper();
sitemap.fetch('http://wp.seantburke.com/sitemap.xml').then(function(sites) {
console.log(sites);
});
```
### Examples in ES5
```javascript
var Sitemapper = require('sitemapper');
var Google = new Sitemapper({

@@ -32,2 +50,3 @@ url: 'https://www.google.com/work/sitemap.xml',

var sitemap = new Sitemapper();
sitemapper.timeout = 5000;

@@ -44,4 +63,4 @@ sitemapper.fetch('http://wp.seantburke.com/sitemap.xml')

#### Simple Implementation in ES6
```
### Examples in ES6
```javascript
import Sitemapper from 'sitemapper';

@@ -68,3 +87,22 @@

.catch(error => console.log(error));
```
##Version 1
```bash
npm install sitemapper@1.1.1 --save
```
###Simple Example
```javascript
var Sitemapper = require('sitemapper');
var sitemapper = new Sitemapper();
sitemapper.getSites('http://wp.seantburke.com/sitemap.xml', function(err, sites) {
if (!err) {
console.log(sites);
}
});
```

Sorry, the diff of this file is not supported yet

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