<commit_before>const { api, _, Action } = require("../..")
const flat = require("flat")
const promisify = require('util').promisify;
const defer = require('pull-defer')
module.exports = () => {
 
function hasPerms(peerID,rPeerID,path,cb){

  api.friends.isFriend(peerID,(err,isFriend)=>{
    if(err) return cb(err,false)
    if(isFriend) return cb(null,true)
    api.identities.get(peerID,(err,identity)=>{
      if(err) return cb(err,false)
      if(identity.groups && identity.groups.length >0){
        api.identities.get(rPeerID,function(err,rIdentity){
          if(err) return cb(err,false)
        
          if(rIdentity.groups && rIdentity.groups.length >0){
            _(identity.groups,_.asycMap(function(g,cb){
              api.groups.get(g,(err,g2)=>{
                if(err) return (null,undefined)
                return cb(null,g2)
              })   
            }),_.filter(),_.filter(function(g){
                return g.allow.indexOf(path) ==-1 && rIdentity.groups.indexOf(g) ==-1 
            }),_.collect(function(err,groups){
              if(Array.isArray(groups) && groups.length>0)   return cb(null,true)
         
              return cb(null,false)
            }))
            return   <commit_msg>fix typo<commit_after>const { api, _, Action } = require("../..")
const flat = require("flat")
const promisify = require('util').promisify;
const defer = require('pull-defer')
module.exports = () => {
 
function hasPerms(peerID,rPeerID,path,cb){

  api.friends.isFriend(peerID,(err,isFriend)=>{
    if(err) return cb(err,false)
    if(isFriend) return cb(null,true)
    api.identities.get(peerID,(err,identity)=>{
      if(err) return cb(err,false)
      if(identity.groups && identity.groups.length >0){
        api.identities.get(rPeerID,function(err,rIdentity){
          if(err) return cb(err,false)
        
          if(rIdentity.groups && rIdentity.groups.length >0){
            _(identity.groups,_.asyncMap(function(g,cb){
              api.groups.get(g,(err,g2)=>{
                if(err) return (null,undefined)
                return cb(null,g2)
              })   
            }),_.filter(),_.filter(function(g){
                return g.allow.indexOf(path) ==-1 && rIdentity.groups.indexOf(g) ==-1 
            }),_.collect(function(err,groups){
              if(Array.isArray(groups) && groups.length>0)   return cb(null,true)
         
              return cb(null,false)
            }))
            return   
{'fraction_non_alphanumeric': 0.16136919315403422, 'fraction_numerical': 0.0057049714751426246, 'mean_word_length': 2.4192200557103063, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1737091', 'n_tokens_mistral': 782, 'n_tokens_neox': 759, 'n_words': 117}