updated 年龄推导“弟弟的表哥”异常修复

This commit is contained in:
mumuy 2021-11-23 08:38:36 +08:00
parent c509802710
commit b2d6c3be22
6 changed files with 32 additions and 13 deletions

18
dist/relationship.js vendored
View File

@ -11,16 +11,24 @@
}(typeof window !== 'undefined' ? window : this,function (){
//简写
var _filter = [
/* 表亲 */
{//表亲的关系
/* 年龄 */
{//有大有小,增加不确定性
exp:/^(.+)&o([^#]+)&l/g,
str:'$1$2'
},
{//表亲的关系
{//有大有小,增加不确定性
exp:/^(.+)&l([^#]+)&o/g,
str:'$1$2'
},
{//表亲的关系
{//有大有小,增加不确定性
exp:/^(.+)?,o([sb])([^#]+)&l/g,
str:'$1,x$2$3'
},
{//有大有小,增加不确定性
exp:/^(.+)?,l([sb])([^#]+)&o/g,
str:'$1,x$2$3'
},
{//隔代跨越,增加不确定性
exp:/(,[ds],(.+),[ds])&[ol]/g,
str:'$1'
},
@ -2515,7 +2523,7 @@
});
return unique(result);
};
relationship({'text':'弟弟的表哥'});
// 数据量
relationship.dataCount = 0;
for(var i in _data){

File diff suppressed because one or more lines are too long

View File

@ -127,6 +127,9 @@
<p class="a">儿子的大舅的二姑妈的七舅姥爷</p>
<p class="q">4. 不限制方向祖辈孙辈跨度,反复查询:</p>
<p class="a">舅妈的婆婆的外甥的姨妈的侄子的爷爷</p>
<p class="q">5. 年龄推导:</p>
<p class="a">哥哥的表哥 = 姑表哥、舅表哥</p>
<p class="a">弟弟的表哥 = 姑表哥、姑表弟、舅表哥、舅表弟</p>
</div>
</div>
<div class="c-panel">

View File

@ -11,16 +11,24 @@
}(typeof window !== 'undefined' ? window : this,function (){
//简写
var _filter = [
/* 表亲 */
{//表亲的关系
/* 年龄 */
{//有大有小,增加不确定性
exp:/^(.+)&o([^#]+)&l/g,
str:'$1$2'
},
{//表亲的关系
{//有大有小,增加不确定性
exp:/^(.+)&l([^#]+)&o/g,
str:'$1$2'
},
{//表亲的关系
{//有大有小,增加不确定性
exp:/^(.+)?,o([sb])([^#]+)&l/g,
str:'$1,x$2$3'
},
{//有大有小,增加不确定性
exp:/^(.+)?,l([sb])([^#]+)&o/g,
str:'$1,x$2$3'
},
{//隔代跨越,增加不确定性
exp:/(,[ds],(.+),[ds])&[ol]/g,
str:'$1'
},
@ -2515,7 +2523,7 @@
});
return unique(result);
};
relationship({'text':'弟弟的表哥'});
// 数据量
relationship.dataCount = 0;
for(var i in _data){

View File

@ -258,10 +258,10 @@ a:hover{
line-height: 22px;
}
.mod-panel .intro p.q{
margin-top: 10px;
font-weight: bold;
}
.mod-panel .intro p.a{
margin-bottom: 10px;
color: #666;
}

View File

@ -12,6 +12,7 @@ test('relationship.js show to be tested', function (t) {
t.deepEqual(relationship({text:'老婆的外孙的姥爷',sex:1}),['自己']);
t.deepEqual(relationship({text:'表姐的哥哥',sex:1}),['姑表哥','舅表哥']);
t.deepEqual(relationship({text:'表姐的妹妹',sex:1}),['姑表姐','姑表妹','舅表姐','舅表妹']);
t.deepEqual(relationship({text:'弟弟的表哥',sex:1}),['姑表哥','姑表弟','舅表哥','舅表弟']);
t.deepEqual(relationship({text:'老公的老婆的儿子的爸爸',sex:0}),['老公']);
t.deepEqual(relationship({text:'哥哥的弟弟的爸爸的儿子',sex:1}),['兄弟','自己']);
t.deepEqual(relationship({text:'爸爸的舅舅',sex:0,reverse:true}),['甥孙女']);