Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.5KB

4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. wide-align
  2. ----------
  3. A wide-character aware text alignment function for use in terminals / on the
  4. console.
  5. ### Usage
  6. ```
  7. var align = require('wide-align')
  8. // Note that if you view this on a unicode console, all of the slashes are
  9. // aligned. This is because on a console, all narrow characters are
  10. // an en wide and all wide characters are an em. In browsers, this isn't
  11. // held to and wide characters like "古" can be less than two narrow
  12. // characters even with a fixed width font.
  13. console.log(align.center('abc', 10)) // ' abc '
  14. console.log(align.center('古古古', 10)) // ' 古古古 '
  15. console.log(align.left('abc', 10)) // 'abc '
  16. console.log(align.left('古古古', 10)) // '古古古 '
  17. console.log(align.right('abc', 10)) // ' abc'
  18. console.log(align.right('古古古', 10)) // ' 古古古'
  19. ```
  20. ### Functions
  21. #### `align.center(str, length)` → `str`
  22. Returns *str* with spaces added to both sides such that that it is *length*
  23. chars long and centered in the spaces.
  24. #### `align.left(str, length)` → `str`
  25. Returns *str* with spaces to the right such that it is *length* chars long.
  26. ### `align.right(str, length)` → `str`
  27. Returns *str* with spaces to the left such that it is *length* chars long.
  28. ### Origins
  29. These functions were originally taken from
  30. [cliui](https://npmjs.com/package/cliui). Changes include switching to the
  31. MUCH faster pad generation function from
  32. [lodash](https://npmjs.com/package/lodash), making center alignment pad
  33. both sides and adding left alignment.