0.0.1 • Published 2 years ago

praseodymium v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Praseodymium

Use .properties files in Node.js

Installation

npm i praseodymium

API

Initialize

Initialize by calling new propertiesReader(). ECMAScript import is also supported.

const propertiesReader = require('praseodymium')
const Reader = new propertiesReader('/file/path', { separatedBy:"=" })
ParameterDescription
FileThe file path to read
advanced.separatedByChange what key/values are separated by (default: =)

Get values

Get one

Reader.get('key')
ParameterDescription
keyThe key to get the value of

Get all

Reader.getAll()

Get raw content as a string

Reader.getRaw()

Set value

Reader.set('key','value')
ParameterDescription
keyThe key to set the value of

Convert

Convert to JSON

Reader.toJSON()

Convert to an Array

Reader.toArray()

Convert a JSON object to the .properties file syntax

Reader.toProperties({ key:"value" }, "output")
ParameterDescription
sourceObject to convert
outputPath to output file (optional)

Other info

Need help? Ask a question on Github

Report feedback & bugs here

Like our work? Support us on Patreon