Skip to content

Commit

Permalink
Merge pull request #4 from robbieferrero/feature/AddOptions
Browse files Browse the repository at this point in the history
Using Object.assign instead of spread operator for node < 6.x
  • Loading branch information
abhisheksoni27 authored Jan 11, 2018
2 parents 8b0af4b + 864d1c2 commit a4121fe
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
16 changes: 7 additions & 9 deletions code-snipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,16 @@ function generateHTML(sourceCode, options) {
*/

function codeSnipper(fileName, options = opts) {
options = {
...opts,
ext: checkFileExtension(fileName),
...options
};
options = Object.assign(
opts,
{ ext: checkFileExtension(fileName) },
options);

// Initialize webshot's configuration, setting resolution(zoomFactor) if passed.
let webshotConfig = {
let webshotConfig = Object.assign({
siteType: 'html',
zoomFactor: options.resolution || 2.5,
...options.webshotCustomConfig
};
zoomFactor: options.resolution || 2.5},
options.webshotCustomConfig || {});

const imagePath = path.join(process.cwd(), fileName);

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "code-snipper",
"version": "0.0.22",
"version": "0.0.23",
"description": "Export code snippets as PNG",
"main": "code-snipper.js",
"scripts": {
Expand All @@ -13,7 +13,6 @@
"gm": "^1.23.0",
"prettier": "^0.22.0",
"standard": "^10.0.2",
"taffydb": "^2.7.3",
"untildify": "^3.0.2",
"webshot": "^0.18.0",
"yargs": "^7.0.2"
Expand Down
21 changes: 16 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,10 @@ esprima@^3.1.1:
version "3.1.3"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"

esprima@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804"

esquery@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa"
Expand Down Expand Up @@ -1063,7 +1067,14 @@ js-tokens@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"

js-yaml@^3.2.7, js-yaml@^3.5.1:
js-yaml@^3.2.7:
version "3.10.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc"
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"

js-yaml@^3.5.1:
version "3.8.4"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6"
dependencies:
Expand Down Expand Up @@ -1779,10 +1790,6 @@ table@^3.7.8:
slice-ansi "0.0.4"
string-width "^2.0.0"

taffydb@^2.7.3:
version "2.7.3"
resolved "https://registry.yarnpkg.com/taffydb/-/taffydb-2.7.3.tgz#2ad37169629498fca5bc84243096d3cde0ec3a34"

tap-nyan@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/tap-nyan/-/tap-nyan-1.1.0.tgz#2b8d13a1f9ca51c1b3ada0c6ccdb1177d2065bb0"
Expand Down Expand Up @@ -1869,6 +1876,10 @@ uniq@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff"

untildify@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.2.tgz#7f1f302055b3fea0f3e81dc78eb36766cb65e3f1"

user-home@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f"
Expand Down

0 comments on commit a4121fe

Please sign in to comment.