优化文档

This commit is contained in:
陈小术 2021-10-12 23:55:55 +08:00
parent 87825f7635
commit 2d7f5929a4
3 changed files with 14 additions and 3 deletions

View File

@ -10,15 +10,25 @@
```
const captcha = require('@itriton/captcha')
// 默认
// 默认(promise)
captcha.create().then(res=>{
console.log(res)
})
// 自定义参数
// 自定义参数(promise)
captcha.create(options).then(res=>{
console.log(res)
})
// 默认(async/await)
async function captcha(){
const result = await captcha.create()
}
// 自定义参数(async/await)
async function captcha(){
const result = await captcha.create(options)
}
```

View File

@ -16,6 +16,7 @@ const create = async function (options) {
const left = randomRangeNum(size, width - size);
const top = randomRangeNum(size, height - size);
const border = 1;
// Generate Jigsaw Image
const jigsawBaseImage = await sharp(baseImage)
.extract({ left: 0, top: top, width: size, height: size })

View File

@ -1,6 +1,6 @@
{
"name": "@itriton/captcha",
"version": "0.3.1",
"version": "0.3.2",
"description": "生成滑动验证码拼图图片和背景图片",
"main": "index.js",
"scripts": {