Huge News!Announcing our $40M Series B led by Abstract Ventures.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.14.1 to 2.14.2

lib/models/OddResult.d.ts

56

lib/endpoints/getMatch.js

@@ -44,3 +44,3 @@ "use strict";

return __awaiter(_this, void 0, void 0, function () {
var $, title, date, format, additionalInfo, live, hasScorebot, teamEls, team1, team2, winnerTeam, vetoes, event, maps, players, streams, demos, highlightedPlayerLink, highlightedPlayer, headToHead, highlights;
var $, title, date, format, additionalInfo, live, hasScorebot, teamEls, team1, team2, winnerTeam, vetoes, event, odds, oddsCommunity, maps, players, streams, demos, highlightedPlayerLink, highlightedPlayer, headToHead, highlights;
return __generator(this, function (_b) {

@@ -106,2 +106,52 @@ switch (_b.label) {

};
odds = mappers_1.toArray($('.betting_provider:not(.hidden)'))
.filter(parsing_1.hasNoChild('.noOdds'))
.map(function (oddElement) {
var convertOdds = oddElement
.find('.odds-cell')
.first()
.text()
.indexOf('%') >= 0
? true
: false;
var oddTeam1 = Number(oddElement
.find('.odds-cell')
.first()
.find('a')
.text()
.replace('%', ''));
var oddTeam2 = Number(oddElement
.find('.odds-cell')
.last()
.find('a')
.text()
.replace('%', ''));
if (convertOdds) {
oddTeam1 = parsing_1.percentageToDecimalOdd(oddTeam1);
oddTeam2 = parsing_1.percentageToDecimalOdd(oddTeam2);
}
return {
provider: oddElement
.prop('class')
.split('geoprovider_')[1]
.split(' ')[0]
.trim(),
team1: oddTeam1,
team2: oddTeam2
};
});
if ($('.pick-a-winner-team').length == 2) {
oddsCommunity = {
team1: parsing_1.percentageToDecimalOdd(Number($('.pick-a-winner-team')
.first()
.find('.percentage')
.text()
.replace('%', ''))),
team2: parsing_1.percentageToDecimalOdd(Number($('.pick-a-winner-team')
.last()
.find('.percentage')
.text()
.replace('%', '')))
};
}
maps = mappers_1.toArray($('.mapholder')).map(function (mapEl) { return ({

@@ -223,3 +273,5 @@ name: mappers_1.getMapSlug(mapEl.find('.mapname').text()),

highlights: highlights,
demos: demos
demos: demos,
odds: odds,
oddsCommunity: oddsCommunity
}];

@@ -226,0 +278,0 @@ }

@@ -10,2 +10,3 @@ import { Team } from './Team';

import { Highlight } from './Highlight';
import { OddResult, CommunityOddResult } from './OddResult';
export interface FullMatch {

@@ -34,2 +35,4 @@ readonly id: number;

readonly highlights?: Highlight[];
readonly odds?: OddResult[];
readonly oddsCommunity?: CommunityOddResult;
}

2

lib/playground.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("./index");
index_1.default.getTeam({ id: 9481 })
index_1.default.getMatch({ id: 2332676 })
.then(function (res) { return console.dir(res, { depth: null }); })
.catch(function (err) { return console.log(err); });

@@ -5,2 +5,4 @@ /// <reference types="cheerio" />

export declare const hasChild: (childSelector: string) => (el: Cheerio) => boolean;
export declare const hasNoChild: (childSelector: string) => (el: Cheerio) => boolean;
export declare const popSlashSource: (el: Cheerio) => string | undefined;
export declare const percentageToDecimalOdd: (odd: number) => number;

@@ -8,2 +8,5 @@ "use strict";

}; };
exports.hasNoChild = function (childSelector) { return function (el) {
return el.find(childSelector).length === 0;
}; };
exports.popSlashSource = function (el) {

@@ -15,1 +18,4 @@ return el

};
exports.percentageToDecimalOdd = function (odd) {
return parseFloat(((1 / odd) * 100).toFixed(2));
};
{
"name": "hltv",
"version": "2.14.1",
"version": "2.14.2",
"description": "The unofficial HLTV Node.js API",

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

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