@modernpoacher/deps 2.1.13 → 2.1.15

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.
@@ -91,15 +91,25 @@ export function getArgs () {
91
91
  )
92
92
  }
93
93
 
94
+ function filter (v) {
95
+ const s = v.trim()
96
+
97
+ return Boolean(s)
98
+ }
99
+
94
100
  export function use (key) {
95
101
  const log = debug(`@modernpoacher/deps:${key}`)
96
102
 
97
- return function use (v) {
98
- if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).forEach((s) => { log(s) })
99
- else {
100
- const s = v.trim()
101
- if (s !== '') log(v.trimEnd())
102
- }
103
+ function write (v) {
104
+ const s = v.trimEnd()
105
+
106
+ if (s) log(s)
107
+ }
108
+
109
+ return function use (value) {
110
+ value.split(String.fromCharCode(10))
111
+ .filter(filter)
112
+ .forEach(write)
103
113
  }
104
114
  }
105
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/deps",
3
- "version": "2.1.13",
3
+ "version": "2.1.15",
4
4
  "description": "Update NPM package dependencies from the command line",
5
5
  "keywords": [
6
6
  "deps",
@@ -59,8 +59,10 @@ log(`\`git\` (${VERSION} - ${PLATFORM}) is awake`)
59
59
 
60
60
  const trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd()).join(String.fromCharCode(10)).trim()
61
61
 
62
- export function isFatal (s) {
63
- return s.toLowerCase().startsWith('fatal: not a git repository')
62
+ function filter (v) {
63
+ const s = v.trim()
64
+
65
+ return Boolean(s)
64
66
  }
65
67
 
66
68
  export function getIsDirectory (directory) {
@@ -69,15 +71,23 @@ export function getIsDirectory (directory) {
69
71
  }
70
72
  }
71
73
 
74
+ export function isFatal (s) {
75
+ return s.toLowerCase().startsWith('fatal: not a git repository')
76
+ }
77
+
72
78
  export function use (key) {
73
79
  const log = debug(`@modernpoacher/deps:${key}`)
74
80
 
75
- return function use (v) {
76
- if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).forEach((s) => { log(s) })
77
- else {
78
- const s = v.trim()
79
- if (s !== '') log(v.trimEnd())
80
- }
81
+ function write (v) {
82
+ const s = v.trimEnd()
83
+
84
+ if (s) log(s)
85
+ }
86
+
87
+ return function use (value) {
88
+ value.split(String.fromCharCode(10))
89
+ .filter(filter)
90
+ .forEach(write)
81
91
  }
82
92
  }
83
93
 
@@ -86,12 +96,24 @@ export function out (key, directory) {
86
96
 
87
97
  const isDirectory = getIsDirectory(directory)
88
98
 
89
- return function out (v) {
90
- if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).filter((s) => !isDirectory(s)).forEach((s) => { log(s) })
91
- else {
92
- const s = v.trim()
93
- if (s !== '' && !isDirectory(s)) log(v.trimEnd())
94
- }
99
+ function filterOut (v) {
100
+ const s = v.trim()
101
+
102
+ return (
103
+ !isDirectory(s)
104
+ )
105
+ }
106
+
107
+ function write (v) {
108
+ const s = v.trimEnd()
109
+
110
+ if (s) log(s)
111
+ }
112
+
113
+ return function out (value) {
114
+ value.split(String.fromCharCode(10))
115
+ .filter(filter).filter(filterOut)
116
+ .forEach(write)
95
117
  }
96
118
  }
97
119
 
@@ -100,12 +122,24 @@ export function err (key, directory) {
100
122
 
101
123
  const isDirectory = getIsDirectory(directory)
102
124
 
103
- return function err (v) {
104
- if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).filter((s) => !isDirectory(s)).filter((s) => !isFatal(s)).forEach((s) => { log(s) })
105
- else {
106
- const s = v.trim()
107
- if (s !== '' && !isDirectory(s) && !isFatal(s)) log(v.trimEnd())
108
- }
125
+ function filterErr (v) {
126
+ const s = v.trim()
127
+
128
+ return (
129
+ !isDirectory(s) && !isFatal(s)
130
+ )
131
+ }
132
+
133
+ function write (v) {
134
+ const s = v.trimEnd()
135
+
136
+ if (s) log(s)
137
+ }
138
+
139
+ return function err (value) {
140
+ value.split(String.fromCharCode(10))
141
+ .filter(filter).filter(filterErr)
142
+ .forEach(write)
109
143
  }
110
144
  }
111
145
 
package/src/index.mjs CHANGED
@@ -45,15 +45,25 @@ const log = debug('@modernpoacher/deps')
45
45
 
46
46
  log(`\`deps\` (${VERSION} - ${PLATFORM}) is awake`)
47
47
 
48
+ function filter (v) {
49
+ const s = v.trim()
50
+
51
+ return Boolean(s)
52
+ }
53
+
48
54
  export function use (key) {
49
55
  const log = debug(`@modernpoacher/deps:${key}`)
50
56
 
51
- return function use (v) {
52
- if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).forEach((s) => { log(s) })
53
- else {
54
- const s = v.trim()
55
- if (s !== '') log(v.trimEnd())
56
- }
57
+ function write (v) {
58
+ const s = v.trimEnd()
59
+
60
+ if (s) log(s)
61
+ }
62
+
63
+ return function use (value) {
64
+ value.split(String.fromCharCode(10))
65
+ .filter(filter)
66
+ .forEach(write)
57
67
  }
58
68
  }
59
69