Skip to content

Commit

Permalink
docs: update Readme instructions and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Guria committed Nov 14, 2017
1 parent 3b0ffe2 commit 2641773
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,54 @@
# URL Object Notation

An Object Notation like JSON but for URLs. [Read the full explanation on my blog](http://blog.vjeux.com/2011/javascript/urlon-url-object-notation.html).
An Object Notation like JSON but for URLs.
Read the full explanation on @vjeux blog:
http://blog.vjeux.com/2011/javascript/urlon-url-object-notation.html

## Get URLON

You first need to enable URLON.
Note that format is slightly changed since article was published, but main idea remains the same.

## Getting started
### NPM
URLON is on [NPM] (http://search.npmjs.org/#/urlon).
URLON is on [NPM](http://search.npmjs.org/#/urlon).

```
```sh
npm install urlon
```
```javascript
var URLON = require('urlon');
```

### Webpage
### UMD build using `<script>`
```html
<script src="https://unpkg.com/urlon@2.1.0/dist/urlon.umd.js"></script>
<script src="https://unpkg.com/urlon/dist/urlon.umd.js"></script>
<script>
urlon // urlon.stringify() or urlon.parse()
</script>
```

or

```html
<script src="https://unpkg.com/[email protected]/dist/URLON.umd.js"></script>
<script>
URLON // URLON.stringify() or URLON.parse()
</script>
```
## Usage
### stringify
```javascript
URLON.stringify('{"table":{"achievement":{"column":"instance","ascending":true}}}')
URLON.stringify({"table":{"achievement":{"column":"instance","ascending":true}}})
// Output: '_table_achievement_column=instance&ascending:true'
// Output: '$table$achievement$column=instance&ascending:true'
```

### parse

```javascript
URLON.parse('_table_achievement_column=instance&ascending:true')
URLON.parse('$table$achievement$column=instance&ascending:true')

// Output: {"table":{"achievement":{"column":"instance","ascending":true}}}
```

## Projects using URLON

* [url-mapper](https://github.com/cerebral/url-mapper) - `@cerebral/router` default mapper for URLs

## Changelog

See [releases](https://github.com/cerebral/urlon/releases)

0 comments on commit 2641773

Please sign in to comment.