1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
import * as fr from './find-reverse.js';
function reverseHelper(spec) {
const cache = new WeakMap();
return (thing, data) => {
return ({spec, from: thing, data: data.length});
};
}
const hardcodedReverseSpecs = {};
const findReverseHelperConfig = {
word: `reverse`,
constructorKey: Symbol.for('Thing.reverseSpecs'),
hardcodedSpecs: hardcodedReverseSpecs,
postprocessSpec: postprocessReverseSpec,
};
export function postprocessReverseSpec(spec, {thingConstructor}) {
const newSpec = {...spec};
void thingConstructor;
return newSpec;
}
export function getAllReverseSpecs() {
return fr.getAllSpecs(findReverseHelperConfig);
}
export function findReverseSpec(key) {
return fr.findSpec(key, findReverseHelperConfig);
}
export default fr.tokenProxy({
findSpec: findReverseSpec,
prepareBehavior: reverseHelper,
});
export function bindReverse(wikiData, opts) {
return fr.bind(wikiData, opts, {
getAllSpecs: getAllReverseSpecs,
prepareBehavior: reverseHelper,
});
}
|