@symbo.ls/utils 2.11.16 → 2.11.74

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/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@symbo.ls/utils",
3
- "version": "2.11.16",
3
+ "version": "2.11.74",
4
4
  "main": "src/index.js",
5
5
  "author": "symbo.ls",
6
6
  "license": "ISC",
7
7
  "dependencies": {
8
8
  "@domql/utils": "latest"
9
9
  },
10
- "gitHead": "9d17c62d340b3ed3ecfba460d9f5656b324a5bbb"
10
+ "gitHead": "e5b1525de823174b2978cb9cda682b31f5cf87e8"
11
11
  }
package/src/index.js CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  import { isString, isObject, isArray } from '@domql/utils'
4
4
 
5
- export * from './navigation'
6
5
  export * from './scaling'
7
- export * from './codify'
8
6
  export * from './date'
9
7
 
10
8
  export const copyStringToClipboard = str => {
package/src/navigation.js DELETED
@@ -1,66 +0,0 @@
1
- 'use strict'
2
-
3
- export const filterHrefs = (sitemap) => {
4
- return Object.values(sitemap)
5
- .map(({ href, sub_links }) => // eslint-disable-line
6
- [href, sub_links.map(({ href }) => href) // eslint-disable-line
7
- .filter(v => v.indexOf('#') === -1)]
8
- .filter(v => v.length > 0)
9
- )
10
- }
11
-
12
- export const findCurrentIndex = (sitemap) => { // eslint-disable-line
13
- const { pathname } = window.location
14
- const hrefArray = filterHrefs(sitemap)
15
- let index
16
-
17
- hrefArray.forEach((v, k) => {
18
- if (v[0] === pathname) index = k
19
- if (v[1] && v[1].indexOf(pathname) > -1) {
20
- const i = v[1].indexOf(pathname)
21
- index = `${k}.${i}`
22
- }
23
- })
24
-
25
- return { active: index }
26
- }
27
-
28
- /** Parses sitemap and detects current, active, and previous pages from current url path */
29
- export const setPaginationNames = (sitemap) => {
30
- const { pathname } = window.location
31
- const hrefArray = filterHrefs(sitemap)
32
- const state = {}
33
-
34
- hrefArray.forEach((v, k) => {
35
- const categoryRoute = v[0]
36
- const subcategoryRoutes = v[1]
37
- const previousCat = sitemap[k - 1]
38
- const activeCat = sitemap[k]
39
- const nextCat = sitemap[k + 1]
40
-
41
- const isRootCategory = categoryRoute === pathname
42
- const isSubcategory = subcategoryRoutes && subcategoryRoutes.indexOf(pathname) > -1
43
-
44
- if (isRootCategory) {
45
- const previousSubcat = hrefArray[k - 1] && hrefArray[k - 1][1] && previousCat.sub_links[previousCat.sub_links.length - 1]
46
- const nextSubcat = subcategoryRoutes && activeCat.sub_links[0]
47
-
48
- state.previous = previousSubcat || previousCat
49
- state.active = activeCat
50
- state.next = nextSubcat || nextCat
51
- state.moveOn = nextSubcat && nextCat
52
- } else if (isSubcategory) {
53
- const i = subcategoryRoutes.indexOf(pathname)
54
- const activeSubcat = activeCat.sub_links[i]
55
- const previousSubcat = subcategoryRoutes[i - 1] && activeCat.sub_links[i - 1]
56
- const nextSubcat = subcategoryRoutes[i + 1] && activeCat.sub_links[i + 1]
57
-
58
- state.previous = previousSubcat || activeCat
59
- state.active = activeSubcat
60
- state.next = nextSubcat || nextCat
61
- state.moveOn = nextSubcat && nextCat
62
- }
63
- })
64
-
65
- return state
66
- }