2017 © Pedro PelĂĄez
 

library json-multiline-strings

One shortcoming of JSON is the lack of multiline support. This module will split/join multiline strings to string arrays which is more readable.

image

plepe/json-multiline-strings

One shortcoming of JSON is the lack of multiline support. This module will split/join multiline strings to string arrays which is more readable.

  • Thursday, November 9, 2017
  • by plepe
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

json-multiline-strings

One shortcoming of JSON is the lack of multiline support. This module will split/join multiline strings to string arrays which is more readable., (*1)

EXAMPLE

Convert to multiline variant:, (*2)

var input = {
    "foo": "bar",
    "long": "text with\nseveral\nline breaks"
}
console.log(JSON.stringify(jsonMultilineStrings.split(input), null, '    '))
{
    "foo": "bar",
    "long": [
        "text with",
        "several",
        "line breaks"
    ]
}

Convert back to original json:, (*3)

var input = {
    "foo": "bar",
    "long": [
        "text with",
        "several",
        "line breaks"
    ]
}
console.log(JSON.stringify(jsonMultilineStrings.join(input), null, '    '))
{
    "foo": "bar",
    "long": "text with\nseveral\nline breaks"
}

API

jsonMultilineStrings.split(data, options) resp. jsonMultilineStringsSplit(data, options)

Processes input data recursively and convert all multiline strings to string arrays., (*4)

Options: - exclude: Exclude the following paths from modifications. Give an array of string arrays, e.g. [ [ 'foo', 'bar' ], [ 'test' ] ]. This would not modify the paths 'foo/bar' and 'test'., (*5)

jsonMultilineStrings.join(data, options) resp. jsonMultilineStringsJoin(data, options)

Processes input data recursively and convert all string arrays to multiline strings., (*6)

Options: - exclude: Exclude the following paths from modifications. Give an array of string arrays, e.g. [ [ 'foo', 'bar' ], [ 'test' ] ]. This would not modify the paths 'foo/bar' and 'test'., (*7)

INSTALL

JS usage via npm

npm install --save json-multiline-strings
var jsonMultilineStrings = require('json-multiline-strings')
jsonMultilineStrings.split(...)
jsonMultilineStrings.join(...)

PHP usage via composer

composer install plepe/json-multiline-strings
jsonMultilineStringsSplit(...)
jsonMultilineStringsJoin(...)

Development

git clone https://github.com/plepe/json-multiline-strings.git
cd json-multiline-strings
npm install
composer install

The Versions

09/11 2017

v0.1.0

0.1.0.0 https://github.com/plepe/json-multiline-strings

One shortcoming of JSON is the lack of multiline support. This module will split/join multiline strings to string arrays which is more readable.

  Sources   Download

GPL-3.0

The Development Requires

09/11 2017

dev-master

9999999-dev https://github.com/plepe/json-multiline-strings

One shortcoming of JSON is the lack of multiline support. This module will split/join multiline strings to string arrays which is more readable.

  Sources   Download

GPL-3.0

The Development Requires

09/11 2017

dev-dev

dev-dev https://github.com/plepe/json-multiline-strings

One shortcoming of JSON is the lack of multiline support. This module will split/join multiline strings to string arrays which is more readable.

  Sources   Download

GPL-3.0

The Development Requires