Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

captcha-image

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

captcha-image - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

7

index.js
class Captcha {
constructor(font, align, baseline, width, height, bgColor, color) {
let code;
this.font = font;

@@ -11,9 +10,5 @@ this.align = align;

this.bgColor = bgColor;
this.getCode = () => {
return code;
};
this.createImage = () => {
const captcha = document.createElement('canvas');
const newImage = document.createElement('image');
newImage.id = 'canvas';

@@ -46,3 +41,2 @@ const getRandomInt = (min, max) => {

const newWord = getWord();
code = getWord();
const context = captcha.getContext('2d');

@@ -59,2 +53,3 @@ context.canvas.width = this.width;

newImage.setAttribute('src', context.canvas.toDataURL());
newImage.setAttribute('data-key', newWord);
return newImage.outerHTML;

@@ -61,0 +56,0 @@ };

2

package.json
{
"name": "captcha-image",
"version": "1.2.0",
"version": "1.2.1",
"description": "A simple captcha image generator.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -35,3 +35,2 @@ # Captcha Image Generator

function App() {
console.log(captchaImage.getCode());
return (

@@ -62,2 +61,9 @@ <div className='App'>

- createImage() method return HTML element parsed as String
- getCode() method return generate code as String
## Output
Final outcome looks like this:
```html
<img src="..." data-key="..." />
```
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc