index.js 349 B

12345678910111213141516
  1. /*!
  2. * center-align <https://github.com/jonschlinkert/center-align>
  3. *
  4. * Copycenter (c) 2015, Jon Schlinkert.
  5. * Licensed under the MIT License.
  6. */
  7. 'use strict';
  8. var utils = require('./utils');
  9. module.exports = function centerAlign(val) {
  10. return utils.align(val, function (len, longest) {
  11. return Math.floor((longest - len) / 2);
  12. });
  13. };