Skip to content
Browse files

switch out to-function for pluck, we dont need the power behind eval

  • Loading branch information...
1 parent cd3c63d commit c3d785c8a92c0b6a36058e61f158a3fcd22cdfb3 Garrett Johnson committed Feb 28, 2013
Showing with 4 additions and 13 deletions.
  1. +3 −3 lib/rule.js
  2. +1 −1 package.json
  3. +0 −9 test/rule.test.js
View
6 lib/rule.js
@@ -3,7 +3,7 @@
* Deps.
*/
-var toFunction = require('to-function')
+var pluck = require('pluck')
, comparators = require('./comparators');
/**
@@ -21,7 +21,7 @@ module.exports = Rule;
*/
function Rule(path, ruler){
- this.path = toFunction(path);
+ this.path = path;
this.ruler = ruler;
this.stack = [];
}
@@ -36,7 +36,7 @@ function Rule(path, ruler){
Rule.prototype.test = function(obj){
if ('undefined' == typeof obj) return false;
- var actual = this.path(obj);
+ var actual = pluck(this.path, obj);
return this.stack.every(function(fn){
return fn(actual);
});
View
2 package.json
@@ -13,7 +13,7 @@
},
"main": "index.js",
"dependencies": {
- "to-function": "1.1.1"
+ "pluck": "0.0.3"
},
"devDependencies": {
"mocha": "*",
View
9 test/rule.test.js
@@ -2,15 +2,6 @@ var Rule = require('../lib/rule');
describe('Rule', function(){
- describe('when initialized', function(){
- it('should create a path look up function', function(){
- var rule = new Rule('name');
- var obj = { name: 'hai' };
- rule.path.should.be.a('function');
- rule.path(obj).should.equal('hai');
- });
- });
-
describe('when defining comparators', function(){
describe('eq', function(){
it('should strictly equal', function(){

0 comments on commit c3d785c

Please sign in to comment.
Something went wrong with that request. Please try again.