https://github.com/abranhe/s-to-o
String to Object (self explanatory)
https://github.com/abranhe/s-to-o
object string string-to-object
Last synced: 2 months ago
JSON representation
String to Object (self explanatory)
- Host: GitHub
- URL: https://github.com/abranhe/s-to-o
- Owner: abranhe
- License: mit
- Created: 2018-08-17T20:27:41.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-07-26T05:07:30.000Z (almost 7 years ago)
- Last Synced: 2025-02-18T04:34:07.097Z (over 1 year ago)
- Topics: object, string, string-to-object
- Language: JavaScript
- Homepage: https://npm.im/s-to-o
- Size: 10.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
Awesome Lists containing this project
README
# s-to-o
> Convert an string into an object
[](https://travis-ci.org/abranhe/s-to-o)
[](https://github.com/abranhe)
[](https://cash.me/$abranhe)
[](https://patreon.com/abranhe)
[](https://github.com/abranhe/s-to-o/blob/master/license)
[](https://npmjs.com/package/s-to-o)
## Install
```
npm install s-to-o
```
## Usage
```js
const sto = require('s-to-o');
console.log(sto('a: 1, b: 2, c: 3, d: 4'));
// => { a: '1', b: '2', c: '3', d: '4' }
```
## API
### sto(input)
Type: `function`
Return Type: `object`
A replacement for JSON.parse() which converts an string into an object.
#### input
Type: `string`
String to be parsed.
## Related
- [str-to-arr](https://github.com/abranhe/str-to-arr): Add words from a string to an array
## License
MIT © [Abraham Hernandez](https://abranhe.com)