Skip to content

Commit

Permalink
Require Node.js 6
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 23, 2018
1 parent 10bb94c commit 76c994a
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 90 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[package.json]
[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text=auto
*.js text eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
yarn.lock
13 changes: 0 additions & 13 deletions .jshintrc

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
sudo: false
language: node_js
node_js:
- 'iojs'
- '0.12'
- '0.10'
- '8'
- '6'
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict';
var decamelize = require('decamelize');
const decamelize = require('decamelize');

module.exports = function (str) {
if (typeof str !== 'string') {
module.exports = input => {
if (typeof input !== 'string') {
throw new TypeError('Expected a string');
}

str = decamelize(str);
str = str.toLowerCase().replace(/[_-]+/g, ' ').replace(/\s{2,}/g, ' ').trim();
str = str.charAt(0).toUpperCase() + str.slice(1);
input = decamelize(input);
input = input.toLowerCase().replace(/[_-]+/g, ' ').replace(/\s{2,}/g, ' ').trim();
input = input.charAt(0).toUpperCase() + input.slice(1);

return str;
return input;
};
20 changes: 4 additions & 16 deletions license
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
82 changes: 41 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"name": "humanize-string",
"version": "1.0.2",
"description": "Converts a camelized/dasherized/underscored string into a humanized one: fooBar-Baz_Faz → Foo bar baz faz",
"license": "MIT",
"repository": "sindresorhus/humanize-string",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "ava"
},
"files": [
"index.js"
],
"keywords": [
"humanize",
"human",
"pretty",
"capitalize",
"uppercase",
"case",
"camelcase",
"dash",
"hyphen",
"underscore",
"string",
"str",
"text",
"convert"
],
"dependencies": {
"decamelize": "^1.0.0"
},
"devDependencies": {
"ava": "*"
}
"name": "humanize-string",
"version": "1.0.2",
"description": "Convert a camelized/dasherized/underscored string into a humanized one: `fooBar-Baz_Faz``Foo bar baz faz`",
"license": "MIT",
"repository": "sindresorhus/humanize-string",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"humanize",
"human",
"pretty",
"capitalize",
"uppercase",
"case",
"camelcase",
"dash",
"hyphen",
"underscore",
"string",
"text",
"convert"
],
"dependencies": {
"decamelize": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
}
11 changes: 8 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# humanize-string [![Build Status](https://travis-ci.org/sindresorhus/humanize-string.svg?branch=master)](https://travis-ci.org/sindresorhus/humanize-string)

> Converts a camelized/dasherized/underscored string into a humanized one
> Convert a camelized/dasherized/underscored string into a humanized one
> Example: `fooBar-Baz_Faz``Foo bar baz faz`

## Install

```
$ npm install --save humanize-string
$ npm install humanize-string
```


Expand All @@ -27,6 +27,11 @@ humanizeString('foo_bar');
```


## Related

- [camelcase](https://github.com/sindresorhus/camelcase) - Convert a dash/dot/underscore/space separated string to camelcase


## License

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava';
import m from './';
import m from '.';

test(t => {
test('main', t => {
t.is(m(''), '');
t.is(m('unicorns and rainbows'), 'Unicorns and rainbows');
t.is(m('unicorns-and-rainbows'), 'Unicorns and rainbows');
Expand Down

0 comments on commit 76c994a

Please sign in to comment.