index.js
function getParent(role) {
        var result = [];

        for (var parentRole in permissions) {
            if (permissions[parentRole].indexOf(role) > -1) {
                result.push(parentRole);
                result = result.concat(getParent(parentRole));
            }
        }
        return result;
    }
function getParent(role) {
        var result = [];

        for (var parentRole in permissions) {
            if (permissions[parentRole].indexOf(role) > -1) {
                result.push(parentRole);
                result = result.concat(getParent(parentRole));
            }
        }
        return result;
    }
function getParent ( role ) { var result = [ ] ; for ( var parentRole in permissions ) { if ( permissions [ parentRole ] . indexOf ( role ) > - 1 ) { result . push ( parentRole ) ; result = result . concat ( getParent ( parentRole ) ) ; } } return result ; }
Remove parent permissions from flattenpermissions when subpermissions aren't found within it
Remove parent permissions from flattenpermissions when subpermissions aren t found within it