function filter(packages, active) {
    // turn active into an array if it isn't one, so this function can deal with lists and one-offs
    if (!Array.isArray(active)) {
        active = [active];
    }

    return _.reduce(packages, function (result, pkg, key) {
        let item = {};
        if (!key.match(notAPackageRegex)) {
            item = {
                name: key,
                package: pkg['package.json'] || false,
                active: _.indexOf(active, key) !== -1
            };

            result.push(item);
        }

        return result;
    }, []);
}
### Filter Packages
Normalizes packages read by readPackages so that the themes module can use them.
Iterates over each package and return an array of objects which are simplified representations of the package
with 3 properties:

@typedef {object} SimplePackage
@prop {string} name    - the package name
@prop {object|boolean} package - contents of the package.json or false if there isn't one
@prop {boolean} active  - set to true if this package is active

This data structure is used for listings of packages provided over the API and as such
deliberately combines multiple sources of information in order to be efficient.

TODO: simplify the package.json representation to contain only fields we use

@param   {PackageList}       packages    object made up of packages keyed by name as returned by readPackages
@param   {array|string}      [active]    optional set of names of packages that are active
@returns {Array<SimplePackage>}          array of objects with useful info about themes