0.4.16 • Published 8 months ago

twinkle-parser v0.4.16

Weekly downloads
17
License
MIT
Repository
-
Last release
8 months ago

Usage

From CLI

Quick use

npx twinkle-parser data_from_kdb.csv

Global Install

# Install with NPM
npm install -g twinkle-parser

# Install with yarn
yarn add --global twinkle-parser

# Then
twinkle-parser data_from_kdb.csv

Use inside repo

# * Inside repo directory
# Install dependencies
yarn

# Parse
yarn run parse data_from_kdb.csv

As API

# Install with NPM
npm install twinkle-parser

# Install with yarn
yarn add twinkle-parser
const parse = require('twinkle-parser')
const data = parse('CSV string here') // -> KDBData

CLI options

Option
-o PATH / --output PATHExport result to a file at the PATH instead of to stdout.
-p / --prettyPrettify json output.
--fieldsFields to be included (comma-separated, specifing all if not set)
-h / --helpPrint help & usage.
-v / --versionPrint version info

Output Format

{
  "COURSE_ID": {

    "title": "Twinkle",

    // Class type (defined value by original data)
    "type": 1,

    // Course unit
    "unit": 1,

    // Course target grades
    "targets": [1, 2],

    // Terms & Modules
    // 0 = Spring A, 1 = Spring B, ...
    "termStr": "春AB",
    "terms": [ 0, 1 ],

    // Day & Period sets
    "periodStr": "月1-3\n水4-6",
    "periods": [
      // [ Days( 0 = Sun. 1 = Mon. ... ), Periods ]
      [ [ 1 ], [ 0, 1, 2 ] ],
      [ [ 3 ], [ 4, 5, 6 ] ]
    ],

    // Rooms
    "rooms": [ "7A106", "7C202" ],

    // Instructors
    "instructors": [ "筑波 太郎" ],

    // Overview & Remarks
    "overview": "",
    "remarks": ""

    // Last update in unix time
    "updatedAt": 1583390263000
  }
}

TypeScript Support

TypeScript supported! 🎉

// This will be imported with types
import parse from 'twinkle-parser'

// And types for output data are also available
import { KDBData, KDBCourse } from 'twinkle-parser'

Contribution

Issue or PR submissions are welcome.

0.4.15

10 months ago

0.4.16

8 months ago

0.4.14

1 year ago

0.4.10

2 years ago

0.4.13

1 year ago

0.4.11

2 years ago

0.4.12

1 year ago

0.4.9

2 years ago

0.4.8

2 years ago

0.4.7

2 years ago

0.4.6

2 years ago

0.4.5

2 years ago

0.4.4

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago