import Policy from '@pansy/policy' ; import isArray from 'lodash/isArray' ; import isString from 'lodash/isString' ; export type Authority = string [ ] | string ; param { 权限判定 | Permission judgment param { 权限验证方法 | no pass const checkAuthority = ( policy , authority ) : boolean => { let result = true ; if ( isArray ( authority ) ) { if ( ! policy . multipleVerify ( authority ) ) { result = false ; } } if ( isString ( authority ) ) { if ( ! policy . combinationVerify ( authority ) ) { result = false ; } } return result ; } ; export default checkAuthority ;