Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
# profile-parser
# profile-parser

Parse warframe profile data into useable javascript objects.

[![Supported by the Warframe Community Developers](https://img.shields.io/badge/Warframe_Comm_Devs-supported-blue.svg?color=2E96EF&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyOTgiIGhlaWdodD0iMTczIiB2aWV3Qm94PSIwIDAgMjk4IDE3MyI%2BPHBhdGggZD0iTTE4NSA2N2MxNSA4IDI4IDE2IDMxIDE5czIzIDE4LTcgNjBjMCAwIDM1LTMxIDI2LTc5LTE0LTctNjItMzYtNzAtNDUtNC01LTEwLTEyLTE1LTIyLTUgMTAtOSAxNC0xNSAyMi0xMyAxMy01OCAzOC03MiA0NS05IDQ4IDI2IDc5IDI2IDc5LTMwLTQyLTEwLTU3LTctNjBsMzEtMTkgMzYtMjIgMzYgMjJ6TTU1IDE3M2wtMTctM2MtOC0xOS0yMC00NC0yNC01MC01LTctNy0xMS0xNC0xNWwxOC0yYzE2LTMgMjItNyAzMi0xMyAxIDYgMCA5IDIgMTQtNiA0LTIxIDEwLTI0IDE2IDMgMTQgNSAyNyAyNyA1M3ptMTYtMTFsLTktMi0xNC0yOWEzMCAzMCAwIDAgMC04LThoN2wxMy00IDQgN2MtMyAyLTcgMy04IDZhODYgODYgMCAwIDAgMTUgMzB6bTE3MiAxMWwxNy0zYzgtMTkgMjAtNDQgMjQtNTAgNS03IDctMTEgMTQtMTVsLTE4LTJjLTE2LTMtMjItNy0zMi0xMy0xIDYgMCA5LTIgMTQgNiA0IDIxIDEwIDI0IDE2LTMgMTQtNSAyNy0yNyA1M3ptLTE2LTExbDktMiAxNC0yOWEzMCAzMCAwIDAgMSA4LThoLTdsLTEzLTQtNCA3YzMgMiA3IDMgOCA2YTg2IDg2IDAgMCAxLTE1IDMwem0tNzktNDBsLTYtNmMtMSAzLTMgNi02IDdsNSA1YTUgNSAwIDAgMSAyIDB6bS0xMy0yYTQgNCAwIDAgMSAxLTJsMi0yYTQgNCAwIDAgMSAyLTFsNC0xNy0xNy0xMC04IDcgMTMgOC0yIDctNyAyLTgtMTItOCA4IDEwIDE3em0xMiAxMWE1IDUgMCAwIDAtNC0yIDQgNCAwIDAgMC0zIDFsLTMwIDI3YTUgNSAwIDAgMCAwIDdsNCA0YTYgNiAwIDAgMCA0IDIgNSA1IDAgMCAwIDMtMWwyNy0zMWMyLTIgMS01LTEtN3ptMzkgMjZsLTMwLTI4LTYgNmE1IDUgMCAwIDEgMCAzbDI2IDI5YTEgMSAwIDAgMCAxIDBsNS0yIDItMmMxLTIgMy01IDItNnptNS00NWEyIDIgMCAwIDAtNCAwbC0xIDEtMi00YzEtMy01LTktNS05LTEzLTE0LTIzLTE0LTI3LTEzLTIgMS0yIDEgMCAyIDE0IDIgMTUgMTAgMTMgMTNhNCA0IDAgMCAwLTEgMyAzIDMgMCAwIDAgMSAxbC0yMSAyMmE3IDcgMCAwIDEgNCAyIDggOCAwIDAgMSAyIDNsMjAtMjFhNyA3IDAgMCAwIDEgMSA0IDQgMCAwIDAgNCAwYzEtMSA2IDMgNyA0aC0xYTMgMyAwIDAgMCAwIDQgMiAyIDAgMCAwIDQgMGw2LTZhMyAzIDAgMCAwIDAtM3oiIGZpbGw9IiMyZTk2ZWYiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D)](https://github.com/WFCD/banner/blob/master/PROJECTS.md)
[![Coverage Status](https://coveralls.io/repos/github/WFCD/warframe-worldstate-parser/badge.svg?branch=master)](https://coveralls.io/github/WFCD/profile-parser?branch=master)
[![Discord](https://img.shields.io/discord/256087517353213954.svg?logo=discord)](https://discord.gg/jGZxH9f)
[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)

## Documentation

You can find the documentation [here](https://wfcd.github.io/profile-parser/)

## Installation

```shell
$ npm i -S profile-parser
```

## Example usage

```javascript
import { ProfileParser } from 'profile-parser';

const profileData = await fetch('https://content.warframe.com/dynamic/getProfileViewingData.php?n=${username}');
const user = new ProfileParser(await profileData.text());

console.log(user.profile.displayName);
```
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@
"prepublishOnly": "npm run build:types",
"build:docs": "jsdoc -c .github/docs/conf.json -d docs",
"build:types": "tsc -p tsconfig.declaration.json",
"postinstall": "if [ \"$NODE_ENV\" = \"dev\" ] ; then npx -p install-peerdeps@latest install-peerdeps @wfcd/eslint-config@latest -S ; fi",
"prepare": "husky"
"prepare": "husky && if [ \"$NODE_ENV\" = \"dev\" ] ; then npx -p install-peerdeps@latest install-peerdeps @wfcd/eslint-config@latest -S ; fi"
},
"author": "",
"author": "SlayerOrnstein",
"license": "MIT",
"engines": {
"node": ">=18.0.0"
Expand Down
3 changes: 2 additions & 1 deletion src/Ability.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Represents an ability used by the player
* Represents a players used ability
* @module
*/
export default class Ability {
/**
Expand Down
13 changes: 13 additions & 0 deletions src/ArchonCrystal.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import { archonShardColor, archonShardUpgradeType } from 'warframe-worldstate-data/utilities';

/**
* Represents an Archon shard
* @module
*/
export default class ArchonCrystal {
constructor(crystal, local) {
/**
* Archon shard color
* @type {String}
*/
this.color = archonShardColor(crystal.Color, local);

/**
* Archon shard modifier
* @type {String}
*/
this.modifier = archonShardUpgradeType(crystal.Color, crystal.UpgradeType, local);
}
}
4 changes: 4 additions & 0 deletions src/ChallengeProgress.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Player completed or in progress challenges
* @module
*/
export default class ChallengeProgress {
constructor(challenge) {
/**
Expand Down
5 changes: 3 additions & 2 deletions src/Enemy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Represents the enemies killed
* An enemy killed/executed by player
* @module
*/
export default class Enemy {
/**
Expand Down Expand Up @@ -37,7 +38,7 @@ export default class Enemy {
this.assists = enemy.assists;

/**
* How many times tis enemy type has killed the player
* How many times this enemy type has killed the player
* @type {number}
*/
this.deaths = enemy.deaths;
Expand Down
4 changes: 4 additions & 0 deletions src/Intrinsics.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Player's intrinsics ranks
* @module
*/
export default class Intrinsics {
constructor(skills) {
// I know this is railjack but I'm not sure what the context is
Expand Down
3 changes: 2 additions & 1 deletion src/ItemConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { colors, find } from 'warframe-items/utilities';
import mapToHex from './Util.js';

/**
* Represents the data configuration for an item
* Item customizations such as colors and applied skins
* @module
*/
export default class ItemConfig {
/**
Expand Down
4 changes: 4 additions & 0 deletions src/LoadOutInventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import LoadOutItem from './LoadOutItem.js';
import WeaponSkin from './WeaponSkin.js';
import XpInfo from './XpInfo.js';

/**
* Player loudout
* @module
*/
export default class LoadOutInventory {
constructor(item) {
/**
Expand Down
4 changes: 4 additions & 0 deletions src/LoadOutItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { parseDate, toTitleCase } from 'warframe-worldstate-data/utilities';
import ItemConfig from './ItemConfig.js';
import Polarity from './Polarity.js';

/**
* An an item in LoadOutInventory
* @module
*/
export default class LoadOutItem {
constructor(weapon) {
/**
Expand Down
4 changes: 4 additions & 0 deletions src/Mission.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { node, nodeEnemy, nodeMissionType } from 'warframe-worldstate-data/utilities';

/**
* A mission completed by the player
* @module
*/
export default class Mission {
constructor(mission, locale) {
const uniqueName = mission.Type || mission.Tag;
Expand Down
4 changes: 4 additions & 0 deletions src/OperatorLoadOuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { colors } from 'warframe-items/utilities';

import mapToHex from './Util.js';

/**
* Player's operator loadout
* @module
*/
export default class OperatorLoadOuts {
constructor(loadout) {
/**
Expand Down
4 changes: 4 additions & 0 deletions src/Polarity.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { translatePolarity } from 'warframe-worldstate-data/utilities';

/**
* A polarity in a LoadOutItem
* @module
*/
export default class Polarity {
constructor(polarity) {
/**
Expand Down
4 changes: 4 additions & 0 deletions src/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import Mission from './Mission.js';
import OperatorLoadOuts from './OperatorLoadOuts.js';
import Syndicate from './Syndicate.js';

/**
* A player's profile
* @module
*/
export default class Profile {
constructor(profile, locale) {
/**
Expand Down
20 changes: 16 additions & 4 deletions src/ProfileParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { parseDate } from 'warframe-worldstate-data/utilities';
import Profile from './Profile.js';
import Stats from './Stats.js';

/**
* Parser entry point
* @module
*/
export default class ProfileParser {
constructor(data, locale) {
/**
Expand All @@ -11,16 +15,24 @@ export default class ProfileParser {
*/
this.profile = new Profile(data.Results[0], locale);

// N/A
/**
* @type {number}
*/
this.techProjects = data.TechProjects;

// N/A
/**
* @type {number}
*/
this.xpComponents = data.XpCompoents;

// N/A
/**
* @type {number}
*/
this.xpCacheExpiryDate = parseDate(data.XpCacheExpiryDate);

// N/A
/**
* @type {number}
*/
this.ceremonyResetDate = parseDate(data.CeremonyResetDate);

/**
Expand Down
4 changes: 4 additions & 0 deletions src/Pvp.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Player's conclave stats
* @module
*/
export default class Pvp {
constructor(pvp) {
/**
Expand Down
4 changes: 4 additions & 0 deletions src/Race.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Represents a k-drive race
* @module
*/
export default class Race {
constructor(race) {
/**
Expand Down
4 changes: 4 additions & 0 deletions src/Scan.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Represents an enemy scanned to the codex
* @module
*/
export default class Scan {
constructor(scan) {
/**
Expand Down
3 changes: 2 additions & 1 deletion src/Stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import Scan from './Scan.js';
import Weapon from './Weapon.js';

/**
* Player stats
* A player's overall career stats
* @module
*/
export default class Stats {
/**
Expand Down
10 changes: 7 additions & 3 deletions src/Syndicate.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { syndicate } from 'warframe-worldstate-data/utilities';

/**
* Represents a player's progress with a Syndicate
* Represents a syndicate
* @module
*/
export default class Syndicate {
/**
* @param {Object} affiliation The syndicate data
* @param {string} locale locale code
*/
constructor(affiliation) {
constructor(affiliation, locale) {
// TODO: name is readable but still might want to clean them up
// i.e "NewLokaSyndicate" can be "New Loka"" instead

/**
* Name of the syndicate
* @type {String}
*/
this.name = affiliation.Tag;
this.name = syndicate(affiliation.Tag, locale);

/**
* Current standing the player has with the syndicate
Expand Down
2 changes: 2 additions & 0 deletions src/Util.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/** @module */

/**
* Map base10 int colors to hex color strings
* @param {Record<string, number | undefined>} colors color map
Expand Down
4 changes: 4 additions & 0 deletions src/Weapon.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Represents a player's used weapon stats
* @module
*/
export default class Weapon {
constructor(weapon) {
/**
Expand Down
4 changes: 4 additions & 0 deletions src/WeaponSkin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* A weapon skin
* @module
*/
export default class WeaponSkin {
constructor(skin) {
/**
Expand Down
4 changes: 4 additions & 0 deletions src/XpInfo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { find } from 'warframe-items/utilities';

/**
* An item that has contributed to a player's mastery rank
* @module
*/
export default class XpInfo {
constructor(info) {
/**
Expand Down