Skip to content

Commit

Permalink
boolean.fromString toma el espacio como null
Browse files Browse the repository at this point in the history
  • Loading branch information
emilioplatzer committed Dec 2, 2020
1 parent 2d253f4 commit af1e4ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "type-store",
"description": "type ecosystem",
"version": "0.2.38",
"version": "0.2.39",
"author": "Codenautas <codenautas@googlegroups.com>",
"repository": "codenautas/type-store",
"license": "MIT",
Expand All @@ -11,17 +11,17 @@
"postgres-interval4client.js"
],
"dependencies": {
"big.js": "~6.0.1",
"best-globals": "~0.10.27",
"big.js": "~6.0.2",
"best-globals": "~0.10.30",
"js-to-html": "~1.0.11",
"json4all": "~0.3.10",
"like-ar": "~0.2.19"
},
"devDependencies": {
"expect.js": "~0.3.1",
"istanbul": "~0.4.5",
"mocha": "~8.1.3",
"postgres-interval": "~2.1.0",
"mocha": "~8.2.1",
"postgres-interval": "~3.0.0",
"discrepances": "~0.2.4"
},
"engines": {
Expand Down
2 changes: 2 additions & 0 deletions test/test-fixtures.js
Expand Up @@ -34,7 +34,9 @@ describe("fixtures", function(){
{typeName:'boolean', fixtures:[
{fromString:'s', value:true , fromPlainJson:'true' , toPlainString:'true' , local:'sí', fromLocal:'s', toHtmlText:"<span class=boolean><span class='boolean-true'>sí</span></span>"},
{fromString:'f', value:false, fromPlainJson:'false', toPlainString:'false', local:'no', fromLocal:'N', toHtmlText:"<span class=boolean><span class='boolean-false'>no</span></span>"},
{fromString:' no', value:false, fromPlainJson:'false', toPlainString:'false', local:'no', fromLocal:'N', toHtmlText:"<span class=boolean><span class='boolean-false'>no</span></span>"},
{ value:null , fromPlainJson:'null' , toHtmlText:"<span class=boolean><span class='boolean-null'></span></span>"},
{fromString:' ', value:null , fromPlainJson:'null' , toPlainString:'null', local:''},
]},
{typeName:'text', fixtures:[
{fromString:'-64x6', value:'-64x6', toPlainString:'-64x6', local:'-64x6', toHtmlText:"<span class=text>-64x6</span>"},
Expand Down
2 changes: 1 addition & 1 deletion type-store.js
Expand Up @@ -233,7 +233,7 @@ TypeStore.type.boolean.prototype.toPlainString=function toPlainString(typedValue
};
TypeStore.type.boolean.prototype.fromString=function fromString(textWithValue){
var falseInitials={'n':true,'N':true,'0':true,'2':true,'F':true,'f':true,'\u043d':true,'\u041d':true,'\u0147':true,'\u0148':true};
return textWithValue?!falseInitials[textWithValue[0]]:null;
return textWithValue && textWithValue.trim()?!falseInitials[textWithValue.trim()[0]]:null;
};
TypeStore.type.boolean.prototype.toLocalString=function toLocalString(typedValue){
return TypeStore.messages.boolean[typedValue];
Expand Down

0 comments on commit af1e4ad

Please sign in to comment.