<commit_before>'use strict';

var every          = Array.prototype.every
  , call           = Function.prototype.call
  , assertNotNull  = require('es5-ext/lib/assert-not-null')
  , isError        = require('es5-ext/lib/Error/is-error')
  , silent         = require('es5-ext/lib/Function/prototype/silent')
  , assertCallable = require('es5-ext/lib/Object/assert-callable')
  , create         = require('es5-ext/lib/Object/prototype/plain-create')
  , isPromise      = require('../../is-promise')
  , promise        = require('../../promise')

var proto = {
	iterate: function self (value, index) {
		if (!this.initialized) {
			this.initialized = true;
			return isError(this.current = value) ? false : true;
		}
		if (this.current && isPromise(this.current)) {
			this.current =
				this.current(this.processValue.bind(this, value, index));
		} else if (isError(this.current =
			this.processValue(value, index, this.current))) {
			return false;
		}
		return true;
	},
	processValue: function (value, index, accumulator) {
		if (this.cb) {
			if (value && isPromise(value)) {
				return value(this.processCb.bind(this, accumulator, index));
			} else {
				return this.processCb(accumulator, index, value);
			}
		} else {
			return value;
		}<commit_msg>Work on resolved values if it's safe and they're available<commit_after>'use strict';

var every          = Array.prototype.every
  , call           = Function.prototype.call
  , assertNotNull  = require('es5-ext/lib/assert-not-null')
  , isError        = require('es5-ext/lib/Error/is-error')
  , silent         = require('es5-ext/lib/Function/prototype/silent')
  , assertCallable = require('es5-ext/lib/Object/assert-callable')
  , create         = require('es5-ext/lib/Object/prototype/plain-create')
  , isPromise      = require('../../is-promise')
  , promise        = require('../../promise')

var proto = {
	iterate: function self (value, index) {
		if (!this.initialized) {
			this.initialized = true;
			return isError(this.current = value) ? false : true;
		}
		if (this.current && isPromise(this.current)) {
			this.current =
				this.current(this.processValue.bind(this, value, index));
		} else if (isError(this.current =
			this.processValue(value, index, this.current))) {
			return false;
		}
		return true;
	},
	processValue: function (value, index, accumulator) {
		if (this.cb) {
			if (value && isPromise(value)) {
				value = value(this.processCb.bind(this, accumulator, index));
			} else {
				value = this.processCb(accumulator, index, value);
			}
		}
		if (isPromise(value)) {
			value = value.valueOf();
		}
		return value;
{'fraction_non_alphanumeric': 0.1552318896128785, 'fraction_numerical': 0.0038328861632809506, 'mean_word_length': 3.0590979782270606, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3675258', 'n_tokens_mistral': 922, 'n_tokens_neox': 844, 'n_words': 164}