Comparing version 0.13.0 to 0.14.0
@@ -0,1 +1,8 @@ | ||
v0.14.0 - Mon, 08 Feb 2016 16:17:40 GMT | ||
--------------------------------------- | ||
- [86b6446](../../commit/86b6446) [fixed] camelcase should maintain leading underscores | ||
v0.13.0 - Mon, 01 Feb 2016 20:49:40 GMT | ||
@@ -2,0 +9,0 @@ --------------------------------------- |
@@ -25,2 +25,9 @@ 'use strict'; | ||
c.type('altCamel', function (str) { | ||
var result = c.camel(str), | ||
idx = str.search(/[^_]/); | ||
return idx === 0 ? result : str.substr(0, idx) + result; | ||
}); | ||
var childSchema = function childSchema(field, parent) { | ||
@@ -221,3 +228,3 @@ return isRecursive(field) ? field.of ? field.of(parent) : parent : field; | ||
return obj == null ? obj : transform(obj, function (newobj, val, key) { | ||
return newobj[c.camel(key)] = val; | ||
return newobj[c.altCamel(key)] = val; | ||
}); | ||
@@ -224,0 +231,0 @@ }); |
{ | ||
"name": "yup", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "Dead simple Object schema validation", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -18,2 +18,9 @@ 'use strict'; | ||
c.type('altCamel', function(str) { | ||
let result = c.camel(str) | ||
, idx = str.search(/[^_]/) | ||
return idx === 0 ? result : (str.substr(0, idx) + result) | ||
}) | ||
let childSchema = (field, parent) => { | ||
@@ -219,3 +226,3 @@ return isRecursive(field) | ||
return this.transform(obj => obj == null ? obj | ||
: transform(obj, (newobj, val, key ) => newobj[c.camel(key)] = val)) | ||
: transform(obj, (newobj, val, key ) => newobj[c.altCamel(key)] = val)) | ||
}, | ||
@@ -222,0 +229,0 @@ |
@@ -449,2 +449,11 @@ 'use strict'; | ||
it('should camelCase with leading underscore', function(){ | ||
var inst = object().camelcase() | ||
inst | ||
.cast({ CON_STAT: 5, __isNew: true, __IS_FUN: true }) | ||
.should | ||
.eql({ conStat: 5, __isNew: true, __isFun: true }) | ||
}) | ||
it('should CONSTANT_CASE keys', function(){ | ||
@@ -451,0 +460,0 @@ var inst = object().shape({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
348666
9143