<commit_before>var hummus = require('hummus');
var _ = require('lodash');
var extractPlacements = require('./placements-extraction');
var transformations = require('./transformations');
var CollectionState = require('./collection-state');
var FontDecoding = require('./font-decoding');

function readResources(resources,pdfReader,result) {
    var extGStates = {};
    var fonts = {};

    if(resources.exists('ExtGState')) {
        var extGStatesEntry = pdfReader.queryDictionaryObject(resources,'ExtGState');
        if(!!extGStatesEntry) {
            var extGStatesJS = extGStatesEntry.toPDFDictionary().toJSObject();
            _.forOwn(extGStatesJS,(extGState,extGStateName)=>{
                if(extGState.getType() === hummus.ePDFIndirectObjectReference) {
                    extGState = pdfReader.parseNewObject(extGState.toPDFIndirectObjectReference().getObjectID()).toPDFDictionary();
                }
                else {
                    extGState = pdfReader.parseNewObject(extGState.toPDFIndirectObjectReference().getObjectID()).toPDFDictionary();
                }

                if(!!extGState) {
                    var item = {<commit_msg>else case should handle direct containement<commit_after>var hummus = require('hummus');
var _ = require('lodash');
var extractPlacements = require('./placements-extraction');
var transformations = require('./transformations');
var CollectionState = require('./collection-state');
var FontDecoding = require('./font-decoding');

function readResources(resources,pdfReader,result) {
    var extGStates = {};
    var fonts = {};

    if(resources.exists('ExtGState')) {
        var extGStatesEntry = pdfReader.queryDictionaryObject(resources,'ExtGState');
        if(!!extGStatesEntry) {
            var extGStatesJS = extGStatesEntry.toPDFDictionary().toJSObject();
            _.forOwn(extGStatesJS,(extGState,extGStateName)=>{
                if(extGState.getType() === hummus.ePDFIndirectObjectReference) {
                    extGState = pdfReader.parseNewObject(extGState.toPDFIndirectObjectReference().getObjectID()).toPDFDictionary();
                }
                else {
                    extGState = extGState.toPDFDictionary();
                }

                if(!!extGState) {
                    var item = {
{'fraction_non_alphanumeric': 0.12581628210709622, 'fraction_numerical': 0.0, 'mean_word_length': 2.9689119170984455, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6330469', 'n_tokens_mistral': 619, 'n_tokens_neox': 596, 'n_words': 89}