1.0.2 • Published 3 years ago

properties-to-yml v1.0.2

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
3 years ago

PropertiesToYml

Converts strings/files from the properties format to strings/files in the yaml format with a nice Fluent interface.

Quick start

  1. Add PropertiesToYml as a dependency of your project. It's as simple as:
npm i properties-to-yml
  1. Import the library
import { PropertiesToYml } from 'properties-to-yml';
  1. Start converting

Examples

String to string

const output = new PropertiesToYml()
    .fromString('server.port = 8080')
    .convert()
    .toString();

File to string

const output = new PropertiesToYml()
    .fromFile('/path/to/file.properties')
    .convert()
    .toString();

File to file

new PropertiesToYml()
    .fromFile('/path/to/file.properties')
    .convert()
    .toFile('/path/to/file.yml');

String to file

new PropertiesToYml()
    .fromString('server.port = 8080')
    .convert()
    .toFile('/path/to/file.yml');

White spaces

You can customize how many spaces must be used in the outputted yaml.

To do so, just call .spaces(N) before calling the convert() method.

Example:

new PropertiesToYml()
    .spaces(4)
    .fromFile('/path/to/file.properties')
    .convert()
    .toFile('/path/to/file.yml');

Develop

Write code and run tests against it with npm test

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago