wikibase-cli 18.0.2 → 18.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { isPlainObject } from 'lodash-es'
2
2
  import { localLang } from '#lib/local_lang'
3
+ import { isValidLang } from '#lib/validate'
3
4
 
4
5
  const boolean = {
5
6
  type: 'boolean',
@@ -35,7 +36,7 @@ export default {
35
36
  lang: {
36
37
  type: 'lang',
37
38
  default: localLang,
38
- test: str => typeof str === 'string' && str.length <= 3,
39
+ test: isValidLang,
39
40
  },
40
41
  verbose: boolean,
41
42
  credentials: object,
package/lib/local_lang.js CHANGED
@@ -1,4 +1,7 @@
1
+ import { isValidLang } from './validate.js'
2
+
1
3
  const { LANG } = process.env
2
4
 
3
5
  // process.env.LANG is apparently not defined on Windows
4
- export const localLang = (LANG && LANG.split(/[\W_-]/)[0]) || 'en'
6
+ const lang = (LANG && LANG.split(/[\W_-]/)[0])
7
+ export const localLang = isValidLang(lang) ? lang : 'en'
package/lib/validate.js CHANGED
@@ -1,2 +1,4 @@
1
1
  // Valid lang examples: en, war, tt-cyrl, be-tarask
2
- export const isValidLang = str => /^[a-z]{2,4}(-[a-z]{2,10})?$/.test(str)
2
+ export function isValidLang (str) {
3
+ return typeof str === 'string' && /^[a-z]{2,4}(-[a-z]{2,10})?$/.test(str)
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikibase-cli",
3
- "version": "18.0.2",
3
+ "version": "18.0.4",
4
4
  "description": "A command-line interface to Wikibase",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -58,7 +58,7 @@
58
58
  "split": "^1.0.1",
59
59
  "through": "^2.3.8",
60
60
  "wikibase-edit": "^7.0.4",
61
- "wikibase-sdk": "^10.0.2",
61
+ "wikibase-sdk": "^10.1.0",
62
62
  "wikidata-lang": "^2.0.11"
63
63
  },
64
64
  "devDependencies": {