1.0.19 • Published 3 months ago

@ocampoce/capitalize v1.0.19

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

@ocampoce/capitalize npm package

A couple of helper functions in vanilla JavaScript.

capitalize(string) capitalizes the first letter in a string and leaves rest of the letters unchanged.

capitalizeAll(string) capitalizes the first letter of every word in a string and leaves rest of the letters in each word unchanged.

Usage

import { capitalize } from '@ocampoce/capitalize';

capitalize("hello world"); // Hello world

capitalizeAll("hello world") // Hello World

Steps to creating and publishing an npm package

Step 1 - Initialize npm package

npm init

// (Optional) - scope or namespace the package

npm init --scope=namespace-goes-here
  • Example: npm init --scope=ocampoce

Step 2 - Create your package

After initializing, write some code to create your package, then push it to a remote repo like GitHub.

Step 3 - Testing the package

Test you package using npmjs's npm link feature.

In the package repo:

npm link

In the test repo:

npm link package-name
  • Example (non-scoped): npm link capitalize

  • Example (scoped): npm link @ocampoce/capitalize

Test the package by importing it and using the package as intended. If everything works, you can now publish your package!

Step 4 - Publishing the package

Login to npm to publish public package (must create an npmjs.com account)

npm login

Publish a package two ways:

  • Publish package (non-scoped)

      npm publish
  • Publish a public "scoped" or "namespaced" package

      npm publish --access=public

Note: you may need to add "type": "module" in your package's package.json file if it is not already there. Without this, you may get this error when attempting to publish.

Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.

Misc (Docs to add SSH Keys to GitHub)

You may need to add an SSH key to GitHub if you would like to access it via SSH instead of https.

Here are some GitHub links that guide through SSH set up and adding it to GitHub and your local machine.

adding-a-new-ssh-key-to-your-github-account

generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

1.0.19

3 months ago

1.0.18

3 months ago

1.0.17

3 months ago

1.0.16

3 months ago

1.0.15

3 months ago

1.0.12

3 months ago

1.0.11

3 months ago

1.0.10

3 months ago

1.0.9

3 months ago

1.0.8

3 months ago

1.0.7

3 months ago

1.0.4

3 months ago

1.0.3

3 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago