Socket
Socket
Sign inDemoInstall

svg-captcha

Package Overview
Dependencies
2
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.5 to 1.3.6

HISTORY.md

7

index.d.ts

@@ -69,2 +69,4 @@ /**

* text: captcha text
* @param {ConfigObject} [options]
* @return {CaptchaObj}
*/

@@ -78,2 +80,4 @@ export function create(options?: ConfigObject): CaptchaObj;

* this means that text is the result of the math expression
* @param {ConfigObject} [options]
* @return {CaptchaObj}
*/

@@ -83,2 +87,3 @@ export function createMathExpr(options?: ConfigObject): CaptchaObj;

* Override the default font with your own
* @param {string} url
*/

@@ -92,3 +97,5 @@ export function loadFont(url: string): void;

* return a random string
* @param {number} size
* @return {string}
*/
export function randomText(size): string;
'use strict';
const assert = require('assert');
function rndPathCmd(cmd) {
const r = (Math.random() * 0.2) - 0.1;
switch (cmd.type) {
case 'M': case 'L':
cmd.x += r;
cmd.y += r;
break;
case 'Q': case 'C':
cmd.x += r;
cmd.y += r;
cmd.x1 += r;
cmd.y1 += r;
break;
default:
// Close path cmd
break;
}
return cmd;
}
module.exports = function (text, opts) {

@@ -17,2 +39,4 @@ const ch = text[0];

const path = glyph.getPath(left, top, fontSize);
// Randomize path commands
path.commands.forEach(rndPathCmd);

@@ -19,0 +43,0 @@ const pathData = path.toPathData();

4

package.json
{
"name": "svg-captcha",
"version": "1.3.5",
"version": "1.3.6",
"description": "generate svg captcha in node.js or express.js",

@@ -40,3 +40,3 @@ "main": "index.js",

"fs-extra": "^3.0.1",
"mocha": "^3.3.0",
"mocha": "^3.4.2",
"xo": "^0.18.2"

@@ -43,0 +43,0 @@ },

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