u
This commit is contained in:
@@ -22,6 +22,12 @@
|
||||
*.nosf/
|
||||
*.nosf.*/
|
||||
|
||||
## everything 'git pull or fetch' will update `.git/FETCH_HEAD`, even if the content doesn't change. To avoid too many useless updates of this file in Seafile history:
|
||||
FETCH_HEAD
|
||||
*/FETCH_HEAD
|
||||
|
||||
.Trash/
|
||||
|
||||
.DS_Store
|
||||
*/.DS_Store
|
||||
|
||||
@@ -48,12 +54,18 @@ _desktop.ini
|
||||
node_modules/
|
||||
*/node_modules/
|
||||
package-lock.json
|
||||
*/package-lock.json
|
||||
|
||||
pages4loader.json5
|
||||
*/pages4loader.json5
|
||||
|
||||
.deploy_git/
|
||||
*/.deploy_git/
|
||||
|
||||
# next.js 项目
|
||||
.next/
|
||||
*/.next/
|
||||
|
||||
# HBuilder 目录
|
||||
unpackage/
|
||||
*/unpackage/
|
||||
|
||||
37
tool_core.js
37
tool_core.js
@@ -38,18 +38,42 @@ module.exports = {
|
||||
return obj
|
||||
},
|
||||
|
||||
parse_json (value, { failsafe } = {}) {
|
||||
failsafe = typeof failsafe !== 'undefined' ? failsafe : value
|
||||
if (typeof value === 'object') return value
|
||||
else if (typeof value === 'string') {
|
||||
try {
|
||||
return JSON.parse(value)
|
||||
} catch (e) {
|
||||
return failsafe
|
||||
}
|
||||
} else {
|
||||
return failsafe
|
||||
}
|
||||
},
|
||||
|
||||
parse_json_anyway (value) {
|
||||
try {
|
||||
return JSON.parse(value)
|
||||
} catch (e) {
|
||||
if (typeof value === 'object') return value
|
||||
else if (typeof value === 'string') {
|
||||
try {
|
||||
return JSON.parse(value)
|
||||
} catch (e) {
|
||||
return undefined
|
||||
}
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
},
|
||||
|
||||
parse_json_or_keep (value) {
|
||||
try {
|
||||
return JSON.parse(value)
|
||||
} catch (e) {
|
||||
if (typeof value === 'object') return value
|
||||
else if (typeof value === 'string') {
|
||||
try {
|
||||
return JSON.parse(value)
|
||||
} catch (e) {
|
||||
return value
|
||||
}
|
||||
} else {
|
||||
return value
|
||||
}
|
||||
},
|
||||
@@ -342,7 +366,6 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
// 20250621 todo 如果 text 是 {enUS,zhCN} 怎么处理
|
||||
extract_story_title ({ story, lang = 'enUS' } = {}) {
|
||||
if (Array.isArray(story) && story.length) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user