Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itsjavi/koffingjs
Online Pokémon Showdown Team parser that converts your competitive strategies to machine-readable JSON code.
https://github.com/itsjavi/koffingjs
pokemon pokemon-showdown pokemonshowdown pokemonsimulator pokepaste showdown smogon smogon-api
Last synced: about 2 months ago
JSON representation
Online Pokémon Showdown Team parser that converts your competitive strategies to machine-readable JSON code.
- Host: GitHub
- URL: https://github.com/itsjavi/koffingjs
- Owner: itsjavi
- License: mit
- Created: 2017-10-15T01:01:40.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2023-08-09T16:47:48.000Z (over 1 year ago)
- Last Synced: 2024-11-04T04:36:39.871Z (about 2 months ago)
- Topics: pokemon, pokemon-showdown, pokemonshowdown, pokemonsimulator, pokepaste, showdown, smogon, smogon-api
- Language: TypeScript
- Homepage: https://itsjavi.com/koffing/
- Size: 1.82 MB
- Stars: 23
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Koffing
[![npm version](https://badge.fury.io/js/koffing.svg)](https://badge.fury.io/js/koffing)
![Build Status](https://github.com/itsjavi/koffing/actions/workflows/CI.yml/badge.svg?branch=develop)Koffing is a Pokemon Showdown importable-syntax parser for JavaScript and TypeScript.
[Pokémon Showdown](https://www.pokemonshowdown.com/) is the most popular online Pokémon battle simulator,
one of the best ways to quickly try your strategies for the official Pokémon VGC Championships. This library is just
a parser for the teams generated by the [Showdown Team Builder](https://play.pokemonshowdown.com/teambuilder) exports.This repository holds the source code for the library as well as the code for the Online Parser.
The [Online Parser](https://itsjavi.github.io/koffing) does not require you to download
any library or script, it is recommended if all you want is to sanitize, prettify or convert to JSON your
Showdown team exports.## Features
- Compatible with Gen 9 Pokémon definitions
- Compatible with web browsers, ES6+, TypeScript and NodeJS
- Converts from Showdown code to JSON and vice-versa
- Sanitizes Showdown code (removing invalid data, applying max and mins values, etc.)
- Prettifies Showdown code (proper indentation, line breaks and sorting of the data, etc.)
- [Online Parser](https://itsjavi.github.io/koffing), which is using the library
featuring all the above mentioned.## Installation
As a package:
```bash
npm i koffing# or
pnpm add koffing
```## Usage
### Javascript (ES5, web)
```html
var teamCode = `=== [gen7] Folder 1/Example Team ===`
var parsedTeam = Koffing.parse(teamCode)
console.log(parsedTeam)// Note that the ShowdownParser class, which is used internally by the Koffing class
// is also exposed in the global scope:
console.log(new ShowdownParser(teamCode).parse())```
### Javascript/TypeScript (ES Modules)
```js
'use strict'import { Koffing } from 'https://unpkg.com/koffing@latest/dist/index.mjs'
// or
import { Koffing } from 'koffing'const teamCode = `
=== [gen7] Folder 1/Example Team ===Smogon (Koffing) (F) @ Eviolite
Level: 5
Ability: Levitate
Shiny: Yes
Happiness: 255
EVs: 36 HP / 236 Def / 236 SpD
IVs: 31 HP / 30 Atk / 31 SpA / 30 SpD / 31 Spe
Bold Nature
- Will-O-Wisp
- Pain Split
- Sludge Bomb
- Fire Blast`const parsedTeam = Koffing.parse(teamCode)
// This will log a PokemonTeamSet object:
console.log(parsedTeam)// Convert it back to the Showdown format (prettified). These 3 lines are equivalent:
console.log(parsedTeam.toShowdown())
console.log(parsedTeam.toString())
console.log(parsedTeam + '')
```### NodeJS
```js
const Koffing = require('koffing').Koffingconst teamCode = `=== [gen7] Folder 1/Example Team ===`
const parsedTeam = Koffing.parse(teamCode)
```## License
This software is copyrighted and licensed under the
[MIT license](https://github.com/itsjavi/koffing/LICENSE).### Disclaimer
This software comes bundled with data and graphics extracted from the
Pokémon series of video games. Some terminology from the Pokémon franchise is
also necessarily used within the software itself. This is all the intellectual
property of Nintendo, Creatures, inc., and GAME FREAK, inc. and is protected by
various copyrights and trademarks.The authors believe that the use of this intellectual property for a fan reference
is covered by fair use and that the software is significantly impaired without said
property included. Any use of this copyrighted property is at your own legal risk.This software is not affiliated in any way with Nintendo,
Pokémon or any other game company.A complete revision history of this software is available from
https://github.com/itsjavi/koffing