New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hltv

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hltv - npm Package Compare versions

Comparing version 2.9.0 to 2.9.1

3

lib/endpoints/getMatch.js

@@ -80,3 +80,4 @@ "use strict";

name: mappers_1.getMapSlug(mapEl.find('.mapname').text()),
result: mapEl.find('.results span').text()
result: mapEl.find('.results span').text(),
statsId: mapEl.find('.results-stats').length ? Number(mapEl.find('.results-stats').attr('href').split('/')[4]) : undefined
}); });

@@ -83,0 +84,0 @@ if (team1 && team2) {

@@ -5,3 +5,4 @@ import MapSlug from '../enums/MapSlug';

readonly result: string;
readonly statsId?: number;
}
export default MapResult;

@@ -18,3 +18,3 @@ /// <reference types="cheerio" />

};
export declare const mapRoundElementToModel: (team1Id: number, team2Id: number) => (el: Cheerio, i: number) => WeakRoundOutcome;
export declare const mapRoundElementToModel: (team1Id: number, team2Id: number) => (el: Cheerio, i: number, allRoundEls: Cheerio[]) => WeakRoundOutcome;
export declare const getMapsStatistics: (source: string) => {

@@ -21,0 +21,0 @@ [key: string]: MapStatistic;

@@ -101,13 +101,47 @@ "use strict";

};
exports.mapRoundElementToModel = function (team1Id, team2Id) { return function (el, i) {
var outcomeString = E.popSlashSource(el).split('.')[0];
var outcome = Object.entries(RoundOutcome_1.Outcome).find(function (_a) {
var _ = _a[0], v = _a[1];
return v === outcomeString;
});
exports.mapRoundElementToModel = function (team1Id, team2Id) { return function (el, i, allRoundEls) {
var getOutcome = function (el) {
var outcomeString = E.popSlashSource(el).split('.')[0];
var outcomeTuple = Object.entries(RoundOutcome_1.Outcome).find(function (_a) {
var _ = _a[0], v = _a[1];
return v === outcomeString;
});
return outcomeTuple && outcomeTuple[1];
};
var extractCTOutcomeSideInfo = function (index) {
if (index < 15) {
return {
firstHalfCt: team1Id,
secondHalfCt: team2Id,
firstHalfT: team2Id,
secondHalfT: team1Id
};
}
return {
firstHalfCt: team2Id,
secondHalfCt: team1Id,
firstHalfT: team1Id,
secondHalfT: team2Id
};
};
var extractTOutcomeSideInfo = function (index) {
if (index < 15) {
return extractCTOutcomeSideInfo(30);
}
return extractCTOutcomeSideInfo(0);
};
var outcome = getOutcome(el);
var ctOutcomes = [RoundOutcome_1.Outcome.BombDefused, RoundOutcome_1.Outcome.CTWin];
var tOutcomes = [RoundOutcome_1.Outcome.BombExploded, RoundOutcome_1.Outcome.TWin];
var ctOutcomeMarker = allRoundEls.findIndex(function (x) { return ctOutcomes.includes(getOutcome(x)); });
var tOutcomeMarker = allRoundEls.findIndex(function (x) { return tOutcomes.includes(getOutcome(x)); });
var outcomeSideInfo = ctOutcomeMarker !== -1
? extractCTOutcomeSideInfo(ctOutcomeMarker)
: extractTOutcomeSideInfo(tOutcomeMarker);
var isFirstHalf = i < 15 || (i >= 30 && i < 45);
return {
outcome: outcome && outcome[1],
outcome: outcome,
score: el.attr('title'),
ctTeam: i < 15 ? team1Id : team2Id,
tTeam: i < 15 ? team2Id : team1Id
ctTeam: isFirstHalf ? outcomeSideInfo.firstHalfCt : outcomeSideInfo.secondHalfCt,
tTeam: isFirstHalf ? outcomeSideInfo.firstHalfT : outcomeSideInfo.secondHalfT
};

@@ -114,0 +148,0 @@ }; };

{
"name": "hltv",
"version": "2.9.0",
"version": "2.9.1",
"description": "The unofficial HLTV Node.js API",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -27,2 +27,4 @@ [![Dependency Status](https://david-dm.org/gigobyte/hltv.svg)](https://david-dm.org/gigobyte/hltv)

- [getPlayer](#getplayer)
- [getPlayerStats](#getplayerstats)
- [getPlayerRanking](#getplayerranking)
- [getEvent](#getevent)

@@ -199,2 +201,3 @@ - [connectToScorebot](#connecttoscorebot)

```
**[See schema](https://github.com/gigobyte/HLTV/blob/master/src/models/TeamRanking.ts)**

@@ -258,2 +261,44 @@

#### getPlayerStats
Parses the info from `hltv.org/stats/players/*`
Option | Type | Default value | Description |
:---:|:---:|:---:|:---:|
id | int | - | - |
startDate | string | - | - |
endDate | string | - | - |
```javascript
HLTV.getPlayerStats({id: 7998}).then(res => {
...
})
```
**[See schema](https://github.com/gigobyte/HLTV/blob/master/src/models/FullPlayerStats.ts)**
***
#### getPlayerRanking
Parses the info from `hltv.org/stats/players` page
Option | Type | Default value | Description |
:---:|:---:|:---:|:---:|
startDate | string | - | - |
endDate | string | - | - |
```javascript
// If you don't provide a filter the latest ranking will be parsed
HLTV.getPlayerRanking({startDate: '2018-07-01', endDate: '2018-10-01'}).then(res => {
...
})
```
**[See schema](https://github.com/gigobyte/HLTV/blob/master/src/models/PlayerRanking.ts)**
***
### getEvent

@@ -260,0 +305,0 @@

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