Skip to content

Commit a4121fe

Browse files
Merge pull request #4 from robbieferrero/feature/AddOptions
Using Object.assign instead of spread operator for node < 6.x
2 parents 8b0af4b + 864d1c2 commit a4121fe

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

code-snipper.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,16 @@ function generateHTML(sourceCode, options) {
146146
*/
147147

148148
function codeSnipper(fileName, options = opts) {
149-
options = {
150-
...opts,
151-
ext: checkFileExtension(fileName),
152-
...options
153-
};
149+
options = Object.assign(
150+
opts,
151+
{ ext: checkFileExtension(fileName) },
152+
options);
154153

155154
// Initialize webshot's configuration, setting resolution(zoomFactor) if passed.
156-
let webshotConfig = {
155+
let webshotConfig = Object.assign({
157156
siteType: 'html',
158-
zoomFactor: options.resolution || 2.5,
159-
...options.webshotCustomConfig
160-
};
157+
zoomFactor: options.resolution || 2.5},
158+
options.webshotCustomConfig || {});
161159

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

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "code-snipper",
3-
"version": "0.0.22",
3+
"version": "0.0.23",
44
"description": "Export code snippets as PNG",
55
"main": "code-snipper.js",
66
"scripts": {
@@ -13,7 +13,6 @@
1313
"gm": "^1.23.0",
1414
"prettier": "^0.22.0",
1515
"standard": "^10.0.2",
16-
"taffydb": "^2.7.3",
1716
"untildify": "^3.0.2",
1817
"webshot": "^0.18.0",
1918
"yargs": "^7.0.2"

yarn.lock

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,10 @@ esprima@^3.1.1:
607607
version "3.1.3"
608608
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
609609

610+
esprima@^4.0.0:
611+
version "4.0.0"
612+
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804"
613+
610614
esquery@^1.0.0:
611615
version "1.0.0"
612616
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa"
@@ -1063,7 +1067,14 @@ js-tokens@^3.0.0:
10631067
version "3.0.2"
10641068
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
10651069

1066-
js-yaml@^3.2.7, js-yaml@^3.5.1:
1070+
js-yaml@^3.2.7:
1071+
version "3.10.0"
1072+
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc"
1073+
dependencies:
1074+
argparse "^1.0.7"
1075+
esprima "^4.0.0"
1076+
1077+
js-yaml@^3.5.1:
10671078
version "3.8.4"
10681079
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6"
10691080
dependencies:
@@ -1779,10 +1790,6 @@ table@^3.7.8:
17791790
slice-ansi "0.0.4"
17801791
string-width "^2.0.0"
17811792

1782-
taffydb@^2.7.3:
1783-
version "2.7.3"
1784-
resolved "https://registry.yarnpkg.com/taffydb/-/taffydb-2.7.3.tgz#2ad37169629498fca5bc84243096d3cde0ec3a34"
1785-
17861793
tap-nyan@^1.1.0:
17871794
version "1.1.0"
17881795
resolved "https://registry.yarnpkg.com/tap-nyan/-/tap-nyan-1.1.0.tgz#2b8d13a1f9ca51c1b3ada0c6ccdb1177d2065bb0"
@@ -1869,6 +1876,10 @@ uniq@^1.0.1:
18691876
version "1.0.1"
18701877
resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff"
18711878

1879+
untildify@^3.0.2:
1880+
version "3.0.2"
1881+
resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.2.tgz#7f1f302055b3fea0f3e81dc78eb36766cb65e3f1"
1882+
18721883
user-home@^2.0.0:
18731884
version "2.0.0"
18741885
resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f"

0 commit comments

Comments
 (0)