semver-directory-lookup

1.0.0 • Public • Published

semver-directory-lookup

Function to lookup the highest available semver notated directory.

Build Status XO code style

const semverDirectoryLookup = require('semver-directory-lookup');
const directories = await semverDirectoryLookup('v1.0.0');

Install

$ npm i -S semver-directory-lookup

Purpose

To lookup in a provided path a directory based on semver and return the available paths that match the searched version.

Use-case

If you wanna retrieve a version based on a request string from a server and want to allow that on request of a major or minor only is possible.

example: the directory /1.31.1 and /1.31.2 are available.

  • lookup for v1.31.1 => will result in directory 1.31.1
  • lookup for v1.31 => will result in directory 1.31.2
  • lookup for v1 => will result in directory 1.31.2

API

semverDirectoryLookup(version[, path])

Parameter Type Description
version string A semantic versioning string. Cleaned (e.g. 1.0.0) or not ( e.g. v1.0.0) does not matter it will map to cleaned version
path string The path the lookup should take care in (default: process.cwd())

Contribute

  1. write code 🤓
  2. npm test
  3. update changelog under section unreleased
  4. if test and lint successful and changelog added -> file a PR

License

GPL-2.0 © Willi Eßer

Readme

Keywords

none

Package Sidebar

Install

npm i semver-directory-lookup

Weekly Downloads

2

Version

1.0.0

License

GPL-2.0

Last publish

Collaborators

  • troublete