npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

boks

v1.0.3

Published

Border or boxes that can be used to wrap text

Downloads

30

Readme

boks

Build Status Coverage Status codecov npm npm NPM GitHub repo size

Border or boxes that can be used to wrap text.

Similar to cli-boxes but includes:

  • Abitilty to have different top, bottom, left and right borders.
  • Ability to have intersections +.
  • Attempt to discover intersection and corner types based on provided values.

Install

npm install boks

Usage

const boks = require('boks');

console.log(boks.templates.single);
/*
┌─┬─┐
│ │ │
├─┼─┤
│ │ │
└─┴─┘
*/
// OR

const options = {
	horizontal: borders.HorizontalLines.line,
	vertical: borders.VerticalLines.double,
};

console.log(boks.getBorder(options));
/*
 ╓─╥─╖
 ║ ║ ║
 ╟─╫─╢
 ║ ║ ║
 ╙─╨─╜
*/

Exposed functions

  • getBorder: build the borders from an options object (or an array of options objects).
  • fixMultiple: Fix missing borders based on an array of option object.
  • fixBorders: Fix missing borders based on a options object.
  • fixCorners: Only fix the missing corner values of an outside border.
  • fixIntersections: fix Intersection values (+) based on values of surrounding border types.

Standard templates available

  • empty: no borders;
  • single: single lined borders;
  • round: single lined with rounded corner borders;
  • double: double lined borders;
  • singleDouble: single horizontal lines, double vertical lines;
  • doubleSingle: double horizontal lines, single vertical lines;
  • boldSingle: bold horizontal lines, single vertical lines;
  • singleBold: single horizontal lines, bold vertical lines;

Options

Options are passed as an object and can have the following properties:

| property | type | description | | ----------------- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | horizontal | borders.HorizontalLines | The value to use for all horizontal lines. | | Vertical | borders.VerticalLines | The value to use for all vertical lines. | | topLeft | borders.TopLeftBorder | borders.Verticallines | borders.HorizontalLines | borders.LeftIntersect | false | The value of the topleft corner. If false, no corner will be added or discovered. | | topRight | borders.TopRightBorder | borders.Verticallines | borders.HorizontalLines | borders.RightIntersect | false | The value of the topRight corner. If false, no corner will be added or discovered. | | bottomLeft | borders.BottomLeftBorder | borders.Verticallines | borders.HorizontalLines | borders.LeftIntersect | false | The value of the bottomLeft corner. If false, no corner will be added or discovered. | | bottomRight | borders.BottomRightBorder | borders.Verticallines | borders.HorizontalLines | borders.RightIntersect | false | The valui of the bottom Right corner. If false, no corner will be added or discovered. | | topIntersect | borders.TopIntersect | borders.Verticallines | borders.HorizontalLines | borders.Intersect | The value of the top Intersection part (i.e. between 2 columns top). | | bottomintersect | borders.BottomIntersect | borders.Verticallines | borders.HorizontalLines | borders.Intersect | The value of the bottom Intersection part (i.e. between 2 columns bottom). | | leftIntersect | borders.LeftIntersect | borders.HorizontalLines | borders.VerticalLines | The value of the left border of the right column. | | rightIntersect | borders.RightIntersect | borders.HorizontalLines | borders.VerticalLines | The value of the right border of the left column. | | intersect | borders.Intersect | borders.VerticalLines | borders.HorizontalLines | The value of the column intersections (+). | | extendFrom | BorderTypes | The base to extend the border value from. | | strict | boolean | If set to true, will not inherit from any but will strictly use explicitly set values. (i.e. will not use 'extendFrom' but only values entered above). | | buildTableBorders | boolean | If true and used with strict option the table will outomatically be built. Values to build from will be horizontal and vertical and may include: top right, bottom and left values if provided. | | keepBorderSpace | boolean | If true and if no Horizontal or Vertical Lines has been selected a space will be included as border spacing. |

Please note

Not all border types have corresponding intersection types and the best solution is sought.

Contributions

Any contributions are welcome.

Patches

  • 1.0.1
    • update the node version from >=8.5.0 to >=10.0.0.