@nanomatic/string_to_object
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

String to object

@nanomatic/string_to_object

Status License


Library that allows to create an object from a given string

📝 Table of Contents

🏁 Getting Started

Installing

npm i @nanomatic/string_to_object

Using

Example code below:

import { StringToObject } from '@nanomatic/string_to_object';

const factory = {
    vehicle: {
        1: {
            type: '🚑'
        },
        2: {
            type: '🚒'
        }
    }
};

const obj = new StringToObject(factory, '|');

console.log(factory);   //  The same as obj.obj object

obj.set(`vehicle|.|type`, '🚓');

console.log(obj.obj);   //  The same as factory object

const vehicle1 = obj.get(`vehicle|1|type`);

console.log(`Type of vehicle 1 is: ${vehicle1}`);

⛏️ Built With

✍️ Authors

🎉 Acknowledgments

  • Special thanks for Sebastian for working together and giving ideas 😉

Package Sidebar

Install

npm i @nanomatic/string_to_object

Homepage

nanomatic.pl

Weekly Downloads

0

Version

2.1.0

License

MIT

Unpacked Size

5.67 kB

Total Files

4

Last publish

Collaborators

  • nano_matic