captcha-image
Advanced tools
Comparing version 1.1.0 to 1.2.0
class Captcha { | ||
constructor(font, align, baseline, width, height, bgColor, color) { | ||
let code; | ||
this.font = font; | ||
@@ -10,2 +11,5 @@ this.align = align; | ||
this.bgColor = bgColor; | ||
this.getCode = () => { | ||
return code; | ||
}; | ||
this.createImage = () => { | ||
@@ -42,2 +46,3 @@ const captcha = document.createElement('canvas'); | ||
const newWord = getWord(); | ||
code = getWord(); | ||
const context = captcha.getContext('2d'); | ||
@@ -44,0 +49,0 @@ context.canvas.width = this.width; |
{ | ||
"name": "captcha-image", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A simple captcha image generator.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,3 +14,3 @@ # Captcha Image Generator | ||
```js | ||
import Captcha from './Captcha'; | ||
import Captcha from './captcha-image'; | ||
@@ -36,2 +36,3 @@ const captchaImage = new Captcha( | ||
function App() { | ||
console.log(captchaImage.getCode()); | ||
return ( | ||
@@ -51,9 +52,9 @@ <div className='App'> | ||
- [font](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font): '35px Arial' | ||
- [align](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign): 'center' | ||
- [baseline](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textBaseline): 'middle | ||
- width: 300 | ||
- height: 150 | ||
- bgColor: #eee | ||
- color: #222 | ||
- [font] / String: (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font): '35px Arial' | ||
- [align] / String: (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign): 'center' | ||
- [baseline] / String: (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textBaseline): 'middle | ||
- width / Number: 300 | ||
- height / Number: 150 | ||
- bgColor / String: #eee | ||
- color / String: #222 | ||
@@ -63,1 +64,2 @@ ## Events | ||
- createImage() method return HTML element parsed as String | ||
- getCode() method return generate code as String |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3509
57
62