Skip to content
This repository has been archived by the owner on Mar 8, 2019. It is now read-only.

Commit

Permalink
renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jul 28, 2015
1 parent e46bf82 commit 800aa9a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# json-parse
# parse-json

![Last version](https://img.shields.io/github/tag/Kikobeats/json-parse.svg?style=flat-square)
[![Build Status](http://img.shields.io/travis/Kikobeats/json-parse/master.svg?style=flat)](https://travis-ci.org/Kikobeats/json-parse)
[![Dependency status](http://img.shields.io/david/Kikobeats/json-parse.svg?style=flat-square)](https://david-dm.org/Kikobeats/json-parse)
[![Dev Dependencies Status](http://img.shields.io/david/dev/Kikobeats/json-parse.svg?style=flat-square)](https://david-dm.org/Kikobeats/json-parse#info=devDependencies)
[![NPM Status](http://img.shields.io/npm/dm/json-parse.svg?style=flat-square)](https://www.npmjs.org/package/json-parse)
![Last version](https://img.shields.io/github/tag/Kikobeats/parse-json.svg?style=flat-square)
[![Build Status](http://img.shields.io/travis/Kikobeats/parse-json/master.svg?style=flat)](https://travis-ci.org/Kikobeats/parse-json)
[![Dependency status](http://img.shields.io/david/Kikobeats/parse-json.svg?style=flat-square)](https://david-dm.org/Kikobeats/parse-json)
[![Dev Dependencies Status](http://img.shields.io/david/dev/Kikobeats/parse-json.svg?style=flat-square)](https://david-dm.org/Kikobeats/parse-json#info=devDependencies)
[![NPM Status](http://img.shields.io/npm/dm/parse-json.svg?style=flat-square)](https://www.npmjs.org/package/parse-json)
[![Gratipay](https://img.shields.io/gratipay/Kikobeats.svg?style=flat-square)](https://gratipay.com/~Kikobeats/)

> The missing JSON.parse async interface.
## Install

```bash
npm install json-parse --save
npm install parse-json --save
```

If you want to use in the browser (powered by [Browserify](http://browserify.org/)):

```bash
bower install json-parse --save
bower install parse-json --save
```

and later link in your HTML:

```html
<script src="bower_components/json-parse/dist/json-parse.js"></script>
<script src="bower_components/parse-json/dist/parse-json.js"></script>
```

## Usage

```js
var JSONParse = require('json-parse');
var parseJSON = require('parse-json');
var stringify = '{"foo":"bar"}';

// as callback interface
JSONParse(stringify, function(err, content) {
parseJSON(stringify, function(err, content) {
console.log(content.foo); // => 'bar'
});

// as promise interface
JSONParse(stringify)
parseJSON(stringify)
.then(function(content) {
console.log(content.foo); // => 'bar'
})
Expand Down
2 changes: 1 addition & 1 deletion dist/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<title>JSONParse</title>
</head>
<body>
<script src="json-parse.js" type="text/javascript" charset="utf-8"></script>
<script src="parse-json.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions dist/json-parse.js → dist/parse-json.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "json-parse",
"name": "parse-json",
"description": "The missing JSON.parse async interface.",
"homepage": "https://github.com/Kikobeats/parse-json",
"version": "1.0.0",
Expand Down
8 changes: 4 additions & 4 deletions test/test.coffee
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
JSONParse = require '..'
parseJSON = require '..'
fs = require 'fs'
should = require 'should'
sampleJSON = fs.readFileSync "#{__dirname}/sample.json", encoding: 'utf8'

describe 'JSONParse ::', ->
describe 'parseJSON ::', ->

it 'as callback', (done) ->
JSONParse sampleJSON, done
parseJSON sampleJSON, done

it 'as promise', (done) ->
JSONParse(sampleJSON).then (content) ->
parseJSON(sampleJSON).then (content) ->
content.foo.should.be.equal 'bar'
done()

0 comments on commit 800aa9a

Please sign in to comment.