From 2fd1517b046a262919b2e3f7ffa65a7717628709 Mon Sep 17 00:00:00 2001 From: Andrew Harris Date: Mon, 25 May 2020 12:35:38 +1000 Subject: [PATCH] template --- .editorconfig | 12 ++++++++++ .gitattributes | 1 + .gitignore | 6 +++++ .npmrc | 1 + .prettierrc | 5 +++++ .travis.yml | 12 ++++++++++ LICENSE | 30 +++++++++++++++++++++++++ README.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ index.js | 7 ++++++ package.json | 32 +++++++++++++++++++++++++++ src/index.js | 7 ++++++ test/index.js | 3 +++ 12 files changed, 175 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 .prettierrc create mode 100644 .travis.yml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 index.js create mode 100644 package.json create mode 100644 src/index.js create mode 100644 test/index.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fac40a5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..74762c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.swp +.DS_Store +node_modules/ +coverage/ +.nyc_output/ +.env diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0beac85 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "semi": false, + "singleQuote": true, + "bracketSpacing": true +} diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6795f16 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: node_js +node_js: + - 12 + - 14 +before_script: + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + - chmod +x ./cc-test-reporter + - ./cc-test-reporter before-build +script: npm run coverage +after_script: + - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT +cache: npm diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..524cbe7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,30 @@ +The BSD License + +Copyright (c) 2020, Andrew Harris + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +* Neither the name of the Andrew Harris nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..60d17d7 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# get-media-dimensions + +> get video or image dimensions + +## Installation + +This module is installed via npm: + +``` bash +$ npm install get-media-dimensions +``` + +## Usage + +```js +// Several examples of usage. +// Usually copying and pasting code from the tests and making the code standalone suffices. +// PLEASE_FILL_IN_HERE +``` + +## API + +PLEASE_FILL_IN_HERE + +Note: To regenerate this section from the jsdoc run `npm run docs` and paste +the output above. + +## License + +The BSD License + +Copyright (c) 2020, Andrew Harris + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +* Neither the name of the Andrew Harris nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/index.js b/index.js new file mode 100644 index 0000000..a693a60 --- /dev/null +++ b/index.js @@ -0,0 +1,7 @@ +module.exports = function (input, options = {}) { + if (typeof input !== 'string') { + throw new TypeError('Expected input to be string'); + } + + return `${input} & ${options.postfix || 'rainbow'}`; +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..f56b281 --- /dev/null +++ b/package.json @@ -0,0 +1,32 @@ +{ + "name": "get-media-dimensions", + "version": "0.0.0", + "description": "get video or image dimensions", + "main": "src/index.js", + "files": [ + "src" + ], + "scripts": { + "coverage": "nyc -a -c -r text -r lcov npm test", + "test": "npm run lint && mocha --recursive test", + "lint": "semistandard" + }, + "repository": { + "url": "aeh/get-media-dimensions", + "type": "git" + }, + "author": "aeh", + "license": "MIT", + "dependencies": {}, + "devDependencies": { + "chai": "^4.2.0", + "semistandard": "^14.0.0", + "mocha": "^7.0.0", + "nyc": "^15.0.0" + }, + "semistandard": { + "env": [ + "mocha" + ] + } +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..c40cb41 --- /dev/null +++ b/src/index.js @@ -0,0 +1,7 @@ +export default function (input, options = {}) { + if (typeof input !== 'string') { + throw new Error('Expected input to be string'); + } + + return `${input} & ${options.postfix || 'rainbow'}`; +} diff --git a/test/index.js b/test/index.js new file mode 100644 index 0000000..dbde83e --- /dev/null +++ b/test/index.js @@ -0,0 +1,3 @@ +describe('my module', function () { + it('does things', function () {}); +});