Merge branch 'master' of github.com:mumuy/relationship
# Conflicts: # dist/relationship.min.js # dist/relationship.zh-HK.min.js
This commit is contained in:
commit
4565f39e49
2
dist/relationship.min.js
vendored
2
dist/relationship.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/relationship.zh-HK.min.js
vendored
2
dist/relationship.zh-HK.min.js
vendored
File diff suppressed because one or more lines are too long
@ -87,7 +87,6 @@ export default {
|
||||
'w,f,[xs|xs,h]':['姑岳父母'],
|
||||
'w,m,[xb|xb,w]':['舅岳父母'],
|
||||
'w,m,[xs|xs,h]':['姨岳父母'],
|
||||
'w,[ls|os],h':['襟兄弟'],
|
||||
'w,[f,xs|m,xb],d':['姑舅姨子'],
|
||||
'w,[f,xs|m,xb],d,h':['姑舅连襟','姑舅连桥'],
|
||||
'h,[f|m]':['公婆','翁姑','姑翁','大家官','公公婆婆','姑嫜'],
|
||||
@ -118,6 +117,7 @@ export default {
|
||||
'xb,[s|d]':['侄子女','侄子侄女'],
|
||||
'xs,[s|d]':['甥子女','外甥子女'],
|
||||
'[w|s|d]':['妻儿'],
|
||||
'[w|d]':['妻女'],
|
||||
'[s|d]':['子女','儿女','小孩','孩子','孩子们','孩儿','小孩儿','宝宝','宝贝','娃','儿辈','子辈','子息','子嗣','崽','幺儿'],
|
||||
'[s|d],[s|d]':['孙辈','孙息','孙枝'],
|
||||
's,[s|d]':['孙子女'],
|
||||
@ -404,7 +404,7 @@ export default {
|
||||
'w,ls':['小姨子','小姨妹','小茙儿','姨妹','姨仔','姨妹子'],
|
||||
'w,ls,h':['小姨夫','小姨妹夫','小茙夫','襟弟','小尹子'],
|
||||
'w,xs':['姨子','妻姨'],
|
||||
'w,xs,h':['连襟','连桥','两桥','姨夫','姨夫爷','一担挑','老挑','挑担','担儿挑','连襟儿','妻尹','娅'],
|
||||
'w,xs,h':['连襟','姨夫','连桥','两桥','两乔','姨夫爷','一担挑','老挑','挑担','担儿挑','连襟儿','襟兄弟','妻尹','娅'],
|
||||
'w,xs,s':['姨甥'],
|
||||
'w,xs,d':['姨甥女'],
|
||||
// 兄弟姐妹系
|
||||
|
@ -104,6 +104,17 @@ var getOptimal = function(options){
|
||||
from = from_chain.slice(i).join(',');
|
||||
to = to_chain.slice(i+1).join(',');
|
||||
sex = to_chain[i].match(/^([fhs1](&[ol\d]+)?|[olx]b)(&[ol\d]+)?/)?1:0;
|
||||
}else if(options['optimal']){
|
||||
from_match = from_chain[i].match(/([xol])[bs]/);
|
||||
to_match = to_chain[i].match(/([xol])[bs]/);
|
||||
from_attr = from_match?from_match[1]:'';
|
||||
to_attr = to_match?to_match[1]:'';
|
||||
if(from_attr=='x'||to_attr=='x'){
|
||||
from = from_chain.slice(i+1).join(',');
|
||||
to = to_chain.slice(i+1).join(',');
|
||||
sex = from_chain[i].match(/^([fhs1](&[ol\d]+)?|[olx]b)(&[ol\d]+)?/)?1:0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -312,7 +323,8 @@ export function mergeSelector(param){
|
||||
var ops = getOptimal({
|
||||
'from':from,
|
||||
'to':to,
|
||||
'sex':my_sex
|
||||
'sex':my_sex,
|
||||
'optimal':param.optimal
|
||||
});
|
||||
from = ops['from'];
|
||||
to = ops['to'];
|
||||
|
@ -4,6 +4,7 @@ var relationship = require('..');
|
||||
|
||||
test('relationship.js show to be tested', function (t) {
|
||||
// console.log('[test]',relationship({text:'堂哥',target:'叔叔',type:'pair',optimal:true}));
|
||||
|
||||
t.deepEqual(relationship({text:'儿子的爸爸的妈妈',sex:1}),['妈妈']);
|
||||
t.deepEqual(relationship({text:'爱人',sex:1}),['老婆']);
|
||||
t.deepEqual(relationship({text:'爱人的爱人',sex:1}),['自己']);
|
||||
@ -37,5 +38,6 @@ 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.end();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user