<commit_before>/*!
 * Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file.
 */

/* eslint no-unused-vars: ["error", { "vars": "local" }] */
/* global Uint8Array, FileReader */

const {ExifImage} = require('exif');

/**
* Draws the image on the canvas so that the thumbnail
* could be generated
* @param {Object} options(options(orientation: image exif orientation range from 1-8, img: Image object, x: start x-axis, y: start y-axis, width: width of the thumbnail, height: height of the thumbnail, deg: counterclockwise degree rotation, flip: flip Image, ctx: canvas context))
* @returns {Object}
*/
export function drawImage(options) {
  // save current context before applying transformations
  options.ctx.save();
  let rad;

  // convert degrees to radians
  if (options.flip) {
    rad = options.deg * Math.PI / 180;
  }
  else {
    rad = 2 * Math.PI - options.deg * Math.PI / 180;
  }
  // set the origin to the center of the image<commit_msg>chore(helper-image): use polyfilled version of buffer<commit_after>/*!
 * Copyright (c) 2015-2019 Cisco Systems, Inc. See LICENSE file.
 */

/* eslint no-unused-vars: ["error", { "vars": "local" }] */
/* global Uint8Array, FileReader */

const {Buffer} = require('safe-buffer');
const {ExifImage} = require('exif');

/**
* Draws the image on the canvas so that the thumbnail
* could be generated
* @param {Object} options(options(orientation: image exif orientation range from 1-8, img: Image object, x: start x-axis, y: start y-axis, width: width of the thumbnail, height: height of the thumbnail, deg: counterclockwise degree rotation, flip: flip Image, ctx: canvas context))
* @returns {Object}
*/
export function drawImage(options) {
  // save current context before applying transformations
  options.ctx.save();
  let rad;

  // convert degrees to radians
  if (options.flip) {
    rad = options.deg * Math.PI / 180;
  }
  else {
    rad = 2 * Math.PI - options.deg * Math.PI / 180;
  }
  // set the origin to the center of the image
{'fraction_non_alphanumeric': 0.12969454181271908, 'fraction_numerical': 0.018027040560841263, 'mean_word_length': 3.6901408450704225, 'pattern_counts': {'":': 2, '<': 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': '1082717', 'n_tokens_mistral': 643, 'n_tokens_neox': 604, 'n_words': 231}