3.0.13 • Published 9 months ago

@route-builders/oud-operator v3.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

OudOperator

For Japanese

About

Hi> (O_O)/

The library to use the string read from OuDia file.

Document (ja only)
https://doc.route.builders/oud-operator/

  • About OuDia The software for editing and displaying railroad diagrams. made by take-okm.

OuDia

Usage

npm / yarn

  1. install on your project.

    • npm i @route-builders/oud-operator
    • yarn add @route-builders/oud-operator
  2. Load module.

    import { O_O } from '@route-builders/oud-operator';
    
    import * as Encoder from 'encoding-japanese';
    import { readFileSync, writeFileSync } from 'fs';
    
    const o_o = new O_O();
    const filepath = '/path/to/file.oud';
    const buffer = readFileSync(filepath);
    
    const encoding = Encoder.detect(buffer, ['SJIS', 'UTF8']);
    if (!encoding) {
      throw new Error();
    }
    
    const sources = Encoder.convert(buffer, {
      to: 'UNICODE',
      from: encoding,
      type: 'string',
      bom: false,
    })
      .replace(/\r/g, '')
      .split('\n');
    
    writeFileSync('demo.json', JSON.stringify(o_o.fromOud(sources).toJSON()));

Browser

hosted by jsDelivr.

https://cdn.jsdelivr.net/gh/route-builders/oud-operator-dist/O_O.js

<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="UTF-8" />
    <script src="https://cdn.jsdelivr.net/gh/route-builders/oud-operator-dist/O_O.js"></script>
    <script>
      window.onload = () => {
        const o_o = new O_O();
        // ...
      };
    </script>
  </head>
  <body></body>
</html>

Notice

This library relies on the window object. So it will not run in a command line environment.

Author

Copyright © 2018-2021 up-tri

under the MIT License.

3.0.12

9 months ago

3.0.4

9 months ago

3.0.13

9 months ago

3.0.3

9 months ago

3.0.2

9 months ago

3.0.1

9 months ago

3.0.5-dev.2

9 months ago

3.0.5-dev.1

9 months ago

2.0.15

10 months ago

2.0.13

11 months ago

2.0.14

11 months ago

2.0.11

12 months ago

2.0.7

12 months ago

2.0.12

12 months ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago