# twinte-parser

> Twinte内部で使用するために開発されたKdBパーサ

Latest version **2.3.0** (published 2022-03-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install twinte-parser
pnpm add twinte-parser
yarn add twinte-parser
bun add twinte-parser
```

Provides the command `twinte-parser`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.0 |
| Published | 2022-03-31 |
| First published | 2019-07-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 19.8 KB |
| Known vulnerabilities | 0 (+28 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 15 |
| Author | SIY1121 |
| Maintainers | siy1121 |

## Links

- npm: https://www.npmjs.com/package/twinte-parser
- Repository: https://github.com/twin-te/twinte-parser
- Homepage: https://github.com/twin-te/twinte-parser#readme
- Issues: https://github.com/twin-te/twinte-parser/issues
- npm.io page: https://npm.io/package/twinte-parser

## Dependencies (7)

- [csv](https://npm.io/package/csv.md) ^5.1.1
- [xlsx](https://npm.io/package/xlsx.md) ^0.16.9
- [axios](https://npm.io/package/axios.md) ^0.21.1
- [iconv-lite](https://npm.io/package/iconv-lite.md) ^0.5.0
- [tough-cookie](https://npm.io/package/tough-cookie.md) ^4.0.0
- [command-line-args](https://npm.io/package/command-line-args.md) ^5.1.1
- [axios-cookiejar-support](https://npm.io/package/axios-cookiejar-support.md) ^1.0.1

## Recent versions

- 2.3.0 (latest) — 2022-03-31
- 2.2.0 — 2021-04-01
- 2.1.3 — 2021-03-30
- 2.1.2 — 2021-03-24
- 2.1.1 — 2021-03-24
- 2.1.0 — 2021-01-18
- 2.0.1 — 2021-01-10
- 2.0.0 — 2021-01-09
- 1.3.1 — 2020-04-19
- 1.3.0 — 2020-04-18
- 1.2.3 — 2020-04-04
- 1.2.2 — 2019-12-02
- 1.2.1 — 2019-11-25
- 1.2.0 — 2019-11-18
- 1.1.0 — 2019-09-23
- … 9 more at https://npm.io/package/twinte-parser/versions

## README

[![npm version](https://badge.fury.io/js/twinte-parser.svg)](https://badge.fury.io/js/twinte-parser)
![NPM](https://img.shields.io/npm/l/twinte-parser.svg)
# twinte-parser
Twinte内部で利用するために開発された
`KdB（筑波大学教育課程編成支援システム 開設科目一覧）`
のパーサー。

# 構成
## KdBDownloader
KDBからCSVファイルをダウンロードする。

```typescript
import { donwloadKDB } from 'twinte-parser'

const csv = await downloadKDB()
```

## Parser
KdBから取得したcsvをオブジェクトに変換する。

```typescript
import parseKDB from 'twinte-parser'
// or
import { parseKDB } from 'twinte-parser'

const courses = parseKDB(csv)
```

## 型
### Module
```typescript
enum Module {
  SpringA = '春A',
  SpringB = '春B',
  SpringC = '春C',
  FallA = '秋A',
  FallB = '秋B',
  FallC = '秋C',
  SummerVacation = '夏季休業中',
  SpringVacation = '春季休業中',
  Annual = '通年',
  Unknown = '不明'
}
```

### Day
```typescript
enum Day {
  Sun = '日',
  Mon = '月',
  Tue = '火',
  Wed = '水',
  Thu = '木',
  Fri = '金',
  Sat = '土',
  Intensive = '集中',
  Appointment = '応談',
  AnyTime = '随時',
  Unknown = '不明'
}

```

### Course
```typescript
interface Course {
  code: string
  name: string
  credits: number
  overview: string
  remarks: string
  type: number
  recommendedGrade: number[]
  schedules: {
    module: Module
    day: Day
    period: number
    room: string
  }[]
  instructor: string
  lastUpdate: Date
  error: boolean
}
```

ここで`schedules`が配列になっていることに注意。

例えば春AB・月曜１限・3A201の授業があった場合、

```typescript
{
  code: 'XXXXXXX',
  name: "名前",
  schedules: [
      {
        module: "春A",
        day: "月",
        period: 1,
        room: "3A201"
      },
      {
        module: "春B",
        day: "月",
        period: 1,
        room: "3A201"
      }
  ]
}
```

のようになる。これはモジュールごとに教室や開講時間が変更になる場合に対応するためである。

# ライセンス
MIT

---
_Source: https://npm.io/package/twinte-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
