nightingale-browser-console 14.1.0 → 14.2.0

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/CHANGELOG.md CHANGED
@@ -1,8 +1,18 @@
1
- # Change Log
1
+ # Changelog
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [14.2.0](https://github.com/christophehurpeau/nightingale/compare/v14.1.0...v14.2.0) (2023-11-04)
7
+
8
+ Note: no notable changes
9
+
10
+ Version bump for dependency: nightingale-browser-console-formatter
11
+ Version bump for dependency: nightingale-console-output
12
+ Version bump for dependency: nightingale-debug
13
+ Version bump for dependency: nightingale-types
14
+
15
+
6
16
  ## [14.1.0](https://github.com/christophehurpeau/nightingale/compare/v14.0.2...v14.1.0) (2023-07-27)
7
17
 
8
18
  **Note:** Version bump only for package nightingale-browser-console
@@ -12,7 +12,7 @@ function getDebugString() {
12
12
 
13
13
  // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param
14
14
  var debugFromQueryString = decodeURI(querystring.replace(
15
- // eslint-disable-next-line unicorn/no-unsafe-regex, prefer-regex-literals
15
+ // eslint-disable-next-line prefer-regex-literals
16
16
  new RegExp('^(?:.*[&\\?]DEBUG(?:\\=([^&]*))?)?.*$', 'i'), '$1'));
17
17
  return (debugFromLocalStorage ? debugFromLocalStorage + "," : '') + debugFromQueryString;
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index-browser.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex, prefer-regex-literals\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'dark' | 'light';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\nexport interface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n"],"names":["getDebugString","_document$location","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","_unused","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConso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C,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,KAAY,EAAiC;AAAA,EAAA,IAA7CA,KAAY,KAAA,KAAA,CAAA,EAAA;IAAZA,KAAY,GAAGJ,eAAe,EAAE,CAAA;AAAA,GAAA;AACrD,EAAA,IAAMK,uBAAuB,GAAGC,6BAA6B,CAACF,KAAK,CAAC,CAAA;EACpE,OAAO,UAAqBG,MAAoB,EAAK;AACnDC,IAAAA,aAAa,CAACH,uBAAuB,CAACE,MAAM,CAAC,EAAEA,MAAM,CAAC,CAAA;GACvD,CAAA;AACH,CAAC,CAAA;AAMD,IAAaE,qBAAqB,GAOhC,SAAAA,sBAAYZ,QAAe,EAAEa,OAAqC,EAAO;AAAA,EAAA,IAA5CA,OAAqC,KAAA,KAAA,CAAA,EAAA;IAArCA,OAAqC,GAAG,EAAE,CAAA;AAAA,GAAA;EAAA,IANvEb,CAAAA,QAAQ,GAAU,CAAC,CAAA;AAOjB,EAAA,IAAI,CAACc,UAAU,GAAG,UAACC,KAAY,EAAEd,GAAW,EAAA;AAAA,IAAA,OAC1Cc,KAAK,IAAIhB,cAAc,CAACC,QAAQ,EAAEC,GAAG,CAAC,CAAA;AAAA,GAAA,CAAA;EAExC,IAAI,CAACe,MAAM,GAAGV,aAAa,CAACO,OAAO,CAACN,KAAK,CAAC,CAAA;AAC5C;;;;"}
1
+ {"version":3,"file":"index-browser.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line prefer-regex-literals\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'dark' | 'light';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\nexport interface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n"],"names":["getDebugString","_document$location","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","_unused","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAcA,GAAW;AAAA,EAAA,IAAAC,kBAAA,CAAA;EACvC,IAAMC,WAAW,GAAAD,CAAAA,kBAAA,G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E,CAAA;AAAA,GAAA;AACrD,EAAA,IAAMK,uBAAuB,GAAGC,6BAA6B,CAACF,KAAK,CAAC,CAAA;EACpE,OAAO,UAAqBG,MAAoB,EAAK;AACnDC,IAAAA,aAAa,CAACH,uBAAuB,CAACE,MAAM,CAAC,EAAEA,MAAM,CAAC,CAAA;GACvD,CAAA;AACH,CAAC,CAAA;AAMD,IAAaE,qBAAqB,GAOhC,SAAAA,sBAAYZ,QAAe,EAAEa,OAAqC,EAAO;AAAA,EAAA,IAA5CA,OAAqC,KAAA,KAAA,CAAA,EAAA;IAArCA,OAAqC,GAAG,EAAE,CAAA;AAAA,GAAA;EAAA,IANvEb,CAAAA,QAAQ,GAAU,CAAC,CAAA;AAOjB,EAAA,IAAI,CAACc,UAAU,GAAG,UAACC,KAAY,EAAEd,GAAW,EAAA;AAAA,IAAA,OAC1Cc,KAAK,IAAIhB,cAAc,CAACC,QAAQ,EAAEC,GAAG,CAAC,CAAA;AAAA,GAAA,CAAA;EAExC,IAAI,CAACe,MAAM,GAAGV,aAAa,CAACO,OAAO,CAACN,KAAK,CAAC,CAAA;AAC5C;;;;"}
@@ -11,7 +11,7 @@ function getDebugString() {
11
11
 
12
12
  // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param
13
13
  const debugFromQueryString = decodeURI(querystring.replace(
14
- // eslint-disable-next-line unicorn/no-unsafe-regex, prefer-regex-literals
14
+ // eslint-disable-next-line prefer-regex-literals
15
15
  new RegExp('^(?:.*[&\\?]DEBUG(?:\\=([^&]*))?)?.*$', 'i'), '$1'));
16
16
  return (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') + debugFromQueryString;
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index-browsermodern.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex, prefer-regex-literals\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'dark' | 'light';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\nexport interface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n"],"names":["getDebugString","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","constructor","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAcA,GAAW;AACvC,EAAA,MAAMC,WAAW,GAAGC,QAAQ,CAACC,QAAQ,EAAEC,MAAM,CAAA;AAC7C,EAAA,MAAMC,qBAAqB,GACxBC,MAAM,CAACC,YAAY,IAAIA,YAAY,CAACC,OAAO,CAAC,OAAO,CAAC,IAAK,EAAE,CAAA;EAE9D,IAAI,CAACP,WAAW,EAAE;AAChB,IAAA,OAAOI,qBAAqB,CAAA;AAC9B,GAAA;;AAEA;AACA,EAAA,MAAMI,oBAAoB,GAAGC,SAAS,CACpCT,WAAW,CAACU,OAAO;AACjB;EACA,IAAIC,MAAM,CAAC,uCAAuC,EAAE,GAAG,CAAC,EACxD,IACF,CACF,CAAC,CAAA;EAED,OACE,CAACP,qBAAqB,GAAI,CAAA,EAAEA,qBAAsB,CAAE,CAAA,CAAA,GAAG,EAAE,IACzDI,oBAAoB,CAAA;AAExB;;ACTA;AACA,MAAMI,cAAc,GAAGA,CAACC,QAAe,EAAEC,GAAW,KAClDC,oBAAoB,CAAChB,cAAc,EAAE,CAAC,CAACc,QAAQ,EAAEC,GAAG,CAAC,CAAA;AAIvD,MAAME,eAAe,GAAGA,MAAa;EACnC,IAAI;AACF,IAAA,MAAMC,oBAAoB,GAAGX,YAAY,CAACC,OAAO,CAAC,mBAAmB,CAAC,CAAA;AACtE,IAAA,IAAIU,oBAAoB,IAAIA,oBAAoB,KAAK,MAAM,EAAE;AAC3D,MAAA,OAAOA,oBAAoB,CAAA;AAC7B,KAAA;GACD,CAAC,MAAM,EAAC;AACT,EAAA,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAMC,aAAa,GAAGA,CAACC,KAAY,GAAGH,eAAe,EAAE,KAAa;AAClE,EAAA,MAAMI,uBAAuB,GAAGC,6BAA6B,CAACF,KAAK,CAAC,CAAA;AACpE,EAAA,OAA4BG,MAAoB,IAAK;AACnDC,IAAAA,aAAa,CAACH,uBAAuB,CAACE,MAAM,CAAC,EAAEA,MAAM,CAAC,CAAA;GACvD,CAAA;AACH,CAAC,CAAA;AAMM,MAAME,qBAAqB,CAAoB;AACpDX,EAAAA,QAAQ,GAAU,CAAC,CAAA;AAMnBY,EAAAA,WAAWA,CAACZ,QAAe,EAAEa,OAAqC,GAAG,EAAE,EAAE;AACvE,IAAA,IAAI,CAACC,UAAU,GAAG,CAACC,KAAY,EAAEd,GAAW,KAC1Cc,KAAK,IAAIhB,cAAc,CAACC,QAAQ,EAAEC,GAAG,CAAC,CAAA;IAExC,IAAI,CAACe,MAAM,GAAGX,aAAa,CAACQ,OAAO,CAACP,KAAK,CAAC,CAAA;AAC5C,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"index-browsermodern.es.js","sources":["../src/debug.ts","../src/index.ts"],"sourcesContent":["export function getDebugString(): string {\n const querystring = document.location?.search;\n const debugFromLocalStorage =\n (window.localStorage && localStorage.getItem('debug')) || '';\n\n if (!querystring) {\n return debugFromLocalStorage;\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param\n const debugFromQueryString = decodeURI(\n querystring.replace(\n // eslint-disable-next-line prefer-regex-literals\n new RegExp('^(?:.*[&\\\\?]DEBUG(?:\\\\=([^&]*))?)?.*$', 'i'),\n '$1',\n ),\n );\n\n return (\n (debugFromLocalStorage ? `${debugFromLocalStorage},` : '') +\n debugFromQueryString\n );\n}\n","import { createBrowserConsoleFormatter } from 'nightingale-browser-console-formatter';\nimport consoleOutput from 'nightingale-console-output';\nimport { createFindDebugLevel } from 'nightingale-debug';\nimport type {\n Level,\n Handle,\n IsHandling,\n LogRecord,\n Metadata,\n Handler,\n} from 'nightingale-types';\nimport { getDebugString } from './debug';\n\n// debug string can change any time (localStorage), so we need a new object each time.\nconst findDebugLevel = (minLevel: Level, key: string): Level =>\n createFindDebugLevel(getDebugString())(minLevel, key);\n\ntype Theme = 'dark' | 'light';\n\nconst getDefaultTheme = (): Theme => {\n try {\n const configInLocalStorage = localStorage.getItem('NIGHTINGALE_THEME');\n if (configInLocalStorage && configInLocalStorage === 'dark') {\n return configInLocalStorage;\n }\n } catch {}\n return 'light';\n};\n\nconst createHandler = (theme: Theme = getDefaultTheme()): Handle => {\n const browserConsoleFormatter = createBrowserConsoleFormatter(theme);\n return <T extends Metadata>(record: LogRecord<T>) => {\n consoleOutput(browserConsoleFormatter(record), record);\n };\n};\n\nexport interface BrowserConsoleHandlerOptions {\n theme?: Theme;\n}\n\nexport class BrowserConsoleHandler implements Handler {\n minLevel: Level = 0;\n\n handle: Handle;\n\n isHandling: IsHandling;\n\n constructor(minLevel: Level, options: BrowserConsoleHandlerOptions = {}) {\n this.isHandling = (level: Level, key: string) =>\n level >= findDebugLevel(minLevel, key);\n\n this.handle = createHandler(options.theme);\n }\n}\n"],"names":["getDebugString","querystring","document","location","search","debugFromLocalStorage","window","localStorage","getItem","debugFromQueryString","decodeURI","replace","RegExp","findDebugLevel","minLevel","key","createFindDebugLevel","getDefaultTheme","configInLocalStorage","createHandler","theme","browserConsoleFormatter","createBrowserConsoleFormatter","record","consoleOutput","BrowserConsoleHandler","constructor","options","isHandling","level","handle"],"mappings":";;;;AAAO,SAASA,cAAcA,GAAW;AACvC,EAAA,MAAMC,WAAW,GAAGC,QAAQ,CAACC,QAAQ,EAAEC,MAAM,CAAA;AAC7C,EAAA,MAAMC,qBAAqB,GACxBC,MAAM,CAACC,YAAY,IAAIA,YAAY,CAACC,OAAO,CAAC,OAAO,CAAC,IAAK,EAAE,CAAA;EAE9D,IAAI,CAACP,WAAW,EAAE;AAChB,IAAA,OAAOI,qBAAqB,CAAA;AAC9B,GAAA;;AAEA;AACA,EAAA,MAAMI,oBAAoB,GAAGC,SAAS,CACpCT,WAAW,CAACU,OAAO;AACjB;EACA,IAAIC,MAA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AA;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nightingale-browser-console",
3
- "version": "14.1.0",
3
+ "version": "14.2.0",
4
4
  "description": "Browser console handler for nightingale",
5
5
  "keywords": [
6
6
  "nightingale",
@@ -43,6 +43,10 @@
43
43
  }
44
44
  },
45
45
  "sideEffects": false,
46
+ "files": [
47
+ "src",
48
+ "dist"
49
+ ],
46
50
  "scripts": {
47
51
  "build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
48
52
  "build:definitions": "tsc -p tsconfig.json",
@@ -68,16 +72,15 @@
68
72
  ]
69
73
  },
70
74
  "dependencies": {
71
- "nightingale-browser-console-formatter": "14.1.0",
72
- "nightingale-console-output": "14.1.0",
73
- "nightingale-debug": "14.1.0",
74
- "nightingale-types": "14.1.0"
75
+ "nightingale-browser-console-formatter": "14.2.0",
76
+ "nightingale-console-output": "14.2.0",
77
+ "nightingale-debug": "14.2.0",
78
+ "nightingale-types": "14.2.0"
75
79
  },
76
80
  "devDependencies": {
77
- "@babel/core": "7.22.9",
78
- "@babel/preset-env": "7.22.9",
79
- "pob-babel": "36.2.0",
80
- "typescript": "5.1.6"
81
- },
82
- "gitHead": "fa6fa6109188db75b1b0e6a7ad5d6ae607a26711"
83
- }
81
+ "@babel/core": "7.23.2",
82
+ "@babel/preset-env": "7.23.2",
83
+ "pob-babel": "36.4.4",
84
+ "typescript": "5.2.2"
85
+ }
86
+ }
package/src/debug.ts CHANGED
@@ -10,7 +10,7 @@ export function getDebugString(): string {
10
10
  // https://developer.mozilla.org/en-US/docs/Web/API/URLUtils/search#Get_the_value_of_a_single_search_param
11
11
  const debugFromQueryString = decodeURI(
12
12
  querystring.replace(
13
- // eslint-disable-next-line unicorn/no-unsafe-regex, prefer-regex-literals
13
+ // eslint-disable-next-line prefer-regex-literals
14
14
  new RegExp('^(?:.*[&\\?]DEBUG(?:\\=([^&]*))?)?.*$', 'i'),
15
15
  '$1',
16
16
  ),
package/.editorconfig DELETED
@@ -1,13 +0,0 @@
1
- # EditorConfig helps developers define and maintain consistent
2
- # coding styles between different editors and IDEs
3
- # http://editorconfig.org
4
-
5
- root = true
6
-
7
- [*]
8
- indent_style = space
9
- indent_size = 2
10
- end_of_line = lf
11
- charset = utf-8
12
- trim_trailing_whitespace = true
13
- insert_final_newline = true
package/.eslintrc.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "root": true,
3
- "extends": ["@pob/eslint-config/root-module"],
4
- "env": {
5
- "browser": true
6
- },
7
- "ignorePatterns": ["*.d.ts", "/dist"]
8
- }
package/AUTHORS DELETED
@@ -1 +0,0 @@
1
- Christophe Hurpeau <christophe@hurpeau.com>