resourceful
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -162,13 +162,10 @@ var common = require('./common'); | ||
return val.replace(regexp, replacement); | ||
} | ||
}), | ||
prefix: function (prefix) { | ||
var matcher = new RegExp('^' + prefix + '(.*)'); | ||
return this.sanitize(function (val) { | ||
}, | ||
prefix: function (val, prefix) { | ||
var matcher = new RegExp('^' + prefix + '(.*)'); | ||
return !matcher.test(val) | ||
? prefix + val | ||
: val; | ||
}); | ||
} | ||
} | ||
}) | ||
}, | ||
@@ -175,0 +172,0 @@ number: { |
{ | ||
"name": "resourceful", | ||
"description": "A storage agnostic resource-oriented ODM for building prototypical models with validation and sanitization.", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"url": "http://github.com/flatiron/resourceful", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -292,2 +292,11 @@ var assert = require('assert'), | ||
} | ||
}, | ||
"sanitize('lower').sanitize('prefix')": { | ||
topic: function (p) { | ||
p.sanitize('reset').sanitize('lower').sanitize('prefix', 'a-prefix/'); | ||
return new this.Resource({kind: 'HELLO-world'}); | ||
}, | ||
"and pass check": function (instance) { | ||
assert.equal(instance.kind, 'a-prefix/hello-world'); | ||
} | ||
} | ||
@@ -294,0 +303,0 @@ } |
173479
3974