UNPKG

580 BJavaScriptView Raw
1export const options = {
2 functionMarker: 'i18n',
3 elementMarker: 'I18N',
4 whitelistedAttributes: {
5 a: ['href'],
6 img: ['alt'],
7 '*': ['title', 'placeholder', 'alt', 'summary', 'i18n-id',],
8 'Match': ['when'],
9 },
10};
11
12
13export const whitelist = (function(wl) {
14 const shared = wl['*'];
15 return Object.keys(wl).reduce((whitelist, name) => {
16 const attrs = wl[name];
17 if (name !== '*') {
18 wl[name] = attrs.concat(shared);
19 }
20 return wl;
21 }, {'*': shared});
22})(options.whitelistedAttributes);