@modernpoacher/deps 2.2.16 → 2.2.17

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/deps",
3
- "version": "2.2.16",
3
+ "version": "2.2.17",
4
4
  "description": "Update NPM package dependencies from the command line",
5
5
  "keywords": [
6
6
  "deps",
@@ -305,21 +305,42 @@ export const isPreRelease = (v) => /-/.test(v)
305
305
  */
306
306
  export const isExact = (v) => /^\d/.test(v)
307
307
 
308
- function includeExact ([name, version]) {
308
+ /**
309
+ * @param {[name: string, version: string]} entry
310
+ * @returns {boolean}
311
+ */
312
+ function includeVersionIsExact ([name, version]) {
309
313
  return isExact(version)
310
314
  }
311
315
 
312
- function excludeExact ([name, version]) {
316
+ /**
317
+ * @param {[name: string, version: string]} entry
318
+ * @returns {boolean}
319
+ */
320
+ function excludeVersionIsExact ([name, version]) {
313
321
  return !isExact(version)
314
322
  }
315
323
 
316
- function getMapConfigurationDependencies (configurationDependencies) {
324
+ /**
325
+ * @param {Record<string, string>} configurationDependencies
326
+ * @returns {(entry: [name: string, version: string]) => {
327
+ * name: string,
328
+ * version: string
329
+ * }}
330
+ */
331
+ function getMapToDepsExactVersionFromConfiguration (configurationDependencies) {
317
332
  /**
318
333
  * We are producing an array of objects from the entries of the `packageDependencies`
319
334
  *
320
335
  * Each object in the array represents an entry (key and value) from `packageDependencies`
336
+ *
337
+ * @param {[name: string, version: string]} entry
338
+ * @returns {{
339
+ * name: string,
340
+ * version: string
341
+ * }}
321
342
  */
322
- return function mapConfigurationDependencies (entry) {
343
+ return function mapToDepsExactVersionFromConfiguration (entry) {
323
344
  const [
324
345
  name,
325
346
  version
@@ -336,7 +357,14 @@ function getMapConfigurationDependencies (configurationDependencies) {
336
357
  }
337
358
  }
338
359
 
339
- function mapPackageDependencies (entry) {
360
+ /**
361
+ * @param {[name: string, version: string]} entry
362
+ * @returns {{
363
+ * name: string,
364
+ * version: string
365
+ * }}
366
+ */
367
+ function mapToDepsVersion (entry) {
340
368
  const [
341
369
  name,
342
370
  version
@@ -369,8 +397,8 @@ export function getDepsExact (packageDependencies, configurationDependencies) {
369
397
 
370
398
  return (
371
399
  Object.entries(packageDependencies)
372
- .filter(includeExact)
373
- .map(getMapConfigurationDependencies(configurationDependencies))
400
+ .filter(includeVersionIsExact)
401
+ .map(getMapToDepsExactVersionFromConfiguration(configurationDependencies))
374
402
  )
375
403
  }
376
404
 
@@ -387,8 +415,8 @@ export function getDeps (packageDependencies) {
387
415
 
388
416
  return (
389
417
  Object.entries(packageDependencies)
390
- .filter(excludeExact)
391
- .map(mapPackageDependencies)
418
+ .filter(excludeVersionIsExact)
419
+ .map(mapToDepsVersion)
392
420
  )
393
421
  }
394
422