0.35.0 • Published 5 months ago

pathstruct v0.35.0

Weekly downloads
-
License
-
Repository
github
Last release
5 months ago

Pathstruct

Parse and stringify data structures embedded in file paths.

Table of Contents

Install

https://www.npmjs.com/package/pathstruct
npm install pathstruct

Example Usage

parse

Parse key-value pairs from a file path:

const pathstruct = require('pathstruct');
const str = 'event="Birthday party"/IMG1234 caption="Blowing out candles".jpg';
const obj = pathstruct.parse(str);
// { event: 'Birthday party', caption: 'Blowing out candles' }

Parse key-value pairs including arrays and nested object structures:

const pathstruct = require('pathstruct');
const str = 'val=foobar arr=[foo,bar] x.val=foobar x.arr=[foo,bar]';
const obj = pathstruct.parse(str);
// { val: 'foobar', arr: ['foo', 'bar'], x: { val: 'foobar', arr: ['foo', 'bar']} }

stringify

const pathstruct = require('pathstruct');
const obj = { val: 'foobar', arr: ['foo', 'bar'], x: { val: 'foobar', arr: ['foo', 'bar']} };
const str = pathstruct.stringify(obj);
// val=foobar arr=[foo,bar] x.val=foobar x.arr=[foo,bar]

Architecture

Can't see the diagram? View it on GitHub
graph TD;
    api-->parser;
    api-->stringifier;
0.35.0

5 months ago

0.34.0

10 months ago

0.33.0

10 months ago

0.32.0

10 months ago

0.21.0

1 year ago

0.20.0

1 year ago

0.19.0

1 year ago

0.18.0

1 year ago

0.31.0

11 months ago

0.30.0

1 year ago

0.29.0

1 year ago

0.28.0

1 year ago

0.27.0

1 year ago

0.26.0

1 year ago

0.25.0

1 year ago

0.24.0

1 year ago

0.23.0

1 year ago

0.22.0

1 year ago

0.15.0

1 year ago

0.16.0

1 year ago

0.17.0

1 year ago

0.13.0

1 year ago

0.14.0

1 year ago

0.11.0

1 year ago

0.12.0

1 year ago

0.10.0

1 year ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago