Skip to content

Commit

Permalink
chore: 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
AJLoveChina committed May 26, 2023
1 parent 14b9914 commit f245a5f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootcdn",
"version": "3.0.0",
"version": "3.0.1",
"description": "查询web开源库的bootcdn地址",
"main": "src/lib/bootcdn.js",
"scripts": {
Expand Down
15 changes: 9 additions & 6 deletions src/lib/bootcdn.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ module.exports = {
getDetail: getLibDetail,
getDesc(name, version) {
if (["list", "detail", "all", "version"].indexOf(version) !== -1) {
return this.getDetail(name).then(res => {
return this.getDetail(name).then(res => res.data).then(res => {
if (res instanceof Array) {
res = res[0];
}
let list = [];
list.push(`主页 : ${res.data.homepage}`);
list.push(`描述 : ${res.data.description}`);
list.push(`license : ${res.data.license}`);
list.push(`已列出所有的版本, 最新版本是 ${res.data.version}`);
list.push(...res.data.assets.map(item => item.version));
list.push(`主页 : ${res.homepage}`);
list.push(`描述 : ${res.description}`);
list.push(`license : ${res.license}`);
list.push(`已列出所有的版本, 最新版本是 ${res.version}`);
list.push(...res.assets.map(item => item.version));

list = list.reverse();
return list;
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Created by jiehe2 2018/4/28
let bootcdn = require("../src/lib/bootcdn")

bootcdn.getDesc("jquery", "1.5").then(data => {
bootcdn.getDesc("jquery", "all").then(data => {
console.log(data);
}).catch(err => {
console.log(err.message);
Expand Down

0 comments on commit f245a5f

Please sign in to comment.