# force-canvas-context

> sanity check to get the context if input happens to be the canvas; errors if it can't return a context

Latest version **1.0.0** (published 2015-08-14) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install force-canvas-context
pnpm add force-canvas-context
yarn add force-canvas-context
bun add force-canvas-context
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-08-14 |
| First published | 2015-08-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Will Hoag |
| Maintainers | willhoag |
| Keywords | canvas, sanity, check, convert, html5 |

## Links

- npm: https://www.npmjs.com/package/force-canvas-context
- Repository: https://github.com/willhoag/force-canvas-context
- Homepage: git://github.com/willhoag/force-canvas-context.git
- Issues: https://github.com/willhoag/force-canvas-context/issues
- npm.io page: https://npm.io/package/force-canvas-context

## Dependencies (1)

- [is-canvas-context](https://npm.io/package/is-canvas-context.md) ~0.0.2

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-08-14
- 0.0.5 — 2015-08-11
- 0.0.4 — 2015-08-09
- 0.0.3 — 2015-08-08
- 0.0.2 — 2015-08-08
- 0.0.1 — 2015-08-08
- 0.0.0 — 2015-08-08

## README

# force-canvas-context

sanity check to get the context if input happens to be the canvas; errors if it can't return a context

[![Build Status](https://travis-ci.org/willhoag/force-canvas-context.svg)](https://travis-ci.org/willhoag/force-canvas-context)
[![npm version](https://badge.fury.io/js/force-canvas-context.svg)](http://badge.fury.io/js/force-canvas-context)

## Installation

Download node at [nodejs.org](http://nodejs.org) and install it, if you haven't already.

```sh
npm install force-canvas-context --save
```

## Usage

```js
var forceCanvasContext = require('force-canvas-context');

let canvas = document.createElement('canvas')

let context = forceCanvasContext(canvas)
context = forceCanvasContext(canvas.getContext('2d'))
context = forceCanvasContext('not a context or canvas') // Error
```

## API

`forceCanvasContext(ctx:context):context`

...

## License

MIT

---
_Source: https://npm.io/package/force-canvas-context · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
