browser-extension-utils 0.0.1 → 0.0.3

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/lib/index.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export function uniq(array: any[]): any[]
2
+ export function toCamelCase(text: string): string
3
+ export function querySelector(element, selectors?: string): HTMLElement
4
+ export function querySelectorAll(element, selectors?: string): any[]
5
+ export function $(element, selectors?: string): HTMLElement
6
+ export function $$(element, selectors?: string): any[]
7
+ export function createElement(type: string): HTMLElement
8
+ export function addEventListener(element, type, listener): void
9
+ export function setAttribute(element, attr, value): void
10
+ export function setStyle(element, style): void
11
+ export function toStyleMap(styleText: string): Record<string, unknown>
12
+ export function noStyleSpace(text: string): string
13
+ export function createSetStyle(styleText: string): setStyle
14
+ export function isUrl(text: string): boolean
package/lib/index.js CHANGED
@@ -40,7 +40,7 @@ export const setAttribute = (element, attr, value) =>
40
40
 
41
41
  export const setStyle = (element, values) => {
42
42
  // setAttribute(element, "style", value)
43
- const { style } = element
43
+ const style = element.style
44
44
  if (typeof values === "string") {
45
45
  values = toStyleKeyValues(values)
46
46
  }
@@ -69,7 +69,6 @@ const toStyleKeyValues = (styleText) => {
69
69
 
70
70
  export const toStyleMap = (styleText) => {
71
71
  styleText = noStyleSpace(styleText)
72
- console.log(styleText)
73
72
  const map = {}
74
73
  const keyValues = styleText.split("}")
75
74
  for (const keyValue of keyValues) {
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "browser-extension-utils",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Utilities for developing browser extensions and userscripts",
5
5
  "type": "module",
6
+ "main": "./lib/index.js",
6
7
  "exports": "./lib/index.js",
7
8
  "scripts": {
8
9
  "p": "prettier --write .",
@@ -43,6 +44,7 @@
43
44
  "document"
44
45
  ],
45
46
  "rules": {
47
+ "prefer-destructuring": 0,
46
48
  "capitalized-comments": 0
47
49
  }
48
50
  }