What is the difference between ~0.0.1 and ^0.0.1 in package versioning of type package.json?

This code is an example:

{
    "dependencies": {
        "gulp": "~0.0.1",
        "browser-sync": "^0.0.1"
    }
}
Author: Ivan Ferrer, 2017-02-10

2 answers

In a simplified way TIL ( ~ ) accepts only the latest minor version (the middle number). ~1.2.3 will accept all versions 1.2.X but will reject 1.3.0.

The circumflex ( ^ ) accepts the latest Major Version (first number) . ^1.2.3 will accept any release 1.X. X including 1.3.0, but will reject 2.0.0.

Source and link of the Stack in English

 6
Author: Thiago Santos, 2017-05-23 12:37:28

Briefly using til ( ~ ) offers bugfix fixes and circumflex (^) offers new backward-compatible functionality.

See this image that is in Semantic Versioning Cheatsheet:

insert the description of the image here

See a demo in the Table:

insert the description of the image here

Reference

 7
Author: viana, 2017-02-10 17:44:45