Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #17 from kabitakis/master
Browse files Browse the repository at this point in the history
minor readme addition, changed getLeafKey to use hash instead of plain value
  • Loading branch information
Lapple committed Sep 25, 2015
2 parents c961157 + e2ae7e7 commit 07d5c11
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ React.render(
Make sure to include `json-inspector.css` in your stylesheet. Feel free to
override or amend default styles, for instance, when using a dark background.

### Run the example

```bash
cd /path/to/project
npm install
npm run watch
```

Then, visit http://localhost/path/to/project/example

### Properties

#### props.data
Expand Down
5 changes: 4 additions & 1 deletion lib/leaf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var React = require('react');
var D = React.DOM;

var md5omatic = require('md5-o-matic');

var uid = require('./uid');
var type = require('./type');

Expand Down Expand Up @@ -213,7 +215,8 @@ function items(count) {
function getLeafKey(key, value) {
if (isPrimitive(value)) {
// TODO: Sanitize `value` better.
return key + ':' + String(value).replace(/\s+/g, '_');
var hash = md5omatic(String(value));
return key + ':' + hash;
} else {
return key + '[' + type(value) + ']';
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"license": "MIT",
"dependencies": {
"debounce": "1.0.0",
"md5-o-matic": "^0.1.1",
"object-assign": "2.0.0"
},
"devDependencies": {
Expand Down

0 comments on commit 07d5c11

Please sign in to comment.