From 5f466137ad6ac596600e3ff53c9b786815398445 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sat, 27 May 2017 17:36:13 +0200 Subject: node_modules, clean up package.json --- node_modules/indent-string/index.js | 21 +++++++++++-------- node_modules/indent-string/package.json | 12 +++++------ node_modules/indent-string/readme.md | 37 ++++++++++++++++++--------------- 3 files changed, 37 insertions(+), 33 deletions(-) (limited to 'node_modules/indent-string') diff --git a/node_modules/indent-string/index.js b/node_modules/indent-string/index.js index 4a21687b2..b6ab264ae 100644 --- a/node_modules/indent-string/index.js +++ b/node_modules/indent-string/index.js @@ -1,20 +1,23 @@ 'use strict'; -var repeating = require('repeating'); +module.exports = (str, count, indent) => { + indent = indent === undefined ? ' ' : indent; + count = count === undefined ? 1 : count; -module.exports = function (str, indent, count) { - if (typeof str !== 'string' || typeof indent !== 'string') { - throw new TypeError('`string` and `indent` should be strings'); + if (typeof str !== 'string') { + throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof str}\``); } - if (count != null && typeof count !== 'number') { - throw new TypeError('`count` should be a number'); + if (typeof count !== 'number') { + throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof count}\``); + } + + if (typeof indent !== 'string') { + throw new TypeError(`Expected \`indent\` to be a \`string\`, got \`${typeof indent}\``); } if (count === 0) { return str; } - indent = count > 1 ? repeating(indent, count) : indent; - - return str.replace(/^(?!\s*$)/mg, indent); + return str.replace(/^(?!\s*$)/mg, indent.repeat(count)); }; diff --git a/node_modules/indent-string/package.json b/node_modules/indent-string/package.json index 0e7d28cb2..d63feaa3a 100644 --- a/node_modules/indent-string/package.json +++ b/node_modules/indent-string/package.json @@ -1,6 +1,6 @@ { "name": "indent-string", - "version": "2.1.0", + "version": "3.1.0", "description": "Indent each line in a string", "license": "MIT", "repository": "sindresorhus/indent-string", @@ -10,10 +10,10 @@ "url": "sindresorhus.com" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "scripts": { - "test": "mocha" + "test": "xo && ava" }, "files": [ "index.js" @@ -27,10 +27,8 @@ "line", "text" ], - "dependencies": { - "repeating": "^2.0.0" - }, "devDependencies": { - "mocha": "*" + "ava": "*", + "xo": "*" } } diff --git a/node_modules/indent-string/readme.md b/node_modules/indent-string/readme.md index 89f14acd4..bc4745600 100644 --- a/node_modules/indent-string/readme.md +++ b/node_modules/indent-string/readme.md @@ -13,39 +13,42 @@ $ npm install --save indent-string ## Usage ```js -var indentString = require('indent-string'); +const indentString = require('indent-string'); -indentString('Unicorns\nRainbows', '♥', 4); -//=> ♥♥♥♥Unicorns -//=> ♥♥♥♥Rainbows +indentString('Unicorns\nRainbows', 4); +//=> ' Unicorns' +//=> ' Rainbows' + +indentString('Unicorns\nRainbows', 4, '♥'); +//=> '♥♥♥♥Unicorns' +//=> '♥♥♥♥Rainbows' ``` ## API -### indentString(string, indent, count) - -#### string - -**Required** -Type: `string` - -The string you want to indent. +### indentString(input, [count], [indent]) -#### indent +#### input -**Required** Type: `string` -The string to use for the indent. +String you want to indent. #### count -Type: `number` +Type: `number`
Default: `1` How many times you want `indent` repeated. +#### indent + +Type: `string`
+Default: `' '` + +String to use for the indent. + ## Related @@ -55,4 +58,4 @@ How many times you want `indent` repeated. ## License -MIT © [Sindre Sorhus](http://sindresorhus.com) +MIT © [Sindre Sorhus](https://sindresorhus.com) -- cgit v1.2.3