Socket
Socket
Sign inDemoInstall

trim-canvas

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    trim-canvas

A tiny library for trimming whitespace from a canvas element


Version published
Weekly downloads
194K
decreased by-18.22%
Maintainers
1
Install size
7.17 kB
Created
Weekly downloads
 

Readme

Source

trim-canvas

NPM

A tiny (< 100 LoC) library for trimming whitespace from a canvas element with no dependencies.

Installation

npm i -S trim-canvas

Usage

import trimCanvas from 'trim-canvas'

let canvas = document.createElement('canvas')

// do some drawing on it ...

trimCanvas(canvas)
// now the whitespace has been trimmed

If you don't want to mess with your existing canvas, then simply clone the canvas element beforehand.

trim-canvas returns the canvas element for easy chaining.

Credits

Credits go to @efc for writing a quick version of this in this issue and to the original StackOverflow Answer that was credited in that issue.

Keywords

FAQs

Last updated on 25 May 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc