<commit_before>import {createDefer} from './async';

export function $ToPromise<A>(p: JQueryPromise<A>): Promise<A> {
  const defer = createDefer<A, any>();
  p.done(defer.resolve)
    .fail(defer.reject);
  return defer.promise;
}<commit_msg>added commented out jquery ajax alternative<commit_after>import {createDefer} from './async';

export function $ToPromise<A>(p: JQueryPromise<A>): Promise<A> {
  const defer = createDefer<A, any>();
  p.done(defer.resolve)
    .fail(defer.reject);
  // p.done((data,textStatus,jqXHR)=>defer.resolve({data:data,textStatus:textStatus,jqXHR:jqXHR}))
  //   .fail((req,status,error)=>defer.reject({req:req,status:status,error:error}));
  return defer.promise;
}
{'fraction_non_alphanumeric': 0.17857142857142858, 'fraction_numerical': 0.0, 'mean_word_length': 6.153061224489796, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '5235352', 'n_tokens_mistral': 253, 'n_tokens_neox': 242, 'n_words': 41}