updated 姑表姐妹夫bug修复
This commit is contained in:
parent
da7bd9058f
commit
5cbd9e9dca
4
dist/relationship.min.js
vendored
4
dist/relationship.min.js
vendored
File diff suppressed because one or more lines are too long
4
dist/relationship.zh-HK.min.js
vendored
4
dist/relationship.zh-HK.min.js
vendored
File diff suppressed because one or more lines are too long
@ -91,20 +91,21 @@ export function getItemsById(id){
|
||||
res.push(_data[key][0]);
|
||||
}else{
|
||||
var ids = [];
|
||||
if(_data[key+'&o']){
|
||||
ids.push(key+'&o');
|
||||
}
|
||||
if(_data[key+'&l']){
|
||||
ids.push(key+'&l');
|
||||
}
|
||||
var k = key.replace(/[ol](b|s)/,'x$1');
|
||||
if(_data[k]){
|
||||
ids.push(k);
|
||||
}
|
||||
k = key.replace(/(.+)(,[hw])$/,'$1&o$2').replace(/(,[^hw])$/,'$1&o');
|
||||
if(_data[k]){
|
||||
ids.push(k);
|
||||
}
|
||||
k = key.replace(/(.+)(,[hw])$/,'$1&l$2').replace(/(,[^hw])$/,'$1&l');
|
||||
if(_data[k]){
|
||||
ids.push(k);
|
||||
}
|
||||
res = filterId(ids).map(function(id){
|
||||
return _data[id][0];
|
||||
});
|
||||
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
@ -3,7 +3,7 @@ var test = require('tape');
|
||||
var relationship = require('..');
|
||||
|
||||
test('relationship.js show to be tested', function (t) {
|
||||
// console.log('[test]',relationship({text:'舅舅家哥哥的老婆'}));
|
||||
// console.log('[test]',relationship({text:'爸爸的妹妹的女儿的老公'}));
|
||||
|
||||
t.deepEqual(relationship({text:'儿子的爸爸的妈妈',sex:1}),['妈妈']);
|
||||
t.deepEqual(relationship({text:'爱人',sex:1}),['老婆']);
|
||||
@ -39,7 +39,8 @@ test('relationship.js show to be tested', function (t) {
|
||||
t.deepEqual(relationship({text:'爸爸的二爸'}),['二爷爷']);
|
||||
t.deepEqual(relationship({text:'大舅',target:'二舅的儿子'}),['伯父']);
|
||||
t.deepEqual(relationship({text:'堂哥',target:'叔叔',type:'pair'}),['叔侄','父子']);
|
||||
t.deepEqual(relationship({text:'堂哥',target:'叔叔',type:'pair',optimal:true}),['父子']);
|
||||
t.deepEqual(relationship({text:'爸爸的妹妹的女儿的老公'}),['姑表姐夫','姑表妹夫']);
|
||||
t.deepEqual(relationship('外婆和奶奶之间是什么关系?'),['儿女亲家']);
|
||||
t.deepEqual(relationship('妈妈应该如何称呼姑姑'),['姑子']);
|
||||
t.deepEqual(relationship('姑奶奶是什么关系'),['爸爸的爸爸的姐妹']);
|
||||
t.deepEqual(relationship('姑奶奶和爸爸是什么关系'),['姑侄']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user