Skip to content

Commit

Permalink
Update Readme and contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
fabien committed Apr 8, 2016
1 parent 0fa5093 commit faabc13
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
31 changes: 31 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,37 @@ x('http://mat.io', {
})
```

### Filters

Filters can specified when creating a new Xray instance. To apply filters to a value, append them to the selector using `|`.

```js
var Xray = require('x-ray');
var x = Xray({
filters: {
trim: function (value) {
return typeof value === 'string' ? value.trim() : value
},
reverse: function (value) {
return typeof value === 'string' ? value.split('').reverse().join('') : value
},
slice: function (value, limit) {
return typeof value === 'string' ? value.slice(0, limit) : value
}
}
});

x('http://mat.io', {
title: 'title | trim | reverse | limit:2'
})(function(err, obj) {
/*
{
title: 'oi'
}
*/
})
```

## Examples

- [selector](/examples/selector/index.js): simple string selector
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
"main": "index.js",
"author": {
"name": "Matthew Mueller",
"email": "matt@lapwinglabs.cm"
"email": "matt@lapwinglabs.com"
},
"contributors": [{
"name": "Fabien Franzen",
"email": "[email protected]"
}],
"repository": {
"type": "git",
"url": "git://github.com/lapwinglabs/x-ray.git"
Expand Down

0 comments on commit faabc13

Please sign in to comment.