Skip to content

aleclarson/assertValidVersion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

assertValidVersion 1.0.0 experimental

Validate an entry in the "dependencies" object inside any package.json!

assertValidVersion = require "assertValidVersion"

promise = assertValidVersion moduleName, versionString

"Does an NPM package have a specific version?"

assertValidVersion "underscore", "1.8.3"

.then ->
  # The version is valid!
  # Since `npm view underscore` includes
  # '1.0.1' in the list of NPM versions.

.fail (error) ->
  # An error is thrown if:
  #   • the NPM package does not exist
  #   • the given version does not exist
  #   • the given version is not properly formatted
  • Supports version ranges! (eg: >=1.0.0)

"Does a Github repository have a specific tag?"

assertValidVersion "Type", "aleclarson/Type#1.0.0"

.then ->
  # The version is valid!
  # Since 'github.com/aleclarson/Type/tags' includes
  # '1.0.0' in the list of remote tags.

.fail (error) ->
  # An error is thrown if:
  #   • the Github repository does not exist
  #   • the given tag is not included in the list of remote tags
  #   • the given version is not properly formatted

About

Check if a dependency has a valid version

Resources

License

Stars

Watchers

Forks

Packages

No packages published