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

isbot

Package Overview
Dependencies
Maintainers
2
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isbot - npm Package Compare versions

Comparing version 3.6.0 to 3.6.1

131

index.js

@@ -6,3 +6,2 @@ function _classCallCheck(instance, Constructor) {

}
function _defineProperties(target, props) {

@@ -17,3 +16,2 @@ for (var i = 0; i < props.length; i++) {

}
function _createClass(Constructor, protoProps, staticProps) {

@@ -27,3 +25,2 @@ if (protoProps) _defineProperties(Constructor.prototype, protoProps);

}
function _defineProperty(obj, key, value) {

@@ -40,17 +37,12 @@ if (key in obj) {

}
return obj;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;

@@ -60,9 +52,6 @@ var _arr = [];

var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;

@@ -80,6 +69,4 @@ }

}
return _arr;
}
function _unsupportedIterableToArray(o, minLen) {

@@ -93,29 +80,19 @@ if (!o) return;

}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {

@@ -125,6 +102,4 @@ if (!privateMap.has(receiver)) {

}
return privateMap.get(receiver);
}
function _classApplyDescriptorGet(receiver, descriptor) {

@@ -134,6 +109,4 @@ if (descriptor.get) {

}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {

@@ -146,7 +119,5 @@ if (descriptor.set) {

}
descriptor.value = value;
}
}
function _classPrivateMethodGet(receiver, privateSet, fn) {

@@ -156,6 +127,4 @@ if (!privateSet.has(receiver)) {

}
return fn;
}
function _checkPrivateRedeclaration(obj, privateCollection) {

@@ -166,12 +135,8 @@ if (privateCollection.has(obj)) {

}
function _classPrivateFieldInitSpec(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateMethodInitSpec(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet);
privateSet.add(obj);

@@ -182,2 +147,3 @@ }

" daum[ /]",
" DCV$",
" deusu/",

@@ -192,3 +158,3 @@ "(?:^| )site",

"^[\\w \\.]+/v?\\d+(\\.\\d+)?(\\.\\d{1,10})?$",
"^[\\w]+$",
"^[\\w\\-]+$",
"^[^ ]{50,}$",

@@ -235,3 +201,2 @@ "^ace explorer",

"^hwcdn/",
"^infox-wisg",
"^invision",

@@ -272,3 +237,2 @@ "^jeode/",

"^reed",
"^request-promise$",
"^restsharp/",

@@ -304,2 +268,3 @@ "^shareaza",

"^zoom marketplace/",
"^{{.*}}$",
"adbeat\\.com",

@@ -331,3 +296,2 @@ "appinsights",

"feed",
"fetch",
"firephp",

@@ -345,3 +309,3 @@ "freesafeip",

"images",
"index",
"iplabel",
"ips-agent",

@@ -359,2 +323,3 @@ "java",

"optimize",
"pageburst",
"pagespeed",

@@ -418,22 +383,20 @@ "parse",

return list;
} // Addresses: Cubot device
list.splice(list.lastIndexOf('bot'), 1);
list.push('(?<! cu)bot'); // Addresses: Android webview
list.splice(list.lastIndexOf('google'), 1);
list.push('(?<! (channel/|google/))google(?!(app|/google| pixel))'); // Addresses: Yandex browser
list.splice(list.lastIndexOf('search'), 1);
list.push('(?<! (ya|yandex))search'); // Addresses: libhttp browser
list.splice(list.lastIndexOf('http'), 1);
list.push('(?<!(lib))http'); // Addresses: java based browsers
list.splice(list.lastIndexOf('java'), 1);
list.push('java(?!;)'); // Addresses: Mozilla nightly build https://github.com/mozilla-mobile/android-components/search?q=MozacFetch
list.splice(list.lastIndexOf('fetch'), 1);
list.push('(?<!(mozac))fetch');
}
[
// Addresses: Cubot device
['bot', '(?<! cu)bot'],
// Addresses: Android webview
['google', '(?<! (channel/|google/))google(?!(app|/google| pixel))'],
// Addresses: libhttp browser
['http', '(?<!(lib))http'],
// Addresses: java based browsers
['java', 'java(?!;)']].forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
search = _ref2[0],
replace = _ref2[1];
var index = list.lastIndexOf(search);
if (~index) {
list.splice(index, 1, replace);
}
});
return list;

@@ -444,14 +407,10 @@ }

var flags = 'i';
/**
* Test user agents for matching patterns
*/
var _list = /*#__PURE__*/new WeakMap();
var _pattern = /*#__PURE__*/new WeakMap();
var _update = /*#__PURE__*/new WeakSet();
var _index = /*#__PURE__*/new WeakSet();
var Isbot = /*#__PURE__*/function () {

@@ -465,11 +424,8 @@ /**

*/
function Isbot(patterns) {
var _this = this;
_classCallCheck(this, Isbot);
_classPrivateMethodInitSpec(this, _index);
_classPrivateMethodInitSpec(this, _update);
_classPrivateFieldInitSpec(this, _list, {

@@ -479,3 +435,2 @@ writable: true,

});
_classPrivateFieldInitSpec(this, _pattern, {

@@ -485,16 +440,11 @@ writable: true,

});
_classPrivateFieldSet(this, _list, patterns || list.slice());
_classPrivateMethodGet(this, _update, _update2).call(this);
var isbot = function isbot(ua) {
return _this.test(ua);
};
return Object.defineProperties(isbot, Object.entries(Object.getOwnPropertyDescriptors(Isbot.prototype)).reduce(function (accumulator, _ref) {
var _ref2 = _slicedToArray(_ref, 2),
prop = _ref2[0],
descriptor = _ref2[1];
prop = _ref2[0],
descriptor = _ref2[1];
if (typeof descriptor.value === 'function') {

@@ -505,3 +455,2 @@ Object.assign(accumulator, _defineProperty({}, prop, {

}
if (typeof descriptor.get === 'function') {

@@ -514,11 +463,9 @@ Object.assign(accumulator, _defineProperty({}, prop, {

}
return accumulator;
}, {}));
}
/**
* Recreate the pattern from rules list
*/
_createClass(Isbot, [{

@@ -534,2 +481,3 @@ key: "pattern",

}
/**

@@ -540,3 +488,2 @@ * Match given string against out pattern

*/
}, {

@@ -547,2 +494,3 @@ key: "test",

}
/**

@@ -553,3 +501,2 @@ * Get the match for strings' known crawler pattern

*/
}, {

@@ -562,2 +509,3 @@ key: "find",

}
/**

@@ -568,3 +516,2 @@ * Get the patterns that match user agent string if any

*/
}, {

@@ -578,2 +525,3 @@ key: "matches",

}
/**

@@ -584,3 +532,2 @@ * Clear all patterns that match user agent

*/
}, {

@@ -592,2 +539,3 @@ key: "clear",

}
/**

@@ -598,3 +546,2 @@ * Extent patterns for known crawlers

*/
}, {

@@ -604,3 +551,2 @@ key: "extend",

var _this2 = this;
var filters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];

@@ -612,5 +558,5 @@ [].push.apply(_classPrivateFieldGet(this, _list), filters.filter(function (rule) {

}));
_classPrivateMethodGet(this, _update, _update2).call(this);
}
/**

@@ -621,3 +567,2 @@ * Exclude patterns from bot pattern rule

*/
}, {

@@ -628,6 +573,4 @@ key: "exclude",

var length = filters.length;
while (length--) {
var index = _classPrivateMethodGet(this, _index, _index2).call(this, filters[length]);
if (index > -1) {

@@ -637,5 +580,5 @@ _classPrivateFieldGet(this, _list).splice(index, 1);

}
_classPrivateMethodGet(this, _update, _update2).call(this);
}
/**

@@ -646,3 +589,2 @@ * Create a new Isbot instance using given list or self's list

*/
}, {

@@ -654,10 +596,7 @@ key: "spawn",

}]);
return Isbot;
}();
function _update2() {
_classPrivateFieldSet(this, _pattern, new RegExp(_classPrivateFieldGet(this, _list).join('|'), flags));
}
function _index2(rule) {

@@ -664,0 +603,0 @@ return _classPrivateFieldGet(this, _list).indexOf(rule.toLowerCase());

{
"name": "isbot",
"version": "3.6.0",
"version": "3.6.1",
"description": "🤖 detect bots/crawlers/spiders via the user agent.",

@@ -78,12 +78,12 @@ "keywords": [

"devDependencies": {
"@babel/eslint-parser": "^7.18.2",
"@babel/eslint-parser": "^7.19.1",
"@babel/plugin-syntax-import-assertions": "^7.18.6",
"@babel/preset-env": "^7.18.10",
"@babel/preset-env": "^7.19.4",
"@lets/wait": "^2.0.2",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-node-resolve": "^14.0.1",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"acorn-import-assertions": "^1.8.0",
"eslint-plugin-log": "^1.2.6",
"form-data": "^4.0.0",
"karma": "^6.4.0",
"karma": "^6.4.1",
"karma-chrome-launcher": "^3.1.1",

@@ -98,10 +98,10 @@ "karma-cli": "^2.0.0",

"remark-preset-lint-recommended": "^6.0.0",
"rollup": "^2.78.1",
"rollup": "^2.79.1",
"rollup-plugin-import-assert": "^2.1.0",
"standard": "^17.0.0",
"stdline": "^1.0.0",
"typescript": "^4.7.4",
"user-agents": "^1.0.1117",
"yaml": "^2.1.1"
"typescript": "^4.8.4",
"user-agents": "^1.0.1164",
"yaml": "^2.1.3"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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