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.
Files changed (3) hide show
  1. package/index.js +1 -11
  2. package/package.json +1 -1
  3. 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 DEFAULT_INDENT = ' '
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "update-browserslist-db",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "CLI tool to update caniuse-lite to refresh target browsers from Browserslist config",
5
5
  "keywords": [
6
6
  "caniuse",
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