@newlogic-digital/cookieconsent-js 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.
Files changed (2) hide show
  1. package/index.js +4 -4
  2. package/package.json +4 -1
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export const appendCookieConsent = (element, options = {}) => {
2
2
  options = {
3
- ignoreAttributeName: '',
3
+ ignoreAttributeName: /(type)/,
4
4
  delay: 0,
5
5
  ...options
6
6
  }
@@ -8,7 +8,7 @@ export const appendCookieConsent = (element, options = {}) => {
8
8
  const script = document.createElement('script')
9
9
 
10
10
  ;[...element.attributes].forEach(({ specified, name, value }) => {
11
- if (specified && name.includes(options.ignoreAttributeName) && name.includes('type')) {
11
+ if (specified && !name.match(options.ignoreAttributeName)) {
12
12
  script.setAttribute(name, value)
13
13
  }
14
14
  })
@@ -30,10 +30,10 @@ export const unsetCookieConsent = () => {
30
30
 
31
31
  export const setCookieConsent = (type, options) => {
32
32
  options = {
33
- name: 'lib-cookieconsent',
33
+ name: 'cookieconsent-js',
34
34
  expire: 31556926 * 1000,
35
35
  setItem: (key, value) => localStorage.setItem(key, value),
36
- getItem: (key, value) => localStorage.getItem(key),
36
+ getItem: key => localStorage.getItem(key),
37
37
  ...options
38
38
  }
39
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newlogic-digital/cookieconsent-js",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "author": "New Logic Studio s.r.o.",
@@ -15,6 +15,9 @@
15
15
  "files": [
16
16
  "index.js"
17
17
  ],
18
+ "exports": {
19
+ ".": "./index.js"
20
+ },
18
21
  "engines": {
19
22
  "node": "^18.0.0 || >=20.0.0"
20
23
  },