update-browserslist-db 1.0.7 → 1.0.8
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.
- package/index.js +1 -11
- package/package.json +1 -1
- package/utils.js +9 -0
package/index.js
CHANGED
|
@@ -4,17 +4,7 @@ let pico = require('picocolors')
|
|
|
4
4
|
let path = require('path')
|
|
5
5
|
let fs = require('fs')
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
const INDENT_REGEXP = /^(\s+)[^\s]/m
|
|
9
|
-
|
|
10
|
-
function detectIndent(text) {
|
|
11
|
-
try {
|
|
12
|
-
return INDENT_REGEXP.exec(text)[1] || DEFAULT_INDENT
|
|
13
|
-
} catch (e) {
|
|
14
|
-
/* c8 ignore next 2 */
|
|
15
|
-
return DEFAULT_INDENT
|
|
16
|
-
}
|
|
17
|
-
}
|
|
7
|
+
const { detectIndent } = require('./utils')
|
|
18
8
|
|
|
19
9
|
function BrowserslistUpdateError(message) {
|
|
20
10
|
this.name = 'BrowserslistUpdateError'
|
package/package.json
CHANGED
package/utils.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const DEFAULT_INDENT = ' '
|
|
2
|
+
const INDENT_REGEXP = /^([ \t]+)[^\s]/m
|
|
3
|
+
|
|
4
|
+
module.exports.detectIndent = text => {
|
|
5
|
+
let match = INDENT_REGEXP.exec(text)
|
|
6
|
+
if (match !== null) return match[1]
|
|
7
|
+
return DEFAULT_INDENT
|
|
8
|
+
}
|
|
9
|
+
module.exports.DEFAULT_INDENT = DEFAULT_INDENT
|