@@ -45,22 +45,22 @@ possible matches, and many people, this will block the thread. To avoid this,
45
45
it is recommended to run the script in a WebWorker.
46
46
47
47
``` typescript
48
- import { calculate , Person } from ' gift-exchange' ;
48
+ import { calculate , Person } from " gift-exchange" ;
49
49
50
50
const people: Person [] = [
51
51
{
52
- name: ' Brian'
52
+ name: " Brian" ,
53
53
},
54
54
{
55
- name: ' Freja'
56
- }
55
+ name: " Freja" ,
56
+ },
57
57
];
58
58
59
59
try {
60
60
const matches = calculate (people );
61
61
const pairs: { from: string ; to: string }[] = people .map ((person , i ) => ({
62
62
from: person .name ,
63
- to: matches [i ].name
63
+ to: matches [i ].name ,
64
64
}));
65
65
console .table (pairs );
66
66
} catch (e ) {
@@ -95,43 +95,43 @@ a selector for any number of people that have the given `type` equal to the
95
95
` subject ` .
96
96
97
97
``` typescript
98
- import { Person , Exclusion } from ' gift-exchange' ;
98
+ import { Person , Exclusion } from " gift-exchange" ;
99
99
100
100
const people: Person [] = [
101
101
{
102
- name: ' Brian' ,
103
- group: ' Mitchell'
102
+ name: " Brian" ,
103
+ group: " Mitchell" ,
104
104
},
105
105
{
106
- name: ' Freja' ,
107
- group: ' Andersen'
108
- }
106
+ name: " Freja" ,
107
+ group: " Andersen" ,
108
+ },
109
109
];
110
110
const exclusions: Exclusion [] = [
111
111
// a person with the name "Brian" cannot be assigned to a person with the name
112
112
// "Freja" (but "Freja" could still be assigned to "Brian")
113
113
{
114
- type: ' name' ,
115
- subject: ' Brian' ,
116
- excludedType: ' name' ,
117
- excludedSubject: ' Freja'
114
+ type: " name" ,
115
+ subject: " Brian" ,
116
+ excludedType: " name" ,
117
+ excludedSubject: " Freja" ,
118
118
},
119
119
// anyone with the group "Andersen" cannot be assigned to a person with the
120
120
// name "Brian"
121
121
{
122
- type: ' group' ,
123
- subject: ' Andersen' ,
124
- excludedType: ' name' ,
125
- excludedSubject: ' Brian'
122
+ type: " group" ,
123
+ subject: " Andersen" ,
124
+ excludedType: " name" ,
125
+ excludedSubject: " Brian" ,
126
126
},
127
127
// anyone with the group "Andersen" cannot be assigned to a person with the
128
128
// group "Mitchell"
129
129
{
130
- type: ' group' ,
131
- subject: ' Andersen' ,
132
- excludedType: ' group' ,
133
- excludedSubject: ' Mitchell'
134
- }
130
+ type: " group" ,
131
+ subject: " Andersen" ,
132
+ excludedType: " group" ,
133
+ excludedSubject: " Mitchell" ,
134
+ },
135
135
];
136
136
```
137
137
0 commit comments