UNPKG

555 BJavaScriptView Raw
1"use strict";
2
3/**
4 * Plugin dependencies
5 */
6var Agent = require('../').Agent
7 , semver = require('semver');
8
9/**
10 * Checks if the user agent's version can be satisfied agents the give
11 * ranged argument. This uses the semver libraries range construction.
12 *
13 * @param {String} ranged The range the version has to satisfie
14 * @returns {Boolean}
15 * @api public
16 */
17Agent.prototype.satisfies = function satisfies (range) {
18 return semver.satisfies((Number(this.major) || 0) + '.' + (Number(this.minor) || 0) + '.' + (Number(this.patch) || 0), range);
19};