str2obj

1.0.0 • Public • Published

JavaScript/NodeJS str2obj v1.0.0

What is this?

str2obj is a function that converts a nice literal string into an object.

Demo online

http://jsfiddle.net/yeikos/jwad5/

Example

<html>

	<head>

		<title>str2obj</title>

		<script type="text/javascript" src="https://raw.github.com/yeikos/js.str2obj/master/str2obj.js"></script>

		<script type="text/javascript">

			console.log(str2obj('name(password), min(6), error(false)', true));

			/*

				{
					name: 'password',
					min: 6,
					error: false
				}

			*/

			console.log(str2obj('words(one, two, three) width(800, 600)'));

			/*

				{
					words: ['one, 'two', 'three'],
					width: [800, 600]

				}

			*/

		</script>

	</head>

	<body>See the console log.</body>

</html>

Readme

Keywords

none

Package Sidebar

Install

npm i str2obj

Weekly Downloads

2

Version

1.0.0

License

none

Last publish

Collaborators

  • yeikos