build/tasks/aria-supported.js
function getDiff(base, subject, type) {
				const diff = [];
				const notes = [];

				const sortedBase = Array.from(base.entries()).sort();

				sortedBase.forEach(([key] = item) => {
					switch (type) {
						case 'supported':
							if (
								subject.hasOwnProperty(key) &&
								subject[key].unsupported === false
							) {
								diff.push([`${key}`, 'Yes']);
							}
							break;
						case 'unsupported':
							if (
								(subject[key] && subject[key].unsupported === true) ||
								!subject.hasOwnProperty(key)
							) {
								diff.push([`${key}`, 'No']);
							} else if (
								subject[key] &&
								subject[key].unsupported &&
								subject[key].unsupported.exceptions
							) {
								diff.push([`${key}`, `Mixed[^${notes.length + 1}]`]);
								notes.push(
									getSupportedElementsAsFootnote(
										subject[key].unsupported.exceptions
									)
								);
							}
							break;
						case 'all':
						default:
							diff.push([
								`${key}`,
								subject.hasOwnProperty(key) &&
								subject[key].unsupported === false
									? 'Yes'
									: 'No'
							]);
							break;
					}
				});

				return {
					diff,
					notes
				};
			}
function getDiff(base, subject, type) {
				const diff = [];
				const notes = [];

				const sortedBase = Array.from(base.entries()).sort();

				sortedBase.forEach(([key] = item) => {
					switch (type) {
						case 'supported':
							if (
								subject.hasOwnProperty(key) &&
								subject[key].unsupported === false
							) {
								diff.push([`${key}`, 'Yes']);
							}
							break;
						case 'unsupported':
							if (
								(subject[key] && subject[key].unsupported === true) ||
								!subject.hasOwnProperty(key)
							) {
								diff.push([`${key}`, 'No']);
							} else if (
								subject[key] &&
								subject[key].unsupported &&
								subject[key].unsupported.exceptions
							) {
								diff.push([`${key}`, `Mixed[^${notes.length + 1}]`]);
								notes.push(
									getSupportedElementsAsFootnote(
										subject[key].unsupported.exceptions
									)
								);
							}
							break;
						case 'all':
						default:
							diff.push([
								`${key}`,
								subject.hasOwnProperty(key) &&
								subject[key].unsupported === false
									? 'Yes'
									: 'No'
							]);
							break;
					}
				});

				return {
					diff,
					notes
				};
			}
function getDiff ( base , subject , type ) { const diff = [ ] ; const notes = [ ] ; const sortedBase = Array . from ( base . entries ( ) ) . sort ( ) ; sortedBase . forEach ( ( [ key ] = item ) => { switch ( type ) { case 'supported' : if ( subject . hasOwnProperty ( key ) && subject [ key ] . unsupported === false ) { diff . push ( [ ` ${ key } ` , 'Yes' ] ) ; } break ; case 'unsupported' : if ( ( subject [ key ] && subject [ key ] . unsupported === true ) || ! subject . hasOwnProperty ( key ) ) { diff . push ( [ ` ${ key } ` , 'No' ] ) ; } else if ( subject [ key ] && subject [ key ] . unsupported && subject [ key ] . unsupported . exceptions ) { diff . push ( [ ` ${ key } ` , ` ${ notes . length + 1 } ` ] ) ; notes . push ( getSupportedElementsAsFootnote ( subject [ key ] . unsupported . exceptions ) ) ; } break ; case 'all' : default : diff . push ( [ ` ${ key } ` , subject . hasOwnProperty ( key ) && subject [ key ] . unsupported === false ? 'Yes' : 'No' ] ) ; break ; } } ) ; return { diff , notes } ; }
Given a `base` Map and `subject` Map object,
The function converts the `base` Map entries to an array which is sorted then enumerated to compare each entry against the `subject` Map
The function constructs a `string` to represent a `markdown table`, as well as returns notes to append to footnote
@param {Map} base Base Map Object
@param {Map} subject Subject Map Object
@param {String} type type to compare
@returns {Array<Object>[]}
@example Example Output: [ [ 'alert', 'No' ], [ 'figure', 'Yes' ] ]
Given a base Map and subject Map object The function converts the base Map entries to an array which is sorted then enumerated to compare each entry against the subject Map The function constructs a string to represent a markdown table as well as returns notes to append to footnote