1.1.1 • Published 5 years ago
case_converter_fcc_sample v1.1.1
Case Converter FCC
This is a prototype of fcc curriculum project to teach how to build, use and publish npm module. This module itself provide methods to covert string to specify case.
Install
npm install case_converter_fcc_sample
Usage
const caseConverter = require('./index');
const str = 'hello free Code Camp!';
console.log(caseConverter.getUpperCase(str)); // HELLO FREE CODE CAMP!
console.log(caseConverter.getLowerCase(str)); // hello free code camp!
console.log(caseConverter.getProperCase(str)); // Hello Free Code Camp!
console.log(caseConverter.getSentenceCase(str)) // Hello free code camp!
License
The MIT License
How to build npm module
Create your module (package)
- Create a directory for your module.
- In package root directroy, run
npm init
, and follow the instruction to generatepackage.json
. - Creat a
README.md
file to explain your package. - Write your code and export the methods you want user to call.
Add Github Respository (Optional)
- You can add your github respository into
package.json
. The url should be a publicly available url that can be handed directly to a VCS program without any modification.
"repository": {
"type" : "git",
"url" : "https://github.com/<user_name>/<repo_name>.git"
}
// or you can use shortcut
"repository": "github:user/repo"
- You can also set the repository page as your module's homepage.
"homepage": "https://github.com/<user_name>/<repo_name>#readme"
Publish
- Sign up on npm.
- run
npm login
ornpm adduser
, follow instruction. - run
npm publish
to publish your module to npm. - go to npm to check your published package!
Usage
- run
npm install module_name
to download and install the package. - Whenever your need to use the module use
require
to import the module.
Update
- Run
npm version <update_type>
to change the version. see more - Run
npm publish
. - Go to your package page to check the update.