diff options
Diffstat (limited to 'node_modules/dedent')
| -rw-r--r-- | node_modules/dedent/LICENSE | 21 | ||||
| -rw-r--r-- | node_modules/dedent/README.md | 59 | ||||
| -rw-r--r-- | node_modules/dedent/dist/dedent.js | 59 | ||||
| -rw-r--r-- | node_modules/dedent/package.json | 43 | 
4 files changed, 182 insertions, 0 deletions
diff --git a/node_modules/dedent/LICENSE b/node_modules/dedent/LICENSE new file mode 100644 index 0000000..603995b --- /dev/null +++ b/node_modules/dedent/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Desmond Brand (dmnd@desmondbrand.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: + +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. diff --git a/node_modules/dedent/README.md b/node_modules/dedent/README.md new file mode 100644 index 0000000..af51323 --- /dev/null +++ b/node_modules/dedent/README.md @@ -0,0 +1,59 @@ +# Dedent + +An ES6 string tag that strips indentation from multi-line strings. + +## Usage + +```js +import dedent from "dedent"; + +function usageExample() { +  const first = dedent`A string that gets so long you need to break it over +                       multiple lines. Luckily dedent is here to keep it +                       readable without lots of spaces ending up in the string +                       itself.`; + +  const second = dedent` +    Leading and trailing lines will be trimmed, so you can write something like +    this and have it work as you expect: + +      * how convenient it is +      * that I can use an indented list +         - and still have it do the right thing + +    That's all. +  `; + +  const third = dedent(` +    Wait! I lied. Dedent can also be used as a function. +  `); + +  return first + "\n\n" + second + "\n\n" + third; +} +``` + +```js +> console.log(usageExample()); +``` + +``` +A string that gets so long you need to break it over +multiple lines. Luckily dedent is here to keep it +readable without lots of spaces ending up in the string +itself. + +Leading and trailing lines will be trimmed, so you can write something like +this and have it work as you expect: + +  * how convenient it is +  * that I can use an indented list +    - and still have it do the right thing + +That's all. + +Wait! I lied. Dedent can also be used as a function. +``` + +## License + +MIT diff --git a/node_modules/dedent/dist/dedent.js b/node_modules/dedent/dist/dedent.js new file mode 100644 index 0000000..8979b57 --- /dev/null +++ b/node_modules/dedent/dist/dedent.js @@ -0,0 +1,59 @@ +"use strict"; + +function dedent(strings) { + +  var raw = void 0; +  if (typeof strings === "string") { +    // dedent can be used as a plain function +    raw = [strings]; +  } else { +    raw = strings.raw; +  } + +  // first, perform interpolation +  var result = ""; +  for (var i = 0; i < raw.length; i++) { +    result += raw[i]. +    // join lines when there is a suppressed newline +    replace(/\\\n[ \t]*/g, ""). + +    // handle escaped backticks +    replace(/\\`/g, "`"); + +    if (i < (arguments.length <= 1 ? 0 : arguments.length - 1)) { +      result += arguments.length <= i + 1 ? undefined : arguments[i + 1]; +    } +  } + +  // now strip indentation +  var lines = result.split("\n"); +  var mindent = null; +  lines.forEach(function (l) { +    var m = l.match(/^(\s+)\S+/); +    if (m) { +      var indent = m[1].length; +      if (!mindent) { +        // this is the first indented line +        mindent = indent; +      } else { +        mindent = Math.min(mindent, indent); +      } +    } +  }); + +  if (mindent !== null) { +    result = lines.map(function (l) { +      return l[0] === " " ? l.slice(mindent) : l; +    }).join("\n"); +  } + +  // dedent eats leading and trailing whitespace too +  result = result.trim(); + +  // handle escaped newlines at the end to ensure they don't get stripped too +  return result.replace(/\\n/g, "\n"); +} + +if (typeof module !== "undefined") { +  module.exports = dedent; +} diff --git a/node_modules/dedent/package.json b/node_modules/dedent/package.json new file mode 100644 index 0000000..330c43a --- /dev/null +++ b/node_modules/dedent/package.json @@ -0,0 +1,43 @@ +{ +  "name": "dedent", +  "version": "0.7.0", +  "description": "An ES6 string tag that strips indentation from multi-line strings", +  "main": "dist/dedent.js", +  "files": [ +    "dist/dedent.js", +    "LICENSE" +  ], +  "repository": { +    "type": "git", +    "url": "git://github.com/dmnd/dedent.git" +  }, +  "keywords": [ +    "dedent", +    "tag", +    "multi-line string", +    "es6" +  ], +  "author": { +    "name": "Desmond Brand", +    "email": "dmnd@desmondbrand.com", +    "url": "http://desmondbrand.com" +  }, +  "license": "MIT", +  "bugs": { +    "url": "https://github.com/dmnd/dedent/issues" +  }, +  "homepage": "https://github.com/dmnd/dedent", +  "devDependencies": { +    "babel-cli": "^6.22.2", +    "babel-preset-es2015": "^6.22.0", +    "babel-preset-es2016": "^6.22.0", +    "babel-preset-es2017": "^6.22.0", +    "eslint": "^3.14.1", +    "jest": "^18.1.0" +  }, +  "scripts": { +    "build": "babel dedent.js --out-file dist/dedent.js", +    "lint": "eslint dedent.js __tests__", +    "test": "jest" +  } +}  | 
