Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JB1905 committed Jun 19, 2020
1 parent 8b921bf commit 3e74491
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 26 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# x-trim Changelog
# s-trimmer Changelog

## 1.0.0 (2020-06-19)

#### New Feature

- added `xTrim` function
- added `sTrimmer` function
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# x-trim
# s-trimmer

[![NPM version](http://img.shields.io/npm/v/x-trim.svg?style=flat-square)](https://www.npmjs.com/package/x-trim)
[![NPM downloads](http://img.shields.io/npm/dm/x-trim.svg?style=flat-square)](https://www.npmjs.com/package/x-trim)
[![NPM version](http://img.shields.io/npm/v/s-trimmer.svg?style=flat-square)](https://www.npmjs.com/package/s-trimmer)
[![NPM downloads](http://img.shields.io/npm/dm/s-trimmer.svg?style=flat-square)](https://www.npmjs.com/package/s-trimmer)

## About

Expand All @@ -12,35 +12,35 @@ Format spaces from the left and right end of a string and between strings
First, install the library in your project by npm:

```sh
$ npm install x-trim
$ npm install s-trimmer
```

Or Yarn:

```sh
$ yarn add x-trim
$ yarn add s-trimmer
```

## Getting Started

**Connect libary to project using ES6 import:**

```js
import xTrim from 'x-trim';
import sTrimmer from 's-trimmer';
```

**Or CommonJS:**

```js
const xTrim = require('x-trim');
const sTrimmer = require('s-trimmer');
```

Next use library:

```js
const value = 'lorem ipsum dolor ';

const formattedValue = xTrim(value); // 'lorem ipsum dolor'
const formattedValue = sTrimmer(value); // 'lorem ipsum dolor'
```

### Params
Expand Down
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "x-trim",
"name": "s-trimmer",
"version": "1.0.0",
"description": "Format spaces between class names",
"description": "Format spaces from the left and right end of a string and between strings",
"author": "Jakub Biesiada",
"license": "MIT",
"main": "lib/x-trim.cjs.js",
"module": "lib/x-trim.esm.js",
"main": "lib/s-trimmer.cjs.js",
"module": "lib/s-trimmer.esm.js",
"types": "lib/index.d.ts",
"scripts": {
"release": "rimraf lib/* && npm run prettier && npm run lint && npm run build",
Expand All @@ -18,19 +18,21 @@
},
"repository": {
"type": "git",
"url": "https://github.com/JB1905/x-trim.git"
"url": "https://github.com/JB1905/s-trimmer.git"
},
"keywords": [
"format",
"string",
"className",
"trim",
"spaces",
"trim"
"start",
"end",
"between",
"format"
],
"bugs": {
"url": "https://github.com/JB1905/x-trim/issues"
"url": "https://github.com/JB1905/s-trimmer/issues"
},
"homepage": "https://github.com/JB1905/x-trim#readme",
"homepage": "https://github.com/JB1905/s-trimmer#readme",
"devDependencies": {
"@rollup/plugin-node-resolve": "^8.0.1",
"@types/jest": "^26.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const xTrim = (value: string) => {
const sTrimmer = (value: string) => {
return value.trim().split(/\s+/).join(' ');
};

export default xTrim;
export default sTrimmer;
8 changes: 4 additions & 4 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import xTrim from '../src';
import sTrimmer from '../src';

describe('xTrim', () => {
it('should format spaces', () => {
describe('sTrimmer', () => {
it('should remove unneeded spaces', () => {
const input = 'lorem ipsum dolor ';

const value = xTrim(input);
const value = sTrimmer(input);

expect(value).toBe('lorem ipsum dolor');
});
Expand Down

0 comments on commit 3e74491

Please sign in to comment.