sofa-hessian-node
Advanced tools
Comparing version 1.7.0 to 1.7.1
1.7.1 / 2020-03-30 | ||
================== | ||
**fixes** | ||
* [[`5bf7db4`](http://github.com/sofastack/sofa-hessian-node/commit/5bf7db4cdb26f2a092b71e3649e955b59293689f)] - fix: fix some generic case (#26) (killa <<killa123@126.com>>) | ||
* [[`7a46513`](http://github.com/sofastack/sofa-hessian-node/commit/7a4651303702610d3f2e372d56b3b52357e6441e)] - fix: fix array generic type should start with [ (#25) (killa <<killa123@126.com>>) | ||
1.7.0 / 2020-02-25 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -82,10 +82,15 @@ 'use strict'; | ||
if (Array.isArray(attr.generic)) { | ||
parseGenericTypeVar(attr.generic, info, attr); | ||
attr.generic = parseGenericTypeVar(attr.generic, info, attr); | ||
} | ||
if (has(attr, 'typeAliasIndex') && Array.isArray(info.generic)) { | ||
attr.type = info.generic[attr.typeAliasIndex].type; | ||
if (info.generic[attr.typeAliasIndex].generic) { | ||
attr.generic = info.generic[attr.typeAliasIndex].generic; | ||
const refType = info.generic[attr.typeAliasIndex]; | ||
attr.type = refType.type; | ||
if (refType.generic) { | ||
attr.generic = refType.generic; | ||
} | ||
attr.isArray = refType.isArray; | ||
attr.isMap = refType.isMap; | ||
attr.isEnum = refType.isEnum; | ||
attr.arrayDepth = refType.arrayDepth; | ||
} | ||
@@ -104,9 +109,7 @@ const uniqueId = utils.normalizeUniqId(attr, version); | ||
function parseGenericTypeVar(generic, info) { | ||
const newGeneric = []; | ||
for (const genericItem of generic) { | ||
let newType = genericItem; | ||
if (genericItem.typeVar === true && has(genericItem, 'typeAliasIndex') && Array.isArray(info.generic)) { | ||
genericItem.type = info.generic[genericItem.typeAliasIndex].type; | ||
if (info.generic[genericItem.typeAliasIndex].generic) { | ||
genericItem.generic = info.generic[genericItem.typeAliasIndex].generic; | ||
} | ||
newType = Object.create(null, Object.getOwnPropertyDescriptors(info.generic[genericItem.typeAliasIndex])); | ||
} | ||
@@ -116,5 +119,7 @@ | ||
if (Array.isArray(genericItem.generic)) { | ||
parseGenericTypeVar(genericItem.generic, info); | ||
newType.generic = parseGenericTypeVar(genericItem.generic, info); | ||
} | ||
newGeneric.push(newType); | ||
} | ||
return newGeneric; | ||
} | ||
@@ -121,0 +126,0 @@ |
@@ -10,3 +10,8 @@ 'use strict'; | ||
for (const item of type.generic) { | ||
str += ('#' + item.type + normalizeGeneric(item)); | ||
str += '#'; | ||
if (item.isArray) { | ||
let arrayDepth = item.arrayDepth || 1; | ||
while (arrayDepth--) str += '['; | ||
} | ||
str += (item.type + normalizeGeneric(item)); | ||
} | ||
@@ -13,0 +18,0 @@ return str; |
{ | ||
"name": "sofa-hessian-node", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"description": "An internal improved version of Hessian powered by Ant Financial.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
41651
763