Skip to content

Commit

Permalink
docs: add usage examples
Browse files Browse the repository at this point in the history
Bunch of clean up and some fixes. Expanded the README to include usage
examples.
  • Loading branch information
joshtronic committed Jan 17, 2020
1 parent 1e7a585 commit c6e7bab
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 8 deletions.
203 changes: 201 additions & 2 deletions README.md
@@ -1,13 +1,212 @@
# luthier

**noun** (*lu·thi·er*)

> one who makes stringed musical instruments (such as violins or guitars)
`luthier` handles all of your stringed needs.
`luthier` handles all of your `string` needs. 🎸

[![License](https://img.shields.io/npm/l/luthier?style=for-the-badge)](https://github.com/joshtronic/luthier/blob/master/LICENSE)
![Node Version](https://img.shields.io/node/v/luthier?style=for-the-badge)
![Build Status](https://img.shields.io/travis/joshtronic/luthier/master?style=for-the-badge)
[![Coverage Status](https://img.shields.io/coveralls/github/joshtronic/luthier/master?style=for-the-badge)](https://coveralls.io/github/joshtronic/luthier?branch=master)

## Installation

```shell
npm install --save luthier
npm install luthier --save
# or
yarn add luthier
```

## Usage

```javascript
import { luthier } from 'luthier';
```

### Functions

* [`camelCase`](#camelCase)
* [`constantCase`](#constantCase)
* [`countLines`](#countLines)
* [`countWords`](#countWords)
* [`dotCase`](#dotCase)
* [`flip`](#flip)
* [`initials`](#initial)
* [`kebabCase`](#kebabCase)
* [`lowerCaseFirst`](#lowerCaseFirst)
* [`lowerCaseWords`](#lowerCaseWords)
* [`numeronym`](#numeronym)
* [`pascalCase`](#pascalCase)
* [`random`](#random)
* [`reverse`](#reverse)
* [`rot13`](#rot13)
* [`shuffle`](#shuffle)
* [`snakeCase`](#snakeCase)
* [`startCase`](#startCase)
* [`stripTags`](#stripTags)
* [`studlyCaps`](#studlyCaps)
* [`upperCaseFirst`](#upperCaseFirst)
* [`upperCaseWords`](#upperCaseWords)

#### `camelCase`

```javascript
luthier.camelCase('your string');
// 'yourString'
```

#### `constantCase`

```javascript
luthier.constantCase('your string');
// 'YOUR_STRING'
```

#### `countLines`

```javascript
luthier.countLines('your\nstring');
// 2
```

#### `countWords`

```javascript
luthier.countWords('your string');
// 2
```

#### `dotCase`

```javascript
luthier.dotCase('your string');
// 'your.string'
```

#### `flip`

```javascript
luthier.flip('your string');
// 'ɓuᴉɹʇs ɹnoʎ'
```

#### `initials`

```javascript
luthier.initials('your string');
// 'YG'
```

#### `kebabCase`

```javascript
luthier.kebabCase('your string');
// 'your-string'
```

#### `lowerCaseFirst`

```javascript
luthier.lowerCaseFirst('Your string');
// 'your string'
```

#### `lowerCaseWords`

```javascript
luthier.lowerCaseWords('Your String');
// 'your string'
```

#### `numeronym`

```javascript
luthier.numeronym('your string');
// 'y8g'
```

#### `pascalCase`

```javascript
luthier.pascalCase('your string');
// 'YourString'
```

#### `random`

```javascript
luthier.random(10);
// 'psifnwkflr'
```

#### `reverse`

```javascript
luthier.pascalCase('your string');
// 'gnirts ruoy'
```

#### `rot13`

```javascript
luthier.pascalCase('your string');
// 'lbhe fgevat'
```

#### `shuffle`

```javascript
luthier.pascalCase('your string');
// 'nru grsioty'
```

#### `snakeCase`

```javascript
luthier.snakeCase('your string');
// 'your_string'
```

#### `startCase`

```javascript
luthier.startCase('your string');
// 'Your String'
```

#### `stripTags`

```javascript
luthier.stripTags('<em>your string</em>');
// 'your string'
```

#### `studlyCaps`

```javascript
luthier.studlyCaps('your string');
// 'YoUr StRiNg'
```

#### `upperCaseFirst`

```javascript
luthier.upperCaseFirst('your string');
// 'Your string'
```

#### `upperCaseWords`

```javascript
luthier.upperCaseWords('your string');
// 'Your String'
```

Unlike `startCase`, the `upperCaseWords` method does not apply
`String.prototype.toLowerCase()` first.

## License

MIT
8 changes: 3 additions & 5 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "luthier",
"version": "0.1.0",
"description": "Luthier handles all of your stringed needs.",
"version": "0.2.0",
"description": "Luthier handles all of your string needs.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": {
Expand Down Expand Up @@ -33,8 +33,6 @@
},
"scripts": {
"build": "tsc",
"publish": "tsc && npm publish",
"test": "jest",
"test:coverage": "jest --coverage --coverageReporters=text-lcov | coveralls"
"test": "jest --coverage --coverageReporters=text-lcov | coveralls"
}
}
4 changes: 3 additions & 1 deletion tests/index.test.ts
Expand Up @@ -167,7 +167,9 @@ describe('snakeCase', () => {

describe('startCase', () => {
it('should capitalize every word', () => {
expect(luthier.shuffle('test TEST test')).not.toBe('Test Test Test');
expect(luthier.startCase('TESTING')).toBe('Testing');
expect(luthier.startCase('testing Testing')).toBe('Testing Testing');
expect(luthier.startCase('- TESTING - testing -')).toBe('- Testing - Testing -');
});
});

Expand Down

0 comments on commit c6e7bab

Please sign in to comment.