Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-to-properties

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-to-properties - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "json-to-properties",
"version": "1.1.0",
"version": "1.1.1",
"description": "A standalone utility to transform language files in JSON format into .properties files, and languages files in .properties format into JSON format.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -5,3 +5,3 @@ # json-to-properties

A util to convert files in .json format into .properties format, and vice versa.
A util to convert files having a `.json` format into `.properties` format, and vice versa.

@@ -14,3 +14,3 @@ ## Installation

Running `json-to-properties` will convert any .json file that are found in the current directory, into to .properties.
Running `json-to-properties` will convert any `.json` files that are found in the current directory, into to `.properties` files.

@@ -28,3 +28,3 @@ Example

result into a file containing
result in a file containing

@@ -42,7 +42,7 @@ ```

Running the util with -c expects a config file in .json format containing two attributes: `src` and `dist`, where
Running the util with -c expects a config file in `.json` format containing two attributes: `src` and `dist`, where
- `src` points to the directory containing the files to process and
- `dist` points to the directory where the output files will be written
Example config.json
Example `config.json`

@@ -62,3 +62,3 @@ ```

Performs the reversal process, converting .properties files into .json files.
Performs the reversal process, converting `.properties` files into `.json` files.

@@ -85,3 +85,3 @@ Example

Accepts a number value identifying the number of spaces used within the output .json file. This is used in relation with `-r`
Accepts a number value identifying the number of spaces used within the output .json file. This is used in relation with `-r, --reverse`

@@ -96,9 +96,9 @@ Run using

Running the util with the -m, --merge option bundles the generated properties files into one file of a given name, or bundle.properties if none is specified. The content of the bundled file are prefixed with the name of the original file.
Running the util with the `-m, --merge` option bundles the generated `.properties` files into one file of a given name, or `bundle.properties` if none is specified. The content of the bundled file are prefixed with the name of the original file.
##### Example
`json-to-properties -m` bundles the content in a file named bundle.properties
`json-to-properties -m` bundles the content in a file named `bundle.properties`
`json-to-properties -m mynewbundle.properties` bundles the content in a file named mynewbundle.properties
`json-to-properties -m mynewbundle.properties` bundles the content in a file named `mynewbundle.properties`

@@ -127,7 +127,7 @@ Having two files `en.json` and `it.json` both containing the json content below

The merge process can also be combined with the -r, -reverse flag, where the specified file (or bundle.properties if none is specified) is expanded into separate json files whose name is equivalent to the first part of a key.
The merge process can also be combined with the `-r, -reverse` flag, where the specified file (or `bundle.properties` if none is specified) is expanded into separate json files whose name is equivalent to the first part of a key.
##### Example
`json-to-properties -m` or `json-to-properties -rm`
`json-to-properties -r -m` or `json-to-properties -rm`

@@ -143,3 +143,3 @@ Having a bundle file `bundle.properties` with the below content

will result in two files, `en.json` and `it.json`, having the below content respectively.
will result in two files, `en_rm.json` and `it_rm.json`, having the below content respectively.

@@ -162,4 +162,6 @@ ```

_Note that the generated json files are suffixed with **_rm** not to override other .json files having the same name (in this case, `en.json` and `it.json`) that could be a result of the standard behavior of the reverse process._
## Try It
The `sample` folder contains both .json and .properties fileS to download and test on.
The `sample` folder contains both .json and .properties files to download and test on.

@@ -17,3 +17,3 @@ /**

if (typeof json[ key ] === 'object') {
if (json[key] && typeof json[ key ] === 'object') {
var _currPrefix = key.concat('.');

@@ -24,3 +24,3 @@ _prefix = prefix ? prefix.concat(_currPrefix) : _currPrefix;

_prefix = prefix ? prefix.concat(key) : key;
result.push(_prefix.concat('=').concat(json[ key ]));
result.push(_prefix.concat('=').concat(json[ key ] || ''));
}

@@ -27,0 +27,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc