<commit_before>/*
 * layout
 * https://github.com/twolfson/layout
 *
 * Copyright (c) 2012 <NAME>
 * Licensed under the MIT license.
 */

exports.awesome = function() {
  return 'awesome';
};

/**
 * Method to add new algorithms via
 * @param {String} name Name of algorithm
 * @param {Function} algorithm Algorithm to bind under name
 */
function addAlgorithm(name, algorithm) {
  // Save the algorithm to algorithms
  algorithms[name] = algorithm;
}
// Make algorithms easier to add
Spritesmith.addAlgorithm = addAlgorithm;
Spritesmith.algorithms = algorithms;

// Add default algorithms
addAlgorithm('top-down', require('./algorithms/top-down.algorithm.js'));
addAlgorithm('bottom-up', require('./algorithms/bottom-up.algorithm.js'));
addAlgorithm('left-right', require('./algorithms/left-right.algorithm.js'));
addAlgorithm('right-left', require('./algorithms/right-left.algorithm.js'));
addAlgorithm('diagonal', require('./algorithms/diagonal.algorithm.js'));
addAlgorithm('negative-diagonal', require('./algorithms/negative-diagonal.algorithm.js'));
addAlgorithm('reverse-diagonal', require('./algorithms/reverse-diagonal.algorithm.js'));<commit_msg>Converted layout to decent API<commit_after>// Load in packing.smith (from spritesmith) and create algorithm store
var PackingSmith = require('./smiths/packing.smith.js'),
    algorithms = {};

/**
 * Layout adds items in an algorithmic fashion
 * @constructor
 * @param {String|Function} [algorithm="top-down"] Name of algorithm or custom algorithm to use
 * Algorithms available: top-down, bottom-up, left-right, right-left, diagonal, negative-diagonal, reverse-diagonal
 */
function Layout(algorithmName) {
  // Save the algorithmName as our algorithm (assume function)
  var algorithm = algorithmName || 'top-down';

  // If the algorithm is a string, look it up
  if (typeof algorithm === 'string') {
    algorithm = algorithms[algorithmName];

    // Assert that the algorithm was found
    assert(algorithm, 'Sorry, the \'' + algorithmName +'\' algorithm could not be loaded.');
  }

  // Create a new PackingSmith with our algorithm and return
  var retSmith = new PackingSmith(algorithm);
  return retSmith;
}

/**
 * Method to add new algorithms via
 * @param {String} name Name of algorithm
 * @param {Function} algorithm Algorithm to bind under name
 */
function addAlgorithm(name, algorithm) {
  // Save the algorithm to algorithms
  algorithms[name] = algorithm;
}
// Make algorithms easier to add and expose them
Layout.addAlgorithm = addAlgorithm;
Layout.algorithms = algorithms;

// Add default algorithms
addAlgorithm('top-down', require('./algorithms/top-down.algorithm.js'));
addAlgorithm('bottom-up', require('./algorithms/bottom-up.algorithm.js'));
addAlgorithm('left-right', require('./algorithms/left-right.algorithm.js'));
addAlgorithm('right-left', require('./algorithms/right-left.algorithm.js'));
addAlgorithm('diagonal', require('./algorithms/diagonal.algorithm.js'));
addAlgorithm('negative-diagonal', require('./algorithms/negative-diagonal.algorithm.js'));
addAlgorithm('reverse-diagonal', require('./algorithms/reverse-diagonal.algorithm.js'));

// Expose Layout to the outside
module.exports = Layout;
{'fraction_non_alphanumeric': 0.14227514885615794, 'fraction_numerical': 0.0012535255405828893, 'mean_word_length': 5.022641509433963, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, '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': '5343966', 'n_tokens_mistral': 868, 'n_tokens_neox': 837, 'n_words': 242}