diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 00000000..ff9286de
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,6 @@
+{
+ "name": "cd12099-Full-Stack-Apps-AWS",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {}
+}
diff --git a/project starter code/.gitignore b/project starter code/.gitignore
new file mode 100644
index 00000000..bca646a7
--- /dev/null
+++ b/project starter code/.gitignore
@@ -0,0 +1,5 @@
+
+# Elastic Beanstalk Files
+.elasticbeanstalk/*
+!.elasticbeanstalk/*.cfg.yml
+!.elasticbeanstalk/*.global.yml
diff --git a/project starter code/aws-elastic-beanstalk-cli-setup b/project starter code/aws-elastic-beanstalk-cli-setup
new file mode 160000
index 00000000..e30f3630
--- /dev/null
+++ b/project starter code/aws-elastic-beanstalk-cli-setup
@@ -0,0 +1 @@
+Subproject commit e30f36303e22a868cf512eca246a0d001af9a19e
diff --git a/project starter code/node_modules/.bin/mkdirp b/project starter code/node_modules/.bin/mkdirp
deleted file mode 100644
index 6ba5765a..00000000
--- a/project starter code/node_modules/.bin/mkdirp
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
-
-case `uname` in
- *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
-esac
-
-if [ -x "$basedir/node" ]; then
- exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
-else
- exec node "$basedir/../mkdirp/bin/cmd.js" "$@"
-fi
diff --git a/project starter code/node_modules/.bin/mkdirp.cmd b/project starter code/node_modules/.bin/mkdirp.cmd
deleted file mode 100644
index a865dd9f..00000000
--- a/project starter code/node_modules/.bin/mkdirp.cmd
+++ /dev/null
@@ -1,17 +0,0 @@
-@ECHO off
-GOTO start
-:find_dp0
-SET dp0=%~dp0
-EXIT /b
-:start
-SETLOCAL
-CALL :find_dp0
-
-IF EXIST "%dp0%\node.exe" (
- SET "_prog=%dp0%\node.exe"
-) ELSE (
- SET "_prog=node"
- SET PATHEXT=%PATHEXT:;.JS;=;%
-)
-
-endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %*
diff --git a/project starter code/node_modules/.bin/mkdirp.ps1 b/project starter code/node_modules/.bin/mkdirp.ps1
deleted file mode 100644
index 911e8546..00000000
--- a/project starter code/node_modules/.bin/mkdirp.ps1
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env pwsh
-$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
-
-$exe=""
-if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
- # Fix case when both the Windows and Linux builds of Node
- # are installed in the same directory
- $exe=".exe"
-}
-$ret=0
-if (Test-Path "$basedir/node$exe") {
- # Support pipeline input
- if ($MyInvocation.ExpectingInput) {
- $input | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
- } else {
- & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
- }
- $ret=$LASTEXITCODE
-} else {
- # Support pipeline input
- if ($MyInvocation.ExpectingInput) {
- $input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
- } else {
- & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
- }
- $ret=$LASTEXITCODE
-}
-exit $ret
diff --git a/project starter code/node_modules/.bin/nodemon b/project starter code/node_modules/.bin/nodemon
new file mode 100644
index 00000000..4d75661d
--- /dev/null
+++ b/project starter code/node_modules/.bin/nodemon
@@ -0,0 +1,12 @@
+#!/bin/sh
+basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
+
+case `uname` in
+ *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+if [ -x "$basedir/node" ]; then
+ exec "$basedir/node" "$basedir/../nodemon/bin/nodemon.js" "$@"
+else
+ exec node "$basedir/../nodemon/bin/nodemon.js" "$@"
+fi
diff --git a/project starter code/node_modules/.bin/nodemon.cmd b/project starter code/node_modules/.bin/nodemon.cmd
new file mode 100644
index 00000000..55acf8a4
--- /dev/null
+++ b/project starter code/node_modules/.bin/nodemon.cmd
@@ -0,0 +1,17 @@
+@ECHO off
+GOTO start
+:find_dp0
+SET dp0=%~dp0
+EXIT /b
+:start
+SETLOCAL
+CALL :find_dp0
+
+IF EXIST "%dp0%\node.exe" (
+ SET "_prog=%dp0%\node.exe"
+) ELSE (
+ SET "_prog=node"
+ SET PATHEXT=%PATHEXT:;.JS;=;%
+)
+
+endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nodemon\bin\nodemon.js" %*
diff --git a/project starter code/node_modules/.bin/nodemon.ps1 b/project starter code/node_modules/.bin/nodemon.ps1
new file mode 100644
index 00000000..d4e3f5d4
--- /dev/null
+++ b/project starter code/node_modules/.bin/nodemon.ps1
@@ -0,0 +1,28 @@
+#!/usr/bin/env pwsh
+$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
+
+$exe=""
+if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
+ # Fix case when both the Windows and Linux builds of Node
+ # are installed in the same directory
+ $exe=".exe"
+}
+$ret=0
+if (Test-Path "$basedir/node$exe") {
+ # Support pipeline input
+ if ($MyInvocation.ExpectingInput) {
+ $input | & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args
+ } else {
+ & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args
+ }
+ $ret=$LASTEXITCODE
+} else {
+ # Support pipeline input
+ if ($MyInvocation.ExpectingInput) {
+ $input | & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args
+ } else {
+ & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args
+ }
+ $ret=$LASTEXITCODE
+}
+exit $ret
diff --git a/project starter code/node_modules/.bin/nodetouch b/project starter code/node_modules/.bin/nodetouch
new file mode 100644
index 00000000..03f8b4d4
--- /dev/null
+++ b/project starter code/node_modules/.bin/nodetouch
@@ -0,0 +1,12 @@
+#!/bin/sh
+basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
+
+case `uname` in
+ *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+if [ -x "$basedir/node" ]; then
+ exec "$basedir/node" "$basedir/../touch/bin/nodetouch.js" "$@"
+else
+ exec node "$basedir/../touch/bin/nodetouch.js" "$@"
+fi
diff --git a/project starter code/node_modules/.bin/nodetouch.cmd b/project starter code/node_modules/.bin/nodetouch.cmd
new file mode 100644
index 00000000..8298b918
--- /dev/null
+++ b/project starter code/node_modules/.bin/nodetouch.cmd
@@ -0,0 +1,17 @@
+@ECHO off
+GOTO start
+:find_dp0
+SET dp0=%~dp0
+EXIT /b
+:start
+SETLOCAL
+CALL :find_dp0
+
+IF EXIST "%dp0%\node.exe" (
+ SET "_prog=%dp0%\node.exe"
+) ELSE (
+ SET "_prog=node"
+ SET PATHEXT=%PATHEXT:;.JS;=;%
+)
+
+endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\touch\bin\nodetouch.js" %*
diff --git a/project starter code/node_modules/.bin/nodetouch.ps1 b/project starter code/node_modules/.bin/nodetouch.ps1
new file mode 100644
index 00000000..5f68b4cb
--- /dev/null
+++ b/project starter code/node_modules/.bin/nodetouch.ps1
@@ -0,0 +1,28 @@
+#!/usr/bin/env pwsh
+$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
+
+$exe=""
+if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
+ # Fix case when both the Windows and Linux builds of Node
+ # are installed in the same directory
+ $exe=".exe"
+}
+$ret=0
+if (Test-Path "$basedir/node$exe") {
+ # Support pipeline input
+ if ($MyInvocation.ExpectingInput) {
+ $input | & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args
+ } else {
+ & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args
+ }
+ $ret=$LASTEXITCODE
+} else {
+ # Support pipeline input
+ if ($MyInvocation.ExpectingInput) {
+ $input | & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args
+ } else {
+ & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args
+ }
+ $ret=$LASTEXITCODE
+}
+exit $ret
diff --git a/project starter code/node_modules/.bin/semver b/project starter code/node_modules/.bin/semver
new file mode 100644
index 00000000..77443e78
--- /dev/null
+++ b/project starter code/node_modules/.bin/semver
@@ -0,0 +1,12 @@
+#!/bin/sh
+basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
+
+case `uname` in
+ *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+if [ -x "$basedir/node" ]; then
+ exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
+else
+ exec node "$basedir/../semver/bin/semver.js" "$@"
+fi
diff --git a/project starter code/node_modules/.bin/semver.cmd b/project starter code/node_modules/.bin/semver.cmd
new file mode 100644
index 00000000..9913fa9d
--- /dev/null
+++ b/project starter code/node_modules/.bin/semver.cmd
@@ -0,0 +1,17 @@
+@ECHO off
+GOTO start
+:find_dp0
+SET dp0=%~dp0
+EXIT /b
+:start
+SETLOCAL
+CALL :find_dp0
+
+IF EXIST "%dp0%\node.exe" (
+ SET "_prog=%dp0%\node.exe"
+) ELSE (
+ SET "_prog=node"
+ SET PATHEXT=%PATHEXT:;.JS;=;%
+)
+
+endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %*
diff --git a/project starter code/node_modules/.bin/semver.ps1 b/project starter code/node_modules/.bin/semver.ps1
new file mode 100644
index 00000000..314717ad
--- /dev/null
+++ b/project starter code/node_modules/.bin/semver.ps1
@@ -0,0 +1,28 @@
+#!/usr/bin/env pwsh
+$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
+
+$exe=""
+if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
+ # Fix case when both the Windows and Linux builds of Node
+ # are installed in the same directory
+ $exe=".exe"
+}
+$ret=0
+if (Test-Path "$basedir/node$exe") {
+ # Support pipeline input
+ if ($MyInvocation.ExpectingInput) {
+ $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
+ } else {
+ & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
+ }
+ $ret=$LASTEXITCODE
+} else {
+ # Support pipeline input
+ if ($MyInvocation.ExpectingInput) {
+ $input | & "node$exe" "$basedir/../semver/bin/semver.js" $args
+ } else {
+ & "node$exe" "$basedir/../semver/bin/semver.js" $args
+ }
+ $ret=$LASTEXITCODE
+}
+exit $ret
diff --git a/project starter code/node_modules/.package-lock.json b/project starter code/node_modules/.package-lock.json
index b5fcbf14..962e22f3 100644
--- a/project starter code/node_modules/.package-lock.json
+++ b/project starter code/node_modules/.package-lock.json
@@ -4,24 +4,12 @@
"lockfileVersion": 2,
"requires": true,
"packages": {
- "node_modules/@babel/runtime": {
- "version": "7.20.7",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz",
- "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==",
- "dependencies": {
- "regenerator-runtime": "^0.13.11"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
"node_modules/@jimp/bmp": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.2.tgz",
- "integrity": "sha512-4g9vW45QfMoGhLVvaFj26h4e7cC+McHUQwyFQmNTLW4FfC1OonN9oUr2m/FEDGkTYKR7aqdXR5XUqqIkHWLaFw==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.22.12.tgz",
+ "integrity": "sha512-aeI64HD0npropd+AR76MCcvvRaa+Qck6loCOS03CkkxGHN5/r336qTM5HPUdHKMDOGzqknuVPA8+kK1t03z12g==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
+ "@jimp/utils": "^0.22.12",
"bmp-js": "^0.1.0"
},
"peerDependencies": {
@@ -29,40 +17,35 @@
}
},
"node_modules/@jimp/core": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.2.tgz",
- "integrity": "sha512-dp7HcyUMzjXphXYodI6PaXue+I9PXAavbb+AN+1XqFbotN22Z12DosNPEyy+UhLY/hZiQQqUkEaJHkvV31rs+w==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.22.12.tgz",
+ "integrity": "sha512-l0RR0dOPyzMKfjUW1uebzueFEDtCOj9fN6pyTYWWOM/VS4BciXQ1VVrJs8pO3kycGYZxncRKhCoygbNr8eEZQA==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
+ "@jimp/utils": "^0.22.12",
"any-base": "^1.1.0",
"buffer": "^5.2.0",
"exif-parser": "^0.1.12",
- "file-type": "^9.0.0",
- "load-bmfont": "^1.3.1",
- "mkdirp": "^0.5.1",
- "phin": "^2.9.1",
+ "file-type": "^16.5.4",
+ "isomorphic-fetch": "^3.0.0",
"pixelmatch": "^4.0.2",
- "tinycolor2": "^1.4.1"
+ "tinycolor2": "^1.6.0"
}
},
"node_modules/@jimp/custom": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.2.tgz",
- "integrity": "sha512-GtNwOs4hcVS2GIbqRUf42rUuX07oLB92cj7cqxZb0ZGWwcwhnmSW0TFLAkNafXmqn9ug4VTpNvcJSUdiuECVKg==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.22.12.tgz",
+ "integrity": "sha512-xcmww1O/JFP2MrlGUMd3Q78S3Qu6W3mYTXYuIqFq33EorgYHV/HqymHfXy9GjiCJ7OI+7lWx6nYFOzU7M4rd1Q==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/core": "^0.16.2"
+ "@jimp/core": "^0.22.12"
}
},
"node_modules/@jimp/gif": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.2.tgz",
- "integrity": "sha512-TMdyT9Q0paIKNtT7c5KzQD29CNCsI/t8ka28jMrBjEK7j5RRTvBfuoOnHv7pDJRCjCIqeUoaUSJ7QcciKic6CA==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.22.12.tgz",
+ "integrity": "sha512-y6BFTJgch9mbor2H234VSjd9iwAhaNf/t3US5qpYIs0TSbAvM02Fbc28IaDETj9+4YB4676sz4RcN/zwhfu1pg==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
- "gifwrap": "^0.9.2",
+ "@jimp/utils": "^0.22.12",
+ "gifwrap": "^0.10.1",
"omggif": "^1.0.9"
},
"peerDependencies": {
@@ -70,74 +53,68 @@
}
},
"node_modules/@jimp/jpeg": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.2.tgz",
- "integrity": "sha512-BW5gZydgq6wdIwHd+3iUNgrTklvoQc/FUKSj9meM6A0FU21lUaansRX5BDdJqHkyXJLnnlDGwDt27J+hQuBAVw==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.22.12.tgz",
+ "integrity": "sha512-Rq26XC/uQWaQKyb/5lksCTCxXhtY01NJeBN+dQv5yNYedN0i7iYu+fXEoRsfaJ8xZzjoANH8sns7rVP4GE7d/Q==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
- "jpeg-js": "^0.4.2"
+ "@jimp/utils": "^0.22.12",
+ "jpeg-js": "^0.4.4"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-blit": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.2.tgz",
- "integrity": "sha512-Z31rRfV80gC/r+B/bOPSVVpJEWXUV248j7MdnMOFLu4vr8DMqXVo9jYqvwU/s4LSTMAMXqm4Jg6E/jQfadPKAg==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.22.12.tgz",
+ "integrity": "sha512-xslz2ZoFZOPLY8EZ4dC29m168BtDx95D6K80TzgUi8gqT7LY6CsajWO0FAxDwHz6h0eomHMfyGX0stspBrTKnQ==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-blur": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.2.tgz",
- "integrity": "sha512-ShkJCAzRI+1fAKPuLLgEkixpSpVmKTYaKEFROUcgmrv9AansDXGNCupchqVMTdxf8zPyW8rR1ilvG3OJobufLQ==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.22.12.tgz",
+ "integrity": "sha512-S0vJADTuh1Q9F+cXAwFPlrKWzDj2F9t/9JAbUvaaDuivpyWuImEKXVz5PUZw2NbpuSHjwssbTpOZ8F13iJX4uw==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-circle": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.2.tgz",
- "integrity": "sha512-6T4z/48F4Z5+YwAVCLOvXQcyGmo0E3WztxCz6XGQf66r4JJK78+zcCDYZFLMx0BGM0091FogNK4QniP8JaOkrA==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.22.12.tgz",
+ "integrity": "sha512-SWVXx1yiuj5jZtMijqUfvVOJBwOifFn0918ou4ftoHgegc5aHWW5dZbYPjvC9fLpvz7oSlptNl2Sxr1zwofjTg==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-color": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.2.tgz",
- "integrity": "sha512-6oBV0g0J17/7E+aTquvUsgSc85nUbUi+64tIK5eFIDzvjhlqhjGNJYlc46KJMCWIs61qRJayQoZdL/iT/iQuGQ==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.22.12.tgz",
+ "integrity": "sha512-xImhTE5BpS8xa+mAN6j4sMRWaUgUDLoaGHhJhpC+r7SKKErYDR0WQV4yCE4gP+N0gozD0F3Ka1LUSaMXrn7ZIA==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
- "tinycolor2": "^1.4.1"
+ "@jimp/utils": "^0.22.12",
+ "tinycolor2": "^1.6.0"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-contain": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.2.tgz",
- "integrity": "sha512-pLcxO3hVN3LCEhMNvpZ9B7xILHVlS433Vv16zFFJxLRqZdYvPLsc+ZzJhjAiHHuEjVblQrktHE3LGeQwGJPo0w==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.22.12.tgz",
+ "integrity": "sha512-Eo3DmfixJw3N79lWk8q/0SDYbqmKt1xSTJ69yy8XLYQj9svoBbyRpSnHR+n9hOw5pKXytHwUW6nU4u1wegHNoQ==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -147,12 +124,11 @@
}
},
"node_modules/@jimp/plugin-cover": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.2.tgz",
- "integrity": "sha512-gzWM7VvYeI8msyiwbUZxH+sGQEgO6Vd6adGxZ0CeKX00uQOe5lDzxb1Wjx7sHcJGz8a/5fmAuwz7rdDtpDUbkw==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.22.12.tgz",
+ "integrity": "sha512-z0w/1xH/v/knZkpTNx+E8a7fnasQ2wHG5ze6y5oL2dhH1UufNua8gLQXlv8/W56+4nJ1brhSd233HBJCo01BXA==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -162,60 +138,55 @@
}
},
"node_modules/@jimp/plugin-crop": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.2.tgz",
- "integrity": "sha512-qCd3hfMEE+Z2EuuyXewgXRTtKJGIerWzc1zLEJztsUkPz5i73IGgkOL+mrNutZwGaXZbm+8SwUaGb46sxAO6Tw==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.22.12.tgz",
+ "integrity": "sha512-FNuUN0OVzRCozx8XSgP9MyLGMxNHHJMFt+LJuFjn1mu3k0VQxrzqbN06yIl46TVejhyAhcq5gLzqmSCHvlcBVw==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-displace": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.2.tgz",
- "integrity": "sha512-6nXdvNNjCdD95v2o3/jPeur903dz08lG4Y8gmr5oL2yVv9LSSbMonoXYrR/ASesdyXqGdXJLU4NL+yZs4zUqbQ==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.22.12.tgz",
+ "integrity": "sha512-qpRM8JRicxfK6aPPqKZA6+GzBwUIitiHaZw0QrJ64Ygd3+AsTc7BXr+37k2x7QcyCvmKXY4haUrSIsBug4S3CA==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-dither": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.2.tgz",
- "integrity": "sha512-DERpIzy21ZanMkVsD0Tdy8HQLbD1E41OuvIzaMRoW4183PA6AgGNlrQoFTyXmzjy6FTy1SxaQgTEdouInAWZ9Q==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.22.12.tgz",
+ "integrity": "sha512-jYgGdSdSKl1UUEanX8A85v4+QUm+PE8vHFwlamaKk89s+PXQe7eVE3eNeSZX4inCq63EHL7cX580dMqkoC3ZLw==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-fisheye": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.2.tgz",
- "integrity": "sha512-Df7PsGIwiIpQu3EygYCnaJyTfOwvwtYV3cmYJS7yFLtdiFUuod+hlSo5GkwEPLAy+QBxhUbDuUqnsWo4NQtbiQ==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.22.12.tgz",
+ "integrity": "sha512-LGuUTsFg+fOp6KBKrmLkX4LfyCy8IIsROwoUvsUPKzutSqMJnsm3JGDW2eOmWIS/jJpPaeaishjlxvczjgII+Q==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-flip": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.2.tgz",
- "integrity": "sha512-+2uC8ioVQUr06mnjSWraskz2L33nJHze35LkQ8ZNsIpoZLkgvfiWatqAs5bj+1jGI/9kxoCFAaT1Is0f+a4/rw==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.22.12.tgz",
+ "integrity": "sha512-m251Rop7GN8W0Yo/rF9LWk6kNclngyjIJs/VXHToGQ6EGveOSTSQaX2Isi9f9lCDLxt+inBIb7nlaLLxnvHX8Q==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -223,61 +194,56 @@
}
},
"node_modules/@jimp/plugin-gaussian": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.2.tgz",
- "integrity": "sha512-2mnuDSg4ZEH8zcJig7DZZf4st/cYmQ5UYJKP76iGhZ+6JDACk6uejwAgT5xHecNhkVAaXMdCybA2eknH/9OE1w==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.22.12.tgz",
+ "integrity": "sha512-sBfbzoOmJ6FczfG2PquiK84NtVGeScw97JsCC3rpQv1PHVWyW+uqWFF53+n3c8Y0P2HWlUjflEla2h/vWShvhg==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-invert": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.2.tgz",
- "integrity": "sha512-xFvHbVepTY/nus+6yXiYN1iq+UBRkT0MdnObbiQPstUrAsz0Imn6MWISsnAyMvcNxHGrxaxjuU777JT/esM0gg==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.22.12.tgz",
+ "integrity": "sha512-N+6rwxdB+7OCR6PYijaA/iizXXodpxOGvT/smd/lxeXsZ/empHmFFFJ/FaXcYh19Tm04dGDaXcNF/dN5nm6+xQ==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-mask": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.2.tgz",
- "integrity": "sha512-AbdO85xxhfgEDdxYKpUotEI9ixiCMaIpfYHD5a5O/VWeimz2kuwhcrzlHGiyq1kKAgRcl0WEneTCZAHVSyvPKA==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.22.12.tgz",
+ "integrity": "sha512-4AWZg+DomtpUA099jRV8IEZUfn1wLv6+nem4NRJC7L/82vxzLCgXKTxvNvBcNmJjT9yS1LAAmiJGdWKXG63/NA==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-normalize": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.2.tgz",
- "integrity": "sha512-+ItBWFwmB0Od7OfOtTYT1gm543PpHUgU8/DN55z83l1JqS0OomDJAe7BmCppo2405TN6YtVm/csXo7p4iWd/SQ==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.22.12.tgz",
+ "integrity": "sha512-0So0rexQivnWgnhacX4cfkM2223YdExnJTTy6d06WbkfZk5alHUx8MM3yEzwoCN0ErO7oyqEWRnEkGC+As1FtA==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-print": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.2.tgz",
- "integrity": "sha512-ifTGEeJ5UZTCiqC70HMeU3iXk/vsOmhWiwVGOXSFXhFeE8ZpDWvlmBsrMYnRrJGuaaogHOIrrQPI+kCdDBSBIQ==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.22.12.tgz",
+ "integrity": "sha512-c7TnhHlxm87DJeSnwr/XOLjJU/whoiKYY7r21SbuJ5nuH+7a78EW1teOaj5gEr2wYEd7QtkFqGlmyGXY/YclyQ==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
- "load-bmfont": "^1.4.0"
+ "@jimp/utils": "^0.22.12",
+ "load-bmfont": "^1.4.1"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -285,24 +251,22 @@
}
},
"node_modules/@jimp/plugin-resize": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.2.tgz",
- "integrity": "sha512-gE4N9l6xuwzacFZ2EPCGZCJ/xR+aX2V7GdMndIl/6kYIw5/eib1SFuF9AZLvIPSFuE1FnGo8+vT0pr++SSbhYg==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.22.12.tgz",
+ "integrity": "sha512-3NyTPlPbTnGKDIbaBgQ3HbE6wXbAlFfxHVERmrbqAi8R3r6fQPxpCauA8UVDnieg5eo04D0T8nnnNIX//i/sXg==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-rotate": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.2.tgz",
- "integrity": "sha512-/CTEYkR1HrgmnE0VqPhhbBARbDAfFX590LWGIpxcYIYsUUGQCadl+8Qo4UX13FH0Nt8UHEtPA+O2x08uPYg9UA==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.22.12.tgz",
+ "integrity": "sha512-9YNEt7BPAFfTls2FGfKBVgwwLUuKqy+E8bDGGEsOqHtbuhbshVGxN2WMZaD4gh5IDWvR+emmmPPWGgaYNYt1gA==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -312,12 +276,11 @@
}
},
"node_modules/@jimp/plugin-scale": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.2.tgz",
- "integrity": "sha512-3inuxfrlquyLaqFdiiiQNJUurR0WbvN5wAf1qcYX2LubG1AG8grayYD6H7XVoxfUGTZXh1kpmeirEYlqA2zxcw==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.22.12.tgz",
+ "integrity": "sha512-dghs92qM6MhHj0HrV2qAwKPMklQtjNpoYgAB94ysYpsXslhRTiPisueSIELRwZGEr0J0VUxpUY7HgJwlSIgGZw==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -325,12 +288,11 @@
}
},
"node_modules/@jimp/plugin-shadow": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.2.tgz",
- "integrity": "sha512-Q0aIs2/L6fWMcEh9Ms73u34bT1hyUMw/oxaVoIzOLo6/E8YzCs2Bi63H0/qaPS0MQpEppI++kvosPbblABY79w==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.22.12.tgz",
+ "integrity": "sha512-FX8mTJuCt7/3zXVoeD/qHlm4YH2bVqBuWQHXSuBK054e7wFRnRnbSLPUqAwSeYP3lWqpuQzJtgiiBxV3+WWwTg==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -339,12 +301,11 @@
}
},
"node_modules/@jimp/plugin-threshold": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.2.tgz",
- "integrity": "sha512-gyOwmBgjtMPvcuyOhkP6dOGWbQdaTfhcBRN22mYeI/k/Wh/Zh1OI21F6eKLApsVRmg15MoFnkrCz64RROC34sw==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.22.12.tgz",
+ "integrity": "sha512-4x5GrQr1a/9L0paBC/MZZJjjgjxLYrqSmWd+e+QfAEPvmRxdRoQ5uKEuNgXnm9/weHQBTnQBQsOY2iFja+XGAw==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -353,32 +314,31 @@
}
},
"node_modules/@jimp/plugins": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.2.tgz",
- "integrity": "sha512-zCvYtCgctmC0tkYEu+y+kSwSIZBsNznqJ3/3vkpzxdyjd6wCfNY5Qc/68MPrLc1lmdeGo4cOOTYHG7Vc6myzRw==",
- "dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/plugin-blit": "^0.16.2",
- "@jimp/plugin-blur": "^0.16.2",
- "@jimp/plugin-circle": "^0.16.2",
- "@jimp/plugin-color": "^0.16.2",
- "@jimp/plugin-contain": "^0.16.2",
- "@jimp/plugin-cover": "^0.16.2",
- "@jimp/plugin-crop": "^0.16.2",
- "@jimp/plugin-displace": "^0.16.2",
- "@jimp/plugin-dither": "^0.16.2",
- "@jimp/plugin-fisheye": "^0.16.2",
- "@jimp/plugin-flip": "^0.16.2",
- "@jimp/plugin-gaussian": "^0.16.2",
- "@jimp/plugin-invert": "^0.16.2",
- "@jimp/plugin-mask": "^0.16.2",
- "@jimp/plugin-normalize": "^0.16.2",
- "@jimp/plugin-print": "^0.16.2",
- "@jimp/plugin-resize": "^0.16.2",
- "@jimp/plugin-rotate": "^0.16.2",
- "@jimp/plugin-scale": "^0.16.2",
- "@jimp/plugin-shadow": "^0.16.2",
- "@jimp/plugin-threshold": "^0.16.2",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.22.12.tgz",
+ "integrity": "sha512-yBJ8vQrDkBbTgQZLty9k4+KtUQdRjsIDJSPjuI21YdVeqZxYywifHl4/XWILoTZsjTUASQcGoH0TuC0N7xm3ww==",
+ "dependencies": {
+ "@jimp/plugin-blit": "^0.22.12",
+ "@jimp/plugin-blur": "^0.22.12",
+ "@jimp/plugin-circle": "^0.22.12",
+ "@jimp/plugin-color": "^0.22.12",
+ "@jimp/plugin-contain": "^0.22.12",
+ "@jimp/plugin-cover": "^0.22.12",
+ "@jimp/plugin-crop": "^0.22.12",
+ "@jimp/plugin-displace": "^0.22.12",
+ "@jimp/plugin-dither": "^0.22.12",
+ "@jimp/plugin-fisheye": "^0.22.12",
+ "@jimp/plugin-flip": "^0.22.12",
+ "@jimp/plugin-gaussian": "^0.22.12",
+ "@jimp/plugin-invert": "^0.22.12",
+ "@jimp/plugin-mask": "^0.22.12",
+ "@jimp/plugin-normalize": "^0.22.12",
+ "@jimp/plugin-print": "^0.22.12",
+ "@jimp/plugin-resize": "^0.22.12",
+ "@jimp/plugin-rotate": "^0.22.12",
+ "@jimp/plugin-scale": "^0.22.12",
+ "@jimp/plugin-shadow": "^0.22.12",
+ "@jimp/plugin-threshold": "^0.22.12",
"timm": "^1.6.1"
},
"peerDependencies": {
@@ -386,41 +346,38 @@
}
},
"node_modules/@jimp/png": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.2.tgz",
- "integrity": "sha512-sFOtOSz/tzDwXEChFQ/Nxe+0+vG3Tj0eUxnZVDUG/StXE9dI8Bqmwj3MIa0EgK5s+QG3YlnDOmlPUa4JqmeYeQ==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.22.12.tgz",
+ "integrity": "sha512-Mrp6dr3UTn+aLK8ty/dSKELz+Otdz1v4aAXzV5q53UDD2rbB5joKVJ/ChY310B+eRzNxIovbUF1KVrUsYdE8Hg==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
- "pngjs": "^3.3.3"
+ "@jimp/utils": "^0.22.12",
+ "pngjs": "^6.0.0"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/tiff": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.2.tgz",
- "integrity": "sha512-ADcdqmtZF+U2YoaaHTzFX8D6NFpmN4WZUT0BPMerEuY7Cq8QoLYU22z2h034FrVW+Rbi1b3y04sB9iDiQAlf2w==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.22.12.tgz",
+ "integrity": "sha512-E1LtMh4RyJsoCAfAkBRVSYyZDTtLq9p9LUiiYP0vPtXyxX4BiYBUYihTLSBlCQg5nF2e4OpQg7SPrLdJ66u7jg==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "utif": "^2.0.1"
+ "utif2": "^4.0.1"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/types": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.2.tgz",
- "integrity": "sha512-0Ue5Sq0XnDF6TirisWv5E+8uOnRcd8vRLuwocJOhF76NIlcQrz+5r2k2XWKcr3d+11n28dHLXW5TKSqrUopxhA==",
- "dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/bmp": "^0.16.2",
- "@jimp/gif": "^0.16.2",
- "@jimp/jpeg": "^0.16.2",
- "@jimp/png": "^0.16.2",
- "@jimp/tiff": "^0.16.2",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.22.12.tgz",
+ "integrity": "sha512-wwKYzRdElE1MBXFREvCto5s699izFHNVvALUv79GXNbsOVqlwlOxlWJ8DuyOGIXoLP4JW/m30YyuTtfUJgMRMA==",
+ "dependencies": {
+ "@jimp/bmp": "^0.22.12",
+ "@jimp/gif": "^0.22.12",
+ "@jimp/jpeg": "^0.22.12",
+ "@jimp/png": "^0.22.12",
+ "@jimp/tiff": "^0.22.12",
"timm": "^1.6.1"
},
"peerDependencies": {
@@ -428,14 +385,23 @@
}
},
"node_modules/@jimp/utils": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.2.tgz",
- "integrity": "sha512-XENrPvmigiXZQ8E2nxJqO6UVvWBLzbNwyYi3Y8Q1IECoYhYI3kgOQ0fmy4G269Vz1V0omh1bNmC42r4OfXg1Jg==",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.22.12.tgz",
+ "integrity": "sha512-yJ5cWUknGnilBq97ZXOyOS0HhsHOyAyjHwYfHxGbSyMTohgQI6sVyE8KPgDwH8HHW/nMKXk8TrSwAE71zt716Q==",
"dependencies": {
- "@babel/runtime": "^7.7.2",
"regenerator-runtime": "^0.13.3"
}
},
+ "node_modules/@tokenizer/token": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz",
+ "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="
+ },
+ "node_modules/@types/bluebird": {
+ "version": "3.5.42",
+ "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.42.tgz",
+ "integrity": "sha512-Jhy+MWRlro6UjVi578V/4ZGNfeCOcNCp0YaFNIUGFKlImowqwb1O/22wDVk3FDGMLqxdpOV3qQHD5fPEH4hK6A=="
+ },
"node_modules/@types/node": {
"version": "16.9.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz",
@@ -458,11 +424,45 @@
"resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz",
"integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg=="
},
+ "node_modules/anymatch": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
+ "dev": true,
+ "dependencies": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
"node_modules/array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
},
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
+ },
+ "node_modules/axios": {
+ "version": "1.7.2",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz",
+ "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==",
+ "dependencies": {
+ "follow-redirects": "^1.15.6",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true
+ },
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -482,18 +482,30 @@
}
]
},
+ "node_modules/binary-extensions": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/bmp-js": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz",
"integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw=="
},
"node_modules/body-parser": {
- "version": "1.20.1",
- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
- "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
+ "version": "1.20.2",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
+ "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
"dependencies": {
"bytes": "3.1.2",
- "content-type": "~1.0.4",
+ "content-type": "~1.0.5",
"debug": "2.6.9",
"depd": "2.0.0",
"destroy": "1.2.0",
@@ -501,7 +513,7 @@
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
"qs": "6.11.0",
- "raw-body": "2.5.1",
+ "raw-body": "2.5.2",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
},
@@ -510,6 +522,28 @@
"npm": "1.2.8000 || >= 1.4.16"
}
},
+ "node_modules/brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/braces": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "dev": true,
+ "dependencies": {
+ "fill-range": "^7.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/buffer": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
@@ -550,17 +584,64 @@
}
},
"node_modules/call-bind": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
- "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
- "dependencies": {
- "function-bind": "^1.1.1",
- "get-intrinsic": "^1.0.2"
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
+ "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
+ "dependencies": {
+ "es-define-property": "^1.0.0",
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2",
+ "get-intrinsic": "^1.2.4",
+ "set-function-length": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/chokidar": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
+ "dev": true,
+ "dependencies": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ },
+ "engines": {
+ "node": ">= 8.10.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+ "dev": true
+ },
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
@@ -573,17 +654,17 @@
}
},
"node_modules/content-type": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
- "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
- "version": "0.5.0",
- "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
- "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
+ "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
"engines": {
"node": ">= 0.6"
}
@@ -601,6 +682,30 @@
"ms": "2.0.0"
}
},
+ "node_modules/define-data-property": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
+ "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
+ "dependencies": {
+ "es-define-property": "^1.0.0",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
@@ -636,6 +741,25 @@
"node": ">= 0.8"
}
},
+ "node_modules/es-define-property": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
+ "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
+ "dependencies": {
+ "get-intrinsic": "^1.2.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -655,16 +779,16 @@
"integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw=="
},
"node_modules/express": {
- "version": "4.18.2",
- "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
- "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
+ "version": "4.19.2",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
+ "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==",
"dependencies": {
"accepts": "~1.3.8",
"array-flatten": "1.1.1",
- "body-parser": "1.20.1",
+ "body-parser": "1.20.2",
"content-disposition": "0.5.4",
"content-type": "~1.0.4",
- "cookie": "0.5.0",
+ "cookie": "0.6.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "2.0.0",
@@ -696,11 +820,31 @@
}
},
"node_modules/file-type": {
- "version": "9.0.0",
- "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz",
- "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==",
+ "version": "16.5.4",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz",
+ "integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==",
+ "dependencies": {
+ "readable-web-to-node-stream": "^3.0.0",
+ "strtok3": "^6.2.4",
+ "token-types": "^4.1.1"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/file-type?sponsor=1"
+ }
+ },
+ "node_modules/fill-range": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "dev": true,
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
"engines": {
- "node": ">=6"
+ "node": ">=8"
}
},
"node_modules/finalhandler": {
@@ -720,6 +864,38 @@
"node": ">= 0.8"
}
},
+ "node_modules/follow-redirects": {
+ "version": "1.15.6",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
+ "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/form-data": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+ "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
@@ -737,32 +913,52 @@
}
},
"node_modules/function-bind": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
- "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
},
"node_modules/get-intrinsic": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz",
- "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==",
- "dependencies": {
- "function-bind": "^1.1.1",
- "has": "^1.0.3",
- "has-symbols": "^1.0.3"
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
+ "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2",
+ "has-proto": "^1.0.1",
+ "has-symbols": "^1.0.3",
+ "hasown": "^2.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/gifwrap": {
- "version": "0.9.4",
- "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz",
- "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==",
+ "version": "0.10.1",
+ "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.10.1.tgz",
+ "integrity": "sha512-2760b1vpJHNmLzZ/ubTtNnEx5WApN/PYWJvXvgS+tL1egTTthayFYIQQNi136FLEDcN/IyEY2EcGpIITD6eYUw==",
"dependencies": {
"image-q": "^4.0.0",
"omggif": "^1.0.10"
}
},
+ "node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/global": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz",
@@ -772,15 +968,46 @@
"process": "^0.11.10"
}
},
- "node_modules/has": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
- "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "node_modules/gopd": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
+ "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
"dependencies": {
- "function-bind": "^1.1.1"
+ "get-intrinsic": "^1.1.3"
},
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
+ "dev": true,
"engines": {
- "node": ">= 0.4.0"
+ "node": ">=4"
+ }
+ },
+ "node_modules/has-property-descriptors": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
+ "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
+ "dependencies": {
+ "es-define-property": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-proto": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz",
+ "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
@@ -794,6 +1021,17 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/hasown": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
@@ -839,6 +1077,12 @@
}
]
},
+ "node_modules/ignore-by-default": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
+ "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
+ "dev": true
+ },
"node_modules/image-q": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz",
@@ -860,20 +1104,70 @@
"node": ">= 0.10"
}
},
+ "node_modules/is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "dependencies": {
+ "binary-extensions": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/is-function": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz",
"integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ=="
},
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
+ "node_modules/isomorphic-fetch": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz",
+ "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==",
+ "dependencies": {
+ "node-fetch": "^2.6.1",
+ "whatwg-fetch": "^3.4.1"
+ }
+ },
"node_modules/jimp": {
- "version": "0.16.2",
- "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.2.tgz",
- "integrity": "sha512-UpItBk81a92f8oEyoGYbO3YK4QcM0hoIyuGHmShoF9Ov63P5Qo7Q/X2xsAgnODmSuDJFOtrPtJd5GSWW4LKdOQ==",
- "dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/custom": "^0.16.2",
- "@jimp/plugins": "^0.16.2",
- "@jimp/types": "^0.16.2",
+ "version": "0.22.12",
+ "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.22.12.tgz",
+ "integrity": "sha512-R5jZaYDnfkxKJy1dwLpj/7cvyjxiclxU3F4TrI/J4j2rS0niq6YDUMoPn5hs8GDpO+OZGo7Ky057CRtWesyhfg==",
+ "dependencies": {
+ "@jimp/custom": "^0.22.12",
+ "@jimp/plugins": "^0.22.12",
+ "@jimp/types": "^0.22.12",
"regenerator-runtime": "^0.13.3"
}
},
@@ -956,23 +1250,16 @@
"dom-walk": "^0.1.0"
}
},
- "node_modules/minimist": {
- "version": "1.2.7",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
- "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/mkdirp": {
- "version": "0.5.6",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
- "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
+ "node_modules/minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "dev": true,
"dependencies": {
- "minimist": "^1.2.6"
+ "brace-expansion": "^1.1.7"
},
- "bin": {
- "mkdirp": "bin/cmd.js"
+ "engines": {
+ "node": "*"
}
},
"node_modules/ms": {
@@ -988,10 +1275,89 @@
"node": ">= 0.6"
}
},
+ "node_modules/node-fetch": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
+ "dependencies": {
+ "whatwg-url": "^5.0.0"
+ },
+ "engines": {
+ "node": "4.x || >=6.0.0"
+ },
+ "peerDependencies": {
+ "encoding": "^0.1.0"
+ },
+ "peerDependenciesMeta": {
+ "encoding": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/nodemon": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.1.tgz",
+ "integrity": "sha512-k43xGaDtaDIcufn0Fc6fTtsdKSkV/hQzoQFigNH//GaKta28yoKVYXCnV+KXRqfT/YzsFaQU9VdeEG+HEyxr6A==",
+ "dev": true,
+ "dependencies": {
+ "chokidar": "^3.5.2",
+ "debug": "^4",
+ "ignore-by-default": "^1.0.1",
+ "minimatch": "^3.1.2",
+ "pstree.remy": "^1.1.8",
+ "semver": "^7.5.3",
+ "simple-update-notifier": "^2.0.0",
+ "supports-color": "^5.5.0",
+ "touch": "^3.1.0",
+ "undefsafe": "^2.0.5"
+ },
+ "bin": {
+ "nodemon": "bin/nodemon.js"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/nodemon"
+ }
+ },
+ "node_modules/nodemon/node_modules/debug": {
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+ "dev": true,
+ "dependencies": {
+ "ms": "2.1.2"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/nodemon/node_modules/ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ },
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/object-inspect": {
- "version": "1.12.2",
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
- "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==",
+ "version": "1.13.1",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
+ "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@@ -1028,12 +1394,12 @@
"integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA=="
},
"node_modules/parse-bmfont-xml": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz",
- "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==",
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.6.tgz",
+ "integrity": "sha512-0cEliVMZEhrFDwMh4SxIyVJpqYoOWDJ9P895tFuS+XuNzI5UBmBk5U5O4KuJdTnZpSBI4LFA2+ZiJaiwfSwlMA==",
"dependencies": {
"xml-parse-from-string": "^1.0.0",
- "xml2js": "^0.4.5"
+ "xml2js": "^0.5.0"
}
},
"node_modules/parse-headers": {
@@ -1054,10 +1420,35 @@
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
},
+ "node_modules/peek-readable": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz",
+ "integrity": "sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Borewit"
+ }
+ },
"node_modules/phin": {
"version": "2.9.3",
"resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz",
- "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA=="
+ "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==",
+ "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."
+ },
+ "node_modules/picomatch": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "dev": true,
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
},
"node_modules/pixelmatch": {
"version": "4.0.2",
@@ -1070,7 +1461,7 @@
"pixelmatch": "bin/pixelmatch"
}
},
- "node_modules/pngjs": {
+ "node_modules/pixelmatch/node_modules/pngjs": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz",
"integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==",
@@ -1078,6 +1469,14 @@
"node": ">=4.0.0"
}
},
+ "node_modules/pngjs": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz",
+ "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==",
+ "engines": {
+ "node": ">=12.13.0"
+ }
+ },
"node_modules/process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@@ -1098,6 +1497,17 @@
"node": ">= 0.10"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+ },
+ "node_modules/pstree.remy": {
+ "version": "1.1.8",
+ "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
+ "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",
+ "dev": true
+ },
"node_modules/qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
@@ -1121,9 +1531,9 @@
}
},
"node_modules/raw-body": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
- "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
+ "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
"dependencies": {
"bytes": "3.1.2",
"http-errors": "2.0.0",
@@ -1134,6 +1544,46 @@
"node": ">= 0.8"
}
},
+ "node_modules/readable-stream": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/readable-web-to-node-stream": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz",
+ "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==",
+ "dependencies": {
+ "readable-stream": "^3.6.0"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Borewit"
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "dev": true,
+ "dependencies": {
+ "picomatch": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
"node_modules/regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
@@ -1164,9 +1614,21 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/sax": {
- "version": "1.2.4",
- "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
- "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz",
+ "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA=="
+ },
+ "node_modules/semver": {
+ "version": "7.6.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz",
+ "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==",
+ "dev": true,
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
},
"node_modules/send": {
"version": "0.18.0",
@@ -1210,24 +1672,56 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/set-function-length": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
+ "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
+ "dependencies": {
+ "define-data-property": "^1.1.4",
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2",
+ "get-intrinsic": "^1.2.4",
+ "gopd": "^1.0.1",
+ "has-property-descriptors": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"node_modules/side-channel": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
- "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
+ "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==",
"dependencies": {
- "call-bind": "^1.0.0",
- "get-intrinsic": "^1.0.2",
- "object-inspect": "^1.9.0"
+ "call-bind": "^1.0.7",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.4",
+ "object-inspect": "^1.13.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/simple-update-notifier": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
+ "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==",
+ "dev": true,
+ "dependencies": {
+ "semver": "^7.5.3"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
@@ -1236,17 +1730,62 @@
"node": ">= 0.8"
}
},
+ "node_modules/string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "dependencies": {
+ "safe-buffer": "~5.2.0"
+ }
+ },
+ "node_modules/strtok3": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz",
+ "integrity": "sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==",
+ "dependencies": {
+ "@tokenizer/token": "^0.3.0",
+ "peek-readable": "^4.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Borewit"
+ }
+ },
+ "node_modules/supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/timm": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz",
"integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw=="
},
"node_modules/tinycolor2": {
- "version": "1.5.1",
- "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.1.tgz",
- "integrity": "sha512-BHlrsGeYN2OpkRpfAgkEwCMu6w8Quq8JkK/mp4c55NZP7OwceJObR1CPZt62TqiA0Y3J5pwuDX+fXDqc35REtg==",
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz",
+ "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw=="
+ },
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
"engines": {
- "node": "*"
+ "node": ">=8.0"
}
},
"node_modules/toidentifier": {
@@ -1257,6 +1796,36 @@
"node": ">=0.6"
}
},
+ "node_modules/token-types": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz",
+ "integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==",
+ "dependencies": {
+ "@tokenizer/token": "^0.3.0",
+ "ieee754": "^1.2.1"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Borewit"
+ }
+ },
+ "node_modules/touch": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz",
+ "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==",
+ "dev": true,
+ "bin": {
+ "nodetouch": "bin/nodetouch.js"
+ }
+ },
+ "node_modules/tr46": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
+ },
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
@@ -1269,6 +1838,12 @@
"node": ">= 0.6"
}
},
+ "node_modules/undefsafe": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
+ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
+ "dev": true
+ },
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
@@ -1277,14 +1852,19 @@
"node": ">= 0.8"
}
},
- "node_modules/utif": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz",
- "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==",
+ "node_modules/utif2": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/utif2/-/utif2-4.1.0.tgz",
+ "integrity": "sha512-+oknB9FHrJ7oW7A2WZYajOcv4FcDR4CfoGB0dPNfxbi4GO05RRnFmt5oa23+9w32EanrYcSJWspUiJkLMs+37w==",
"dependencies": {
- "pako": "^1.0.5"
+ "pako": "^1.0.11"
}
},
+ "node_modules/util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
+ },
"node_modules/utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
@@ -1301,6 +1881,25 @@
"node": ">= 0.8"
}
},
+ "node_modules/webidl-conversions": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
+ },
+ "node_modules/whatwg-fetch": {
+ "version": "3.6.20",
+ "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz",
+ "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg=="
+ },
+ "node_modules/whatwg-url": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
+ "dependencies": {
+ "tr46": "~0.0.3",
+ "webidl-conversions": "^3.0.0"
+ }
+ },
"node_modules/xhr": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz",
@@ -1318,9 +1917,9 @@
"integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g=="
},
"node_modules/xml2js": {
- "version": "0.4.23",
- "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
- "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
+ "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
"dependencies": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
diff --git a/project starter code/node_modules/@babel/runtime/LICENSE b/project starter code/node_modules/@babel/runtime/LICENSE
deleted file mode 100644
index f31575ec..00000000
--- a/project starter code/node_modules/@babel/runtime/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-MIT License
-
-Copyright (c) 2014-present Sebastian McKenzie and other contributors
-
-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/project starter code/node_modules/@babel/runtime/README.md b/project starter code/node_modules/@babel/runtime/README.md
deleted file mode 100644
index be27e834..00000000
--- a/project starter code/node_modules/@babel/runtime/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# @babel/runtime
-
-> babel's modular runtime helpers
-
-See our website [@babel/runtime](https://babeljs.io/docs/en/babel-runtime) for more information.
-
-## Install
-
-Using npm:
-
-```sh
-npm install --save @babel/runtime
-```
-
-or using yarn:
-
-```sh
-yarn add @babel/runtime
-```
diff --git a/project starter code/node_modules/@babel/runtime/helpers/AsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/AsyncGenerator.js
deleted file mode 100644
index c3379a9c..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/AsyncGenerator.js
+++ /dev/null
@@ -1,64 +0,0 @@
-var OverloadYield = require("./OverloadYield.js");
-function AsyncGenerator(gen) {
- var front, back;
- function resume(key, arg) {
- try {
- var result = gen[key](arg),
- value = result.value,
- overloaded = value instanceof OverloadYield;
- Promise.resolve(overloaded ? value.v : value).then(function (arg) {
- if (overloaded) {
- var nextKey = "return" === key ? "return" : "next";
- if (!value.k || arg.done) return resume(nextKey, arg);
- arg = gen[nextKey](arg).value;
- }
- settle(result.done ? "return" : "normal", arg);
- }, function (err) {
- resume("throw", err);
- });
- } catch (err) {
- settle("throw", err);
- }
- }
- function settle(type, value) {
- switch (type) {
- case "return":
- front.resolve({
- value: value,
- done: !0
- });
- break;
- case "throw":
- front.reject(value);
- break;
- default:
- front.resolve({
- value: value,
- done: !1
- });
- }
- (front = front.next) ? resume(front.key, front.arg) : back = null;
- }
- this._invoke = function (key, arg) {
- return new Promise(function (resolve, reject) {
- var request = {
- key: key,
- arg: arg,
- resolve: resolve,
- reject: reject,
- next: null
- };
- back ? back = back.next = request : (front = back = request, resume(key, arg));
- });
- }, "function" != typeof gen["return"] && (this["return"] = void 0);
-}
-AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () {
- return this;
-}, AsyncGenerator.prototype.next = function (arg) {
- return this._invoke("next", arg);
-}, AsyncGenerator.prototype["throw"] = function (arg) {
- return this._invoke("throw", arg);
-}, AsyncGenerator.prototype["return"] = function (arg) {
- return this._invoke("return", arg);
-};
-module.exports = AsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/AwaitValue.js b/project starter code/node_modules/@babel/runtime/helpers/AwaitValue.js
deleted file mode 100644
index 7681c2df..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/AwaitValue.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _AwaitValue(value) {
- this.wrapped = value;
-}
-module.exports = _AwaitValue, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/OverloadYield.js b/project starter code/node_modules/@babel/runtime/helpers/OverloadYield.js
deleted file mode 100644
index b1331134..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/OverloadYield.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _OverloadYield(value, kind) {
- this.v = value, this.k = kind;
-}
-module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js
deleted file mode 100644
index 98810d61..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js
+++ /dev/null
@@ -1,24 +0,0 @@
-function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object.keys(descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
- if (desc.initializer === void 0) {
- Object.defineProperty(target, property, desc);
- desc = null;
- }
- return desc;
-}
-module.exports = _applyDecoratedDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/applyDecs.js b/project starter code/node_modules/@babel/runtime/helpers/applyDecs.js
deleted file mode 100644
index 68a08c26..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/applyDecs.js
+++ /dev/null
@@ -1,236 +0,0 @@
-var _typeof = require("./typeof.js")["default"];
-function old_createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) {
- return {
- getMetadata: function getMetadata(key) {
- old_assertNotFinished(decoratorFinishedRef, "getMetadata"), old_assertMetadataKey(key);
- var metadataForKey = metadataMap[key];
- if (void 0 !== metadataForKey) if (1 === kind) {
- var pub = metadataForKey["public"];
- if (void 0 !== pub) return pub[property];
- } else if (2 === kind) {
- var priv = metadataForKey["private"];
- if (void 0 !== priv) return priv.get(property);
- } else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) return metadataForKey.constructor;
- },
- setMetadata: function setMetadata(key, value) {
- old_assertNotFinished(decoratorFinishedRef, "setMetadata"), old_assertMetadataKey(key);
- var metadataForKey = metadataMap[key];
- if (void 0 === metadataForKey && (metadataForKey = metadataMap[key] = {}), 1 === kind) {
- var pub = metadataForKey["public"];
- void 0 === pub && (pub = metadataForKey["public"] = {}), pub[property] = value;
- } else if (2 === kind) {
- var priv = metadataForKey.priv;
- void 0 === priv && (priv = metadataForKey["private"] = new Map()), priv.set(property, value);
- } else metadataForKey.constructor = value;
- }
- };
-}
-function old_convertMetadataMapToFinal(obj, metadataMap) {
- var parentMetadataMap = obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")],
- metadataKeys = Object.getOwnPropertySymbols(metadataMap);
- if (0 !== metadataKeys.length) {
- for (var i = 0; i < metadataKeys.length; i++) {
- var key = metadataKeys[i],
- metaForKey = metadataMap[key],
- parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null,
- pub = metaForKey["public"],
- parentPub = parentMetaForKey ? parentMetaForKey["public"] : null;
- pub && parentPub && Object.setPrototypeOf(pub, parentPub);
- var priv = metaForKey["private"];
- if (priv) {
- var privArr = Array.from(priv.values()),
- parentPriv = parentMetaForKey ? parentMetaForKey["private"] : null;
- parentPriv && (privArr = privArr.concat(parentPriv)), metaForKey["private"] = privArr;
- }
- parentMetaForKey && Object.setPrototypeOf(metaForKey, parentMetaForKey);
- }
- parentMetadataMap && Object.setPrototypeOf(metadataMap, parentMetadataMap), obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = metadataMap;
- }
-}
-function old_createAddInitializerMethod(initializers, decoratorFinishedRef) {
- return function (initializer) {
- old_assertNotFinished(decoratorFinishedRef, "addInitializer"), old_assertCallable(initializer, "An initializer"), initializers.push(initializer);
- };
-}
-function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) {
- var kindStr;
- switch (kind) {
- case 1:
- kindStr = "accessor";
- break;
- case 2:
- kindStr = "method";
- break;
- case 3:
- kindStr = "getter";
- break;
- case 4:
- kindStr = "setter";
- break;
- default:
- kindStr = "field";
- }
- var metadataKind,
- metadataName,
- ctx = {
- kind: kindStr,
- name: isPrivate ? "#" + name : name,
- isStatic: isStatic,
- isPrivate: isPrivate
- },
- decoratorFinishedRef = {
- v: !1
- };
- if (0 !== kind && (ctx.addInitializer = old_createAddInitializerMethod(initializers, decoratorFinishedRef)), isPrivate) {
- metadataKind = 2, metadataName = Symbol(name);
- var access = {};
- 0 === kind ? (access.get = desc.get, access.set = desc.set) : 2 === kind ? access.get = function () {
- return desc.value;
- } : (1 !== kind && 3 !== kind || (access.get = function () {
- return desc.get.call(this);
- }), 1 !== kind && 4 !== kind || (access.set = function (v) {
- desc.set.call(this, v);
- })), ctx.access = access;
- } else metadataKind = 1, metadataName = name;
- try {
- return dec(value, Object.assign(ctx, old_createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef)));
- } finally {
- decoratorFinishedRef.v = !0;
- }
-}
-function old_assertNotFinished(decoratorFinishedRef, fnName) {
- if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
-}
-function old_assertMetadataKey(key) {
- if ("symbol" != _typeof(key)) throw new TypeError("Metadata keys must be symbols, received: " + key);
-}
-function old_assertCallable(fn, hint) {
- if ("function" != typeof fn) throw new TypeError(hint + " must be a function");
-}
-function old_assertValidReturnValue(kind, value) {
- var type = _typeof(value);
- if (1 === kind) {
- if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
- void 0 !== value.get && old_assertCallable(value.get, "accessor.get"), void 0 !== value.set && old_assertCallable(value.set, "accessor.set"), void 0 !== value.init && old_assertCallable(value.init, "accessor.init"), void 0 !== value.initializer && old_assertCallable(value.initializer, "accessor.initializer");
- } else if ("function" !== type) {
- var hint;
- throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0");
- }
-}
-function old_getInit(desc) {
- var initializer;
- return null == (initializer = desc.init) && (initializer = desc.initializer) && "undefined" != typeof console && console.warn(".initializer has been renamed to .init as of March 2022"), initializer;
-}
-function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) {
- var desc,
- initializer,
- value,
- newValue,
- get,
- set,
- decs = decInfo[0];
- if (isPrivate ? desc = 0 === kind || 1 === kind ? {
- get: decInfo[3],
- set: decInfo[4]
- } : 3 === kind ? {
- get: decInfo[3]
- } : 4 === kind ? {
- set: decInfo[3]
- } : {
- value: decInfo[3]
- } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = {
- get: desc.get,
- set: desc.set
- } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = old_memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value)) && (old_assertValidReturnValue(kind, newValue), 0 === kind ? initializer = newValue : 1 === kind ? (initializer = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = {
- get: get,
- set: set
- }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) {
- var newInit;
- if (void 0 !== (newValue = old_memberDec(decs[i], name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value))) old_assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = {
- get: get,
- set: set
- }) : value = newValue, void 0 !== newInit && (void 0 === initializer ? initializer = newInit : "function" == typeof initializer ? initializer = [initializer, newInit] : initializer.push(newInit));
- }
- if (0 === kind || 1 === kind) {
- if (void 0 === initializer) initializer = function initializer(instance, init) {
- return init;
- };else if ("function" != typeof initializer) {
- var ownInitializers = initializer;
- initializer = function initializer(instance, init) {
- for (var value = init, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value);
- return value;
- };
- } else {
- var originalInitializer = initializer;
- initializer = function initializer(instance, init) {
- return originalInitializer.call(instance, init);
- };
- }
- ret.push(initializer);
- }
- 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) {
- return value.get.call(instance, args);
- }), ret.push(function (instance, args) {
- return value.set.call(instance, args);
- })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) {
- return value.call(instance, args);
- }) : Object.defineProperty(base, name, desc));
-}
-function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) {
- for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) {
- var decInfo = decInfos[i];
- if (Array.isArray(decInfo)) {
- var base,
- metadataMap,
- initializers,
- kind = decInfo[1],
- name = decInfo[2],
- isPrivate = decInfo.length > 3,
- isStatic = kind >= 5;
- if (isStatic ? (base = Class, metadataMap = staticMetadataMap, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, metadataMap = protoMetadataMap, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) {
- var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields,
- existingKind = existingNonFields.get(name) || 0;
- if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
- !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0);
- }
- old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers);
- }
- }
- old_pushInitializers(ret, protoInitializers), old_pushInitializers(ret, staticInitializers);
-}
-function old_pushInitializers(ret, initializers) {
- initializers && ret.push(function (instance) {
- for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
- return instance;
- });
-}
-function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) {
- if (classDecs.length > 0) {
- for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) {
- var decoratorFinishedRef = {
- v: !1
- };
- try {
- var ctx = Object.assign({
- kind: "class",
- name: name,
- addInitializer: old_createAddInitializerMethod(initializers, decoratorFinishedRef)
- }, old_createMetadataMethodsForProperty(metadataMap, 0, name, decoratorFinishedRef)),
- nextNewClass = classDecs[i](newClass, ctx);
- } finally {
- decoratorFinishedRef.v = !0;
- }
- void 0 !== nextNewClass && (old_assertValidReturnValue(10, nextNewClass), newClass = nextNewClass);
- }
- ret.push(newClass, function () {
- for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass);
- });
- }
-}
-function applyDecs(targetClass, memberDecs, classDecs) {
- var ret = [],
- staticMetadataMap = {},
- protoMetadataMap = {};
- return old_applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs), old_convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap), old_applyClassDecs(ret, targetClass, staticMetadataMap, classDecs), old_convertMetadataMapToFinal(targetClass, staticMetadataMap), ret;
-}
-module.exports = applyDecs, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/applyDecs2203.js b/project starter code/node_modules/@babel/runtime/helpers/applyDecs2203.js
deleted file mode 100644
index 34419d52..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/applyDecs2203.js
+++ /dev/null
@@ -1,184 +0,0 @@
-var _typeof = require("./typeof.js")["default"];
-function createAddInitializerMethod(initializers, decoratorFinishedRef) {
- return function (initializer) {
- assertNotFinished(decoratorFinishedRef, "addInitializer"), assertCallable(initializer, "An initializer"), initializers.push(initializer);
- };
-}
-function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) {
- var kindStr;
- switch (kind) {
- case 1:
- kindStr = "accessor";
- break;
- case 2:
- kindStr = "method";
- break;
- case 3:
- kindStr = "getter";
- break;
- case 4:
- kindStr = "setter";
- break;
- default:
- kindStr = "field";
- }
- var get,
- set,
- ctx = {
- kind: kindStr,
- name: isPrivate ? "#" + name : name,
- "static": isStatic,
- "private": isPrivate
- },
- decoratorFinishedRef = {
- v: !1
- };
- 0 !== kind && (ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef)), 0 === kind ? isPrivate ? (get = desc.get, set = desc.set) : (get = function get() {
- return this[name];
- }, set = function set(v) {
- this[name] = v;
- }) : 2 === kind ? get = function get() {
- return desc.value;
- } : (1 !== kind && 3 !== kind || (get = function get() {
- return desc.get.call(this);
- }), 1 !== kind && 4 !== kind || (set = function set(v) {
- desc.set.call(this, v);
- })), ctx.access = get && set ? {
- get: get,
- set: set
- } : get ? {
- get: get
- } : {
- set: set
- };
- try {
- return dec(value, ctx);
- } finally {
- decoratorFinishedRef.v = !0;
- }
-}
-function assertNotFinished(decoratorFinishedRef, fnName) {
- if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
-}
-function assertCallable(fn, hint) {
- if ("function" != typeof fn) throw new TypeError(hint + " must be a function");
-}
-function assertValidReturnValue(kind, value) {
- var type = _typeof(value);
- if (1 === kind) {
- if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
- void 0 !== value.get && assertCallable(value.get, "accessor.get"), void 0 !== value.set && assertCallable(value.set, "accessor.set"), void 0 !== value.init && assertCallable(value.init, "accessor.init");
- } else if ("function" !== type) {
- var hint;
- throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0");
- }
-}
-function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) {
- var desc,
- init,
- value,
- newValue,
- get,
- set,
- decs = decInfo[0];
- if (isPrivate ? desc = 0 === kind || 1 === kind ? {
- get: decInfo[3],
- set: decInfo[4]
- } : 3 === kind ? {
- get: decInfo[3]
- } : 4 === kind ? {
- set: decInfo[3]
- } : {
- value: decInfo[3]
- } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = {
- get: desc.get,
- set: desc.set
- } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value)) && (assertValidReturnValue(kind, newValue), 0 === kind ? init = newValue : 1 === kind ? (init = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = {
- get: get,
- set: set
- }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) {
- var newInit;
- if (void 0 !== (newValue = memberDec(decs[i], name, desc, initializers, kind, isStatic, isPrivate, value))) assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = {
- get: get,
- set: set
- }) : value = newValue, void 0 !== newInit && (void 0 === init ? init = newInit : "function" == typeof init ? init = [init, newInit] : init.push(newInit));
- }
- if (0 === kind || 1 === kind) {
- if (void 0 === init) init = function init(instance, _init) {
- return _init;
- };else if ("function" != typeof init) {
- var ownInitializers = init;
- init = function init(instance, _init2) {
- for (var value = _init2, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value);
- return value;
- };
- } else {
- var originalInitializer = init;
- init = function init(instance, _init3) {
- return originalInitializer.call(instance, _init3);
- };
- }
- ret.push(init);
- }
- 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) {
- return value.get.call(instance, args);
- }), ret.push(function (instance, args) {
- return value.set.call(instance, args);
- })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) {
- return value.call(instance, args);
- }) : Object.defineProperty(base, name, desc));
-}
-function applyMemberDecs(ret, Class, decInfos) {
- for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) {
- var decInfo = decInfos[i];
- if (Array.isArray(decInfo)) {
- var base,
- initializers,
- kind = decInfo[1],
- name = decInfo[2],
- isPrivate = decInfo.length > 3,
- isStatic = kind >= 5;
- if (isStatic ? (base = Class, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) {
- var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields,
- existingKind = existingNonFields.get(name) || 0;
- if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
- !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0);
- }
- applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers);
- }
- }
- pushInitializers(ret, protoInitializers), pushInitializers(ret, staticInitializers);
-}
-function pushInitializers(ret, initializers) {
- initializers && ret.push(function (instance) {
- for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
- return instance;
- });
-}
-function applyClassDecs(ret, targetClass, classDecs) {
- if (classDecs.length > 0) {
- for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) {
- var decoratorFinishedRef = {
- v: !1
- };
- try {
- var nextNewClass = classDecs[i](newClass, {
- kind: "class",
- name: name,
- addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef)
- });
- } finally {
- decoratorFinishedRef.v = !0;
- }
- void 0 !== nextNewClass && (assertValidReturnValue(10, nextNewClass), newClass = nextNewClass);
- }
- ret.push(newClass, function () {
- for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass);
- });
- }
-}
-function applyDecs2203(targetClass, memberDecs, classDecs) {
- var ret = [];
- return applyMemberDecs(ret, targetClass, memberDecs), applyClassDecs(ret, targetClass, classDecs), ret;
-}
-module.exports = applyDecs2203, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/arrayLikeToArray.js b/project starter code/node_modules/@babel/runtime/helpers/arrayLikeToArray.js
deleted file mode 100644
index 36865401..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/arrayLikeToArray.js
+++ /dev/null
@@ -1,6 +0,0 @@
-function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length) len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
- return arr2;
-}
-module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/arrayWithHoles.js b/project starter code/node_modules/@babel/runtime/helpers/arrayWithHoles.js
deleted file mode 100644
index ad0cc6b9..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/arrayWithHoles.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _arrayWithHoles(arr) {
- if (Array.isArray(arr)) return arr;
-}
-module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js b/project starter code/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js
deleted file mode 100644
index 6d4b76de..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var arrayLikeToArray = require("./arrayLikeToArray.js");
-function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) return arrayLikeToArray(arr);
-}
-module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/assertThisInitialized.js b/project starter code/node_modules/@babel/runtime/helpers/assertThisInitialized.js
deleted file mode 100644
index 71487e57..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/assertThisInitialized.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function _assertThisInitialized(self) {
- if (self === void 0) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return self;
-}
-module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js b/project starter code/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
deleted file mode 100644
index c272bcde..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js
+++ /dev/null
@@ -1,24 +0,0 @@
-var OverloadYield = require("./OverloadYield.js");
-function _asyncGeneratorDelegate(inner) {
- var iter = {},
- waiting = !1;
- function pump(key, value) {
- return waiting = !0, value = new Promise(function (resolve) {
- resolve(inner[key](value));
- }), {
- done: !1,
- value: new OverloadYield(value, 1)
- };
- }
- return iter["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () {
- return this;
- }, iter.next = function (value) {
- return waiting ? (waiting = !1, value) : pump("next", value);
- }, "function" == typeof inner["throw"] && (iter["throw"] = function (value) {
- if (waiting) throw waiting = !1, value;
- return pump("throw", value);
- }), "function" == typeof inner["return"] && (iter["return"] = function (value) {
- return waiting ? (waiting = !1, value) : pump("return", value);
- }), iter;
-}
-module.exports = _asyncGeneratorDelegate, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/asyncIterator.js b/project starter code/node_modules/@babel/runtime/helpers/asyncIterator.js
deleted file mode 100644
index 420ef080..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/asyncIterator.js
+++ /dev/null
@@ -1,45 +0,0 @@
-function _asyncIterator(iterable) {
- var method,
- async,
- sync,
- retry = 2;
- for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) {
- if (async && null != (method = iterable[async])) return method.call(iterable);
- if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable));
- async = "@@asyncIterator", sync = "@@iterator";
- }
- throw new TypeError("Object is not async iterable");
-}
-function AsyncFromSyncIterator(s) {
- function AsyncFromSyncIteratorContinuation(r) {
- if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
- var done = r.done;
- return Promise.resolve(r.value).then(function (value) {
- return {
- value: value,
- done: done
- };
- });
- }
- return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) {
- this.s = s, this.n = s.next;
- }, AsyncFromSyncIterator.prototype = {
- s: null,
- n: null,
- next: function next() {
- return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
- },
- "return": function _return(value) {
- var ret = this.s["return"];
- return void 0 === ret ? Promise.resolve({
- value: value,
- done: !0
- }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
- },
- "throw": function _throw(value) {
- var thr = this.s["return"];
- return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
- }
- }, new AsyncFromSyncIterator(s);
-}
-module.exports = _asyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/asyncToGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/asyncToGenerator.js
deleted file mode 100644
index 6b9697af..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/asyncToGenerator.js
+++ /dev/null
@@ -1,31 +0,0 @@
-function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
- try {
- var info = gen[key](arg);
- var value = info.value;
- } catch (error) {
- reject(error);
- return;
- }
- if (info.done) {
- resolve(value);
- } else {
- Promise.resolve(value).then(_next, _throw);
- }
-}
-function _asyncToGenerator(fn) {
- return function () {
- var self = this,
- args = arguments;
- return new Promise(function (resolve, reject) {
- var gen = fn.apply(self, args);
- function _next(value) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
- }
- function _throw(err) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
- }
- _next(undefined);
- });
- };
-}
-module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js
deleted file mode 100644
index 7d4e9511..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var OverloadYield = require("./OverloadYield.js");
-function _awaitAsyncGenerator(value) {
- return new OverloadYield(value, 0);
-}
-module.exports = _awaitAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/checkInRHS.js b/project starter code/node_modules/@babel/runtime/helpers/checkInRHS.js
deleted file mode 100644
index e6ba6389..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/checkInRHS.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var _typeof = require("./typeof.js")["default"];
-function _checkInRHS(value) {
- if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== value ? _typeof(value) : "null"));
- return value;
-}
-module.exports = _checkInRHS, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js b/project starter code/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js
deleted file mode 100644
index 1bbfd346..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js
+++ /dev/null
@@ -1,6 +0,0 @@
-function _checkPrivateRedeclaration(obj, privateCollection) {
- if (privateCollection.has(obj)) {
- throw new TypeError("Cannot initialize the same private elements twice on an object");
- }
-}
-module.exports = _checkPrivateRedeclaration, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js
deleted file mode 100644
index 3ebfed87..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js
+++ /dev/null
@@ -1,18 +0,0 @@
-function _classApplyDescriptorDestructureSet(receiver, descriptor) {
- if (descriptor.set) {
- if (!("__destrObj" in descriptor)) {
- descriptor.__destrObj = {
- set value(v) {
- descriptor.set.call(receiver, v);
- }
- };
- }
- return descriptor.__destrObj;
- } else {
- if (!descriptor.writable) {
- throw new TypeError("attempted to set read only private field");
- }
- return descriptor;
- }
-}
-module.exports = _classApplyDescriptorDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js b/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js
deleted file mode 100644
index af3555da..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function _classApplyDescriptorGet(receiver, descriptor) {
- if (descriptor.get) {
- return descriptor.get.call(receiver);
- }
- return descriptor.value;
-}
-module.exports = _classApplyDescriptorGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js b/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js
deleted file mode 100644
index 71bbf1df..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js
+++ /dev/null
@@ -1,11 +0,0 @@
-function _classApplyDescriptorSet(receiver, descriptor, value) {
- if (descriptor.set) {
- descriptor.set.call(receiver, value);
- } else {
- if (!descriptor.writable) {
- throw new TypeError("attempted to set read only private field");
- }
- descriptor.value = value;
- }
-}
-module.exports = _classApplyDescriptorSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classCallCheck.js b/project starter code/node_modules/@babel/runtime/helpers/classCallCheck.js
deleted file mode 100644
index eab7e520..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classCallCheck.js
+++ /dev/null
@@ -1,6 +0,0 @@
-function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
-}
-module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js b/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js
deleted file mode 100644
index 34876843..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js
+++ /dev/null
@@ -1,6 +0,0 @@
-function _classCheckPrivateStaticAccess(receiver, classConstructor) {
- if (receiver !== classConstructor) {
- throw new TypeError("Private static access of wrong provenance");
- }
-}
-module.exports = _classCheckPrivateStaticAccess, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js
deleted file mode 100644
index b937d15e..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js
+++ /dev/null
@@ -1,6 +0,0 @@
-function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
- if (descriptor === undefined) {
- throw new TypeError("attempted to " + action + " private static field before its declaration");
- }
-}
-module.exports = _classCheckPrivateStaticFieldDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js
deleted file mode 100644
index e6f4725a..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function _classExtractFieldDescriptor(receiver, privateMap, action) {
- if (!privateMap.has(receiver)) {
- throw new TypeError("attempted to " + action + " private field on non-instance");
- }
- return privateMap.get(receiver);
-}
-module.exports = _classExtractFieldDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classNameTDZError.js b/project starter code/node_modules/@babel/runtime/helpers/classNameTDZError.js
deleted file mode 100644
index 9f84697a..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classNameTDZError.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _classNameTDZError(name) {
- throw new ReferenceError("Class \"" + name + "\" cannot be referenced in computed property keys.");
-}
-module.exports = _classNameTDZError, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js
deleted file mode 100644
index 07f777df..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js");
-var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js");
-function _classPrivateFieldDestructureSet(receiver, privateMap) {
- var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set");
- return classApplyDescriptorDestructureSet(receiver, descriptor);
-}
-module.exports = _classPrivateFieldDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js
deleted file mode 100644
index a67951e1..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var classApplyDescriptorGet = require("./classApplyDescriptorGet.js");
-var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js");
-function _classPrivateFieldGet(receiver, privateMap) {
- var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get");
- return classApplyDescriptorGet(receiver, descriptor);
-}
-module.exports = _classPrivateFieldGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js
deleted file mode 100644
index e55873a1..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js");
-function _classPrivateFieldInitSpec(obj, privateMap, value) {
- checkPrivateRedeclaration(obj, privateMap);
- privateMap.set(obj, value);
-}
-module.exports = _classPrivateFieldInitSpec, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js
deleted file mode 100644
index bb16c0bc..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function _classPrivateFieldBase(receiver, privateKey) {
- if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
- throw new TypeError("attempted to use private field on non-instance");
- }
- return receiver;
-}
-module.exports = _classPrivateFieldBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js
deleted file mode 100644
index b3d546f1..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var id = 0;
-function _classPrivateFieldKey(name) {
- return "__private_" + id++ + "_" + name;
-}
-module.exports = _classPrivateFieldKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js
deleted file mode 100644
index ffb73a10..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var classApplyDescriptorSet = require("./classApplyDescriptorSet.js");
-var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js");
-function _classPrivateFieldSet(receiver, privateMap, value) {
- var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set");
- classApplyDescriptorSet(receiver, descriptor, value);
- return value;
-}
-module.exports = _classPrivateFieldSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js
deleted file mode 100644
index 6a8436da..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function _classPrivateMethodGet(receiver, privateSet, fn) {
- if (!privateSet.has(receiver)) {
- throw new TypeError("attempted to get private field on non-instance");
- }
- return fn;
-}
-module.exports = _classPrivateMethodGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js
deleted file mode 100644
index 31064767..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js");
-function _classPrivateMethodInitSpec(obj, privateSet) {
- checkPrivateRedeclaration(obj, privateSet);
- privateSet.add(obj);
-}
-module.exports = _classPrivateMethodInitSpec, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js
deleted file mode 100644
index a44fd785..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _classPrivateMethodSet() {
- throw new TypeError("attempted to reassign private method");
-}
-module.exports = _classPrivateMethodSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js
deleted file mode 100644
index 734aaafa..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js");
-var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js");
-var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js");
-function _classStaticPrivateFieldDestructureSet(receiver, classConstructor, descriptor) {
- classCheckPrivateStaticAccess(receiver, classConstructor);
- classCheckPrivateStaticFieldDescriptor(descriptor, "set");
- return classApplyDescriptorDestructureSet(receiver, descriptor);
-}
-module.exports = _classStaticPrivateFieldDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js
deleted file mode 100644
index e8e295f4..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var classApplyDescriptorGet = require("./classApplyDescriptorGet.js");
-var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js");
-var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js");
-function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
- classCheckPrivateStaticAccess(receiver, classConstructor);
- classCheckPrivateStaticFieldDescriptor(descriptor, "get");
- return classApplyDescriptorGet(receiver, descriptor);
-}
-module.exports = _classStaticPrivateFieldSpecGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js
deleted file mode 100644
index b02e4c01..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var classApplyDescriptorSet = require("./classApplyDescriptorSet.js");
-var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js");
-var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js");
-function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) {
- classCheckPrivateStaticAccess(receiver, classConstructor);
- classCheckPrivateStaticFieldDescriptor(descriptor, "set");
- classApplyDescriptorSet(receiver, descriptor, value);
- return value;
-}
-module.exports = _classStaticPrivateFieldSpecSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js
deleted file mode 100644
index d3bb9968..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js");
-function _classStaticPrivateMethodGet(receiver, classConstructor, method) {
- classCheckPrivateStaticAccess(receiver, classConstructor);
- return method;
-}
-module.exports = _classStaticPrivateMethodGet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js
deleted file mode 100644
index 72560e66..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _classStaticPrivateMethodSet() {
- throw new TypeError("attempted to set read only static private field");
-}
-module.exports = _classStaticPrivateMethodSet, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/construct.js b/project starter code/node_modules/@babel/runtime/helpers/construct.js
deleted file mode 100644
index 3d3c232d..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/construct.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var setPrototypeOf = require("./setPrototypeOf.js");
-var isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
-function _construct(Parent, args, Class) {
- if (isNativeReflectConstruct()) {
- module.exports = _construct = Reflect.construct.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports;
- } else {
- module.exports = _construct = function _construct(Parent, args, Class) {
- var a = [null];
- a.push.apply(a, args);
- var Constructor = Function.bind.apply(Parent, a);
- var instance = new Constructor();
- if (Class) setPrototypeOf(instance, Class.prototype);
- return instance;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- }
- return _construct.apply(null, arguments);
-}
-module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/createClass.js b/project starter code/node_modules/@babel/runtime/helpers/createClass.js
deleted file mode 100644
index 201dcdf4..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/createClass.js
+++ /dev/null
@@ -1,19 +0,0 @@
-var toPropertyKey = require("./toPropertyKey.js");
-function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
- }
-}
-function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", {
- writable: false
- });
- return Constructor;
-}
-module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js b/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js
deleted file mode 100644
index 19b6f141..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js
+++ /dev/null
@@ -1,53 +0,0 @@
-var unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
-function _createForOfIteratorHelper(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (!it) {
- if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it) o = it;
- var i = 0;
- var F = function F() {};
- return {
- s: F,
- n: function n() {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- },
- e: function e(_e) {
- throw _e;
- },
- f: F
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- var normalCompletion = true,
- didErr = false,
- err;
- return {
- s: function s() {
- it = it.call(o);
- },
- n: function n() {
- var step = it.next();
- normalCompletion = step.done;
- return step;
- },
- e: function e(_e2) {
- didErr = true;
- err = _e2;
- },
- f: function f() {
- try {
- if (!normalCompletion && it["return"] != null) it["return"]();
- } finally {
- if (didErr) throw err;
- }
- }
- };
-}
-module.exports = _createForOfIteratorHelper, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js b/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js
deleted file mode 100644
index b8eb5507..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js
+++ /dev/null
@@ -1,20 +0,0 @@
-var unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
-function _createForOfIteratorHelperLoose(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it) return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it) o = it;
- var i = 0;
- return function () {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-module.exports = _createForOfIteratorHelperLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/createSuper.js b/project starter code/node_modules/@babel/runtime/helpers/createSuper.js
deleted file mode 100644
index bd72679c..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/createSuper.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var getPrototypeOf = require("./getPrototypeOf.js");
-var isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
-var possibleConstructorReturn = require("./possibleConstructorReturn.js");
-function _createSuper(Derived) {
- var hasNativeReflectConstruct = isNativeReflectConstruct();
- return function _createSuperInternal() {
- var Super = getPrototypeOf(Derived),
- result;
- if (hasNativeReflectConstruct) {
- var NewTarget = getPrototypeOf(this).constructor;
- result = Reflect.construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
- return possibleConstructorReturn(this, result);
- };
-}
-module.exports = _createSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/decorate.js b/project starter code/node_modules/@babel/runtime/helpers/decorate.js
deleted file mode 100644
index 457741fb..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/decorate.js
+++ /dev/null
@@ -1,343 +0,0 @@
-var toArray = require("./toArray.js");
-var toPropertyKey = require("./toPropertyKey.js");
-function _decorate(decorators, factory, superClass, mixins) {
- var api = _getDecoratorsApi();
- if (mixins) {
- for (var i = 0; i < mixins.length; i++) {
- api = mixins[i](api);
- }
- }
- var r = factory(function initialize(O) {
- api.initializeInstanceElements(O, decorated.elements);
- }, superClass);
- var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators);
- api.initializeClassElements(r.F, decorated.elements);
- return api.runClassFinishers(r.F, decorated.finishers);
-}
-function _getDecoratorsApi() {
- _getDecoratorsApi = function _getDecoratorsApi() {
- return api;
- };
- var api = {
- elementsDefinitionOrder: [["method"], ["field"]],
- initializeInstanceElements: function initializeInstanceElements(O, elements) {
- ["method", "field"].forEach(function (kind) {
- elements.forEach(function (element) {
- if (element.kind === kind && element.placement === "own") {
- this.defineClassElement(O, element);
- }
- }, this);
- }, this);
- },
- initializeClassElements: function initializeClassElements(F, elements) {
- var proto = F.prototype;
- ["method", "field"].forEach(function (kind) {
- elements.forEach(function (element) {
- var placement = element.placement;
- if (element.kind === kind && (placement === "static" || placement === "prototype")) {
- var receiver = placement === "static" ? F : proto;
- this.defineClassElement(receiver, element);
- }
- }, this);
- }, this);
- },
- defineClassElement: function defineClassElement(receiver, element) {
- var descriptor = element.descriptor;
- if (element.kind === "field") {
- var initializer = element.initializer;
- descriptor = {
- enumerable: descriptor.enumerable,
- writable: descriptor.writable,
- configurable: descriptor.configurable,
- value: initializer === void 0 ? void 0 : initializer.call(receiver)
- };
- }
- Object.defineProperty(receiver, element.key, descriptor);
- },
- decorateClass: function decorateClass(elements, decorators) {
- var newElements = [];
- var finishers = [];
- var placements = {
- "static": [],
- prototype: [],
- own: []
- };
- elements.forEach(function (element) {
- this.addElementPlacement(element, placements);
- }, this);
- elements.forEach(function (element) {
- if (!_hasDecorators(element)) return newElements.push(element);
- var elementFinishersExtras = this.decorateElement(element, placements);
- newElements.push(elementFinishersExtras.element);
- newElements.push.apply(newElements, elementFinishersExtras.extras);
- finishers.push.apply(finishers, elementFinishersExtras.finishers);
- }, this);
- if (!decorators) {
- return {
- elements: newElements,
- finishers: finishers
- };
- }
- var result = this.decorateConstructor(newElements, decorators);
- finishers.push.apply(finishers, result.finishers);
- result.finishers = finishers;
- return result;
- },
- addElementPlacement: function addElementPlacement(element, placements, silent) {
- var keys = placements[element.placement];
- if (!silent && keys.indexOf(element.key) !== -1) {
- throw new TypeError("Duplicated element (" + element.key + ")");
- }
- keys.push(element.key);
- },
- decorateElement: function decorateElement(element, placements) {
- var extras = [];
- var finishers = [];
- for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) {
- var keys = placements[element.placement];
- keys.splice(keys.indexOf(element.key), 1);
- var elementObject = this.fromElementDescriptor(element);
- var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject);
- element = elementFinisherExtras.element;
- this.addElementPlacement(element, placements);
- if (elementFinisherExtras.finisher) {
- finishers.push(elementFinisherExtras.finisher);
- }
- var newExtras = elementFinisherExtras.extras;
- if (newExtras) {
- for (var j = 0; j < newExtras.length; j++) {
- this.addElementPlacement(newExtras[j], placements);
- }
- extras.push.apply(extras, newExtras);
- }
- }
- return {
- element: element,
- finishers: finishers,
- extras: extras
- };
- },
- decorateConstructor: function decorateConstructor(elements, decorators) {
- var finishers = [];
- for (var i = decorators.length - 1; i >= 0; i--) {
- var obj = this.fromClassDescriptor(elements);
- var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj);
- if (elementsAndFinisher.finisher !== undefined) {
- finishers.push(elementsAndFinisher.finisher);
- }
- if (elementsAndFinisher.elements !== undefined) {
- elements = elementsAndFinisher.elements;
- for (var j = 0; j < elements.length - 1; j++) {
- for (var k = j + 1; k < elements.length; k++) {
- if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) {
- throw new TypeError("Duplicated element (" + elements[j].key + ")");
- }
- }
- }
- }
- }
- return {
- elements: elements,
- finishers: finishers
- };
- },
- fromElementDescriptor: function fromElementDescriptor(element) {
- var obj = {
- kind: element.kind,
- key: element.key,
- placement: element.placement,
- descriptor: element.descriptor
- };
- var desc = {
- value: "Descriptor",
- configurable: true
- };
- Object.defineProperty(obj, Symbol.toStringTag, desc);
- if (element.kind === "field") obj.initializer = element.initializer;
- return obj;
- },
- toElementDescriptors: function toElementDescriptors(elementObjects) {
- if (elementObjects === undefined) return;
- return toArray(elementObjects).map(function (elementObject) {
- var element = this.toElementDescriptor(elementObject);
- this.disallowProperty(elementObject, "finisher", "An element descriptor");
- this.disallowProperty(elementObject, "extras", "An element descriptor");
- return element;
- }, this);
- },
- toElementDescriptor: function toElementDescriptor(elementObject) {
- var kind = String(elementObject.kind);
- if (kind !== "method" && kind !== "field") {
- throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"');
- }
- var key = toPropertyKey(elementObject.key);
- var placement = String(elementObject.placement);
- if (placement !== "static" && placement !== "prototype" && placement !== "own") {
- throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"');
- }
- var descriptor = elementObject.descriptor;
- this.disallowProperty(elementObject, "elements", "An element descriptor");
- var element = {
- kind: kind,
- key: key,
- placement: placement,
- descriptor: Object.assign({}, descriptor)
- };
- if (kind !== "field") {
- this.disallowProperty(elementObject, "initializer", "A method descriptor");
- } else {
- this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
- this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
- this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
- element.initializer = elementObject.initializer;
- }
- return element;
- },
- toElementFinisherExtras: function toElementFinisherExtras(elementObject) {
- var element = this.toElementDescriptor(elementObject);
- var finisher = _optionalCallableProperty(elementObject, "finisher");
- var extras = this.toElementDescriptors(elementObject.extras);
- return {
- element: element,
- finisher: finisher,
- extras: extras
- };
- },
- fromClassDescriptor: function fromClassDescriptor(elements) {
- var obj = {
- kind: "class",
- elements: elements.map(this.fromElementDescriptor, this)
- };
- var desc = {
- value: "Descriptor",
- configurable: true
- };
- Object.defineProperty(obj, Symbol.toStringTag, desc);
- return obj;
- },
- toClassDescriptor: function toClassDescriptor(obj) {
- var kind = String(obj.kind);
- if (kind !== "class") {
- throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"');
- }
- this.disallowProperty(obj, "key", "A class descriptor");
- this.disallowProperty(obj, "placement", "A class descriptor");
- this.disallowProperty(obj, "descriptor", "A class descriptor");
- this.disallowProperty(obj, "initializer", "A class descriptor");
- this.disallowProperty(obj, "extras", "A class descriptor");
- var finisher = _optionalCallableProperty(obj, "finisher");
- var elements = this.toElementDescriptors(obj.elements);
- return {
- elements: elements,
- finisher: finisher
- };
- },
- runClassFinishers: function runClassFinishers(constructor, finishers) {
- for (var i = 0; i < finishers.length; i++) {
- var newConstructor = (0, finishers[i])(constructor);
- if (newConstructor !== undefined) {
- if (typeof newConstructor !== "function") {
- throw new TypeError("Finishers must return a constructor.");
- }
- constructor = newConstructor;
- }
- }
- return constructor;
- },
- disallowProperty: function disallowProperty(obj, name, objectType) {
- if (obj[name] !== undefined) {
- throw new TypeError(objectType + " can't have a ." + name + " property.");
- }
- }
- };
- return api;
-}
-function _createElementDescriptor(def) {
- var key = toPropertyKey(def.key);
- var descriptor;
- if (def.kind === "method") {
- descriptor = {
- value: def.value,
- writable: true,
- configurable: true,
- enumerable: false
- };
- } else if (def.kind === "get") {
- descriptor = {
- get: def.value,
- configurable: true,
- enumerable: false
- };
- } else if (def.kind === "set") {
- descriptor = {
- set: def.value,
- configurable: true,
- enumerable: false
- };
- } else if (def.kind === "field") {
- descriptor = {
- configurable: true,
- writable: true,
- enumerable: true
- };
- }
- var element = {
- kind: def.kind === "field" ? "field" : "method",
- key: key,
- placement: def["static"] ? "static" : def.kind === "field" ? "own" : "prototype",
- descriptor: descriptor
- };
- if (def.decorators) element.decorators = def.decorators;
- if (def.kind === "field") element.initializer = def.value;
- return element;
-}
-function _coalesceGetterSetter(element, other) {
- if (element.descriptor.get !== undefined) {
- other.descriptor.get = element.descriptor.get;
- } else {
- other.descriptor.set = element.descriptor.set;
- }
-}
-function _coalesceClassElements(elements) {
- var newElements = [];
- var isSameElement = function isSameElement(other) {
- return other.kind === "method" && other.key === element.key && other.placement === element.placement;
- };
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- var other;
- if (element.kind === "method" && (other = newElements.find(isSameElement))) {
- if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) {
- if (_hasDecorators(element) || _hasDecorators(other)) {
- throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated.");
- }
- other.descriptor = element.descriptor;
- } else {
- if (_hasDecorators(element)) {
- if (_hasDecorators(other)) {
- throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ").");
- }
- other.decorators = element.decorators;
- }
- _coalesceGetterSetter(element, other);
- }
- } else {
- newElements.push(element);
- }
- }
- return newElements;
-}
-function _hasDecorators(element) {
- return element.decorators && element.decorators.length;
-}
-function _isDataDescriptor(desc) {
- return desc !== undefined && !(desc.value === undefined && desc.writable === undefined);
-}
-function _optionalCallableProperty(obj, name) {
- var value = obj[name];
- if (value !== undefined && typeof value !== "function") {
- throw new TypeError("Expected '" + name + "' to be a function");
- }
- return value;
-}
-module.exports = _decorate, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/defaults.js b/project starter code/node_modules/@babel/runtime/helpers/defaults.js
deleted file mode 100644
index 86641e9c..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/defaults.js
+++ /dev/null
@@ -1,12 +0,0 @@
-function _defaults(obj, defaults) {
- var keys = Object.getOwnPropertyNames(defaults);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- var value = Object.getOwnPropertyDescriptor(defaults, key);
- if (value && value.configurable && obj[key] === undefined) {
- Object.defineProperty(obj, key, value);
- }
- }
- return obj;
-}
-module.exports = _defaults, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/defineAccessor.js b/project starter code/node_modules/@babel/runtime/helpers/defineAccessor.js
deleted file mode 100644
index c7224271..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/defineAccessor.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function _defineAccessor(type, obj, key, fn) {
- var desc = {
- configurable: !0,
- enumerable: !0
- };
- return desc[type] = fn, Object.defineProperty(obj, key, desc);
-}
-module.exports = _defineAccessor, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js b/project starter code/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js
deleted file mode 100644
index a04e6028..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js
+++ /dev/null
@@ -1,20 +0,0 @@
-function _defineEnumerableProperties(obj, descs) {
- for (var key in descs) {
- var desc = descs[key];
- desc.configurable = desc.enumerable = true;
- if ("value" in desc) desc.writable = true;
- Object.defineProperty(obj, key, desc);
- }
- if (Object.getOwnPropertySymbols) {
- var objectSymbols = Object.getOwnPropertySymbols(descs);
- for (var i = 0; i < objectSymbols.length; i++) {
- var sym = objectSymbols[i];
- var desc = descs[sym];
- desc.configurable = desc.enumerable = true;
- if ("value" in desc) desc.writable = true;
- Object.defineProperty(obj, sym, desc);
- }
- }
- return obj;
-}
-module.exports = _defineEnumerableProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/defineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/defineProperty.js
deleted file mode 100644
index 8762046d..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/defineProperty.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var toPropertyKey = require("./toPropertyKey.js");
-function _defineProperty(obj, key, value) {
- key = toPropertyKey(key);
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
-}
-module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js
deleted file mode 100644
index 5df93d44..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js
+++ /dev/null
@@ -1,63 +0,0 @@
-import OverloadYield from "./OverloadYield.js";
-export default function AsyncGenerator(gen) {
- var front, back;
- function resume(key, arg) {
- try {
- var result = gen[key](arg),
- value = result.value,
- overloaded = value instanceof OverloadYield;
- Promise.resolve(overloaded ? value.v : value).then(function (arg) {
- if (overloaded) {
- var nextKey = "return" === key ? "return" : "next";
- if (!value.k || arg.done) return resume(nextKey, arg);
- arg = gen[nextKey](arg).value;
- }
- settle(result.done ? "return" : "normal", arg);
- }, function (err) {
- resume("throw", err);
- });
- } catch (err) {
- settle("throw", err);
- }
- }
- function settle(type, value) {
- switch (type) {
- case "return":
- front.resolve({
- value: value,
- done: !0
- });
- break;
- case "throw":
- front.reject(value);
- break;
- default:
- front.resolve({
- value: value,
- done: !1
- });
- }
- (front = front.next) ? resume(front.key, front.arg) : back = null;
- }
- this._invoke = function (key, arg) {
- return new Promise(function (resolve, reject) {
- var request = {
- key: key,
- arg: arg,
- resolve: resolve,
- reject: reject,
- next: null
- };
- back ? back = back.next = request : (front = back = request, resume(key, arg));
- });
- }, "function" != typeof gen["return"] && (this["return"] = void 0);
-}
-AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () {
- return this;
-}, AsyncGenerator.prototype.next = function (arg) {
- return this._invoke("next", arg);
-}, AsyncGenerator.prototype["throw"] = function (arg) {
- return this._invoke("throw", arg);
-}, AsyncGenerator.prototype["return"] = function (arg) {
- return this._invoke("return", arg);
-};
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/AwaitValue.js b/project starter code/node_modules/@babel/runtime/helpers/esm/AwaitValue.js
deleted file mode 100644
index 5237e18f..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/AwaitValue.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _AwaitValue(value) {
- this.wrapped = value;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/OverloadYield.js b/project starter code/node_modules/@babel/runtime/helpers/esm/OverloadYield.js
deleted file mode 100644
index 0dd12e01..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/OverloadYield.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _OverloadYield(value, kind) {
- this.v = value, this.k = kind;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js
deleted file mode 100644
index 5137e85f..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js
+++ /dev/null
@@ -1,23 +0,0 @@
-export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
- var desc = {};
- Object.keys(descriptor).forEach(function (key) {
- desc[key] = descriptor[key];
- });
- desc.enumerable = !!desc.enumerable;
- desc.configurable = !!desc.configurable;
- if ('value' in desc || desc.initializer) {
- desc.writable = true;
- }
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
- return decorator(target, property, desc) || desc;
- }, desc);
- if (context && desc.initializer !== void 0) {
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
- desc.initializer = undefined;
- }
- if (desc.initializer === void 0) {
- Object.defineProperty(target, property, desc);
- desc = null;
- }
- return desc;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs.js b/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs.js
deleted file mode 100644
index 84988df3..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs.js
+++ /dev/null
@@ -1,235 +0,0 @@
-import _typeof from "./typeof.js";
-function old_createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) {
- return {
- getMetadata: function getMetadata(key) {
- old_assertNotFinished(decoratorFinishedRef, "getMetadata"), old_assertMetadataKey(key);
- var metadataForKey = metadataMap[key];
- if (void 0 !== metadataForKey) if (1 === kind) {
- var pub = metadataForKey["public"];
- if (void 0 !== pub) return pub[property];
- } else if (2 === kind) {
- var priv = metadataForKey["private"];
- if (void 0 !== priv) return priv.get(property);
- } else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) return metadataForKey.constructor;
- },
- setMetadata: function setMetadata(key, value) {
- old_assertNotFinished(decoratorFinishedRef, "setMetadata"), old_assertMetadataKey(key);
- var metadataForKey = metadataMap[key];
- if (void 0 === metadataForKey && (metadataForKey = metadataMap[key] = {}), 1 === kind) {
- var pub = metadataForKey["public"];
- void 0 === pub && (pub = metadataForKey["public"] = {}), pub[property] = value;
- } else if (2 === kind) {
- var priv = metadataForKey.priv;
- void 0 === priv && (priv = metadataForKey["private"] = new Map()), priv.set(property, value);
- } else metadataForKey.constructor = value;
- }
- };
-}
-function old_convertMetadataMapToFinal(obj, metadataMap) {
- var parentMetadataMap = obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")],
- metadataKeys = Object.getOwnPropertySymbols(metadataMap);
- if (0 !== metadataKeys.length) {
- for (var i = 0; i < metadataKeys.length; i++) {
- var key = metadataKeys[i],
- metaForKey = metadataMap[key],
- parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null,
- pub = metaForKey["public"],
- parentPub = parentMetaForKey ? parentMetaForKey["public"] : null;
- pub && parentPub && Object.setPrototypeOf(pub, parentPub);
- var priv = metaForKey["private"];
- if (priv) {
- var privArr = Array.from(priv.values()),
- parentPriv = parentMetaForKey ? parentMetaForKey["private"] : null;
- parentPriv && (privArr = privArr.concat(parentPriv)), metaForKey["private"] = privArr;
- }
- parentMetaForKey && Object.setPrototypeOf(metaForKey, parentMetaForKey);
- }
- parentMetadataMap && Object.setPrototypeOf(metadataMap, parentMetadataMap), obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = metadataMap;
- }
-}
-function old_createAddInitializerMethod(initializers, decoratorFinishedRef) {
- return function (initializer) {
- old_assertNotFinished(decoratorFinishedRef, "addInitializer"), old_assertCallable(initializer, "An initializer"), initializers.push(initializer);
- };
-}
-function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) {
- var kindStr;
- switch (kind) {
- case 1:
- kindStr = "accessor";
- break;
- case 2:
- kindStr = "method";
- break;
- case 3:
- kindStr = "getter";
- break;
- case 4:
- kindStr = "setter";
- break;
- default:
- kindStr = "field";
- }
- var metadataKind,
- metadataName,
- ctx = {
- kind: kindStr,
- name: isPrivate ? "#" + name : name,
- isStatic: isStatic,
- isPrivate: isPrivate
- },
- decoratorFinishedRef = {
- v: !1
- };
- if (0 !== kind && (ctx.addInitializer = old_createAddInitializerMethod(initializers, decoratorFinishedRef)), isPrivate) {
- metadataKind = 2, metadataName = Symbol(name);
- var access = {};
- 0 === kind ? (access.get = desc.get, access.set = desc.set) : 2 === kind ? access.get = function () {
- return desc.value;
- } : (1 !== kind && 3 !== kind || (access.get = function () {
- return desc.get.call(this);
- }), 1 !== kind && 4 !== kind || (access.set = function (v) {
- desc.set.call(this, v);
- })), ctx.access = access;
- } else metadataKind = 1, metadataName = name;
- try {
- return dec(value, Object.assign(ctx, old_createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef)));
- } finally {
- decoratorFinishedRef.v = !0;
- }
-}
-function old_assertNotFinished(decoratorFinishedRef, fnName) {
- if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
-}
-function old_assertMetadataKey(key) {
- if ("symbol" != _typeof(key)) throw new TypeError("Metadata keys must be symbols, received: " + key);
-}
-function old_assertCallable(fn, hint) {
- if ("function" != typeof fn) throw new TypeError(hint + " must be a function");
-}
-function old_assertValidReturnValue(kind, value) {
- var type = _typeof(value);
- if (1 === kind) {
- if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
- void 0 !== value.get && old_assertCallable(value.get, "accessor.get"), void 0 !== value.set && old_assertCallable(value.set, "accessor.set"), void 0 !== value.init && old_assertCallable(value.init, "accessor.init"), void 0 !== value.initializer && old_assertCallable(value.initializer, "accessor.initializer");
- } else if ("function" !== type) {
- var hint;
- throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0");
- }
-}
-function old_getInit(desc) {
- var initializer;
- return null == (initializer = desc.init) && (initializer = desc.initializer) && "undefined" != typeof console && console.warn(".initializer has been renamed to .init as of March 2022"), initializer;
-}
-function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) {
- var desc,
- initializer,
- value,
- newValue,
- get,
- set,
- decs = decInfo[0];
- if (isPrivate ? desc = 0 === kind || 1 === kind ? {
- get: decInfo[3],
- set: decInfo[4]
- } : 3 === kind ? {
- get: decInfo[3]
- } : 4 === kind ? {
- set: decInfo[3]
- } : {
- value: decInfo[3]
- } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = {
- get: desc.get,
- set: desc.set
- } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = old_memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value)) && (old_assertValidReturnValue(kind, newValue), 0 === kind ? initializer = newValue : 1 === kind ? (initializer = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = {
- get: get,
- set: set
- }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) {
- var newInit;
- if (void 0 !== (newValue = old_memberDec(decs[i], name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value))) old_assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = {
- get: get,
- set: set
- }) : value = newValue, void 0 !== newInit && (void 0 === initializer ? initializer = newInit : "function" == typeof initializer ? initializer = [initializer, newInit] : initializer.push(newInit));
- }
- if (0 === kind || 1 === kind) {
- if (void 0 === initializer) initializer = function initializer(instance, init) {
- return init;
- };else if ("function" != typeof initializer) {
- var ownInitializers = initializer;
- initializer = function initializer(instance, init) {
- for (var value = init, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value);
- return value;
- };
- } else {
- var originalInitializer = initializer;
- initializer = function initializer(instance, init) {
- return originalInitializer.call(instance, init);
- };
- }
- ret.push(initializer);
- }
- 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) {
- return value.get.call(instance, args);
- }), ret.push(function (instance, args) {
- return value.set.call(instance, args);
- })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) {
- return value.call(instance, args);
- }) : Object.defineProperty(base, name, desc));
-}
-function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) {
- for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) {
- var decInfo = decInfos[i];
- if (Array.isArray(decInfo)) {
- var base,
- metadataMap,
- initializers,
- kind = decInfo[1],
- name = decInfo[2],
- isPrivate = decInfo.length > 3,
- isStatic = kind >= 5;
- if (isStatic ? (base = Class, metadataMap = staticMetadataMap, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, metadataMap = protoMetadataMap, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) {
- var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields,
- existingKind = existingNonFields.get(name) || 0;
- if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
- !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0);
- }
- old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers);
- }
- }
- old_pushInitializers(ret, protoInitializers), old_pushInitializers(ret, staticInitializers);
-}
-function old_pushInitializers(ret, initializers) {
- initializers && ret.push(function (instance) {
- for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
- return instance;
- });
-}
-function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) {
- if (classDecs.length > 0) {
- for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) {
- var decoratorFinishedRef = {
- v: !1
- };
- try {
- var ctx = Object.assign({
- kind: "class",
- name: name,
- addInitializer: old_createAddInitializerMethod(initializers, decoratorFinishedRef)
- }, old_createMetadataMethodsForProperty(metadataMap, 0, name, decoratorFinishedRef)),
- nextNewClass = classDecs[i](newClass, ctx);
- } finally {
- decoratorFinishedRef.v = !0;
- }
- void 0 !== nextNewClass && (old_assertValidReturnValue(10, nextNewClass), newClass = nextNewClass);
- }
- ret.push(newClass, function () {
- for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass);
- });
- }
-}
-export default function applyDecs(targetClass, memberDecs, classDecs) {
- var ret = [],
- staticMetadataMap = {},
- protoMetadataMap = {};
- return old_applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs), old_convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap), old_applyClassDecs(ret, targetClass, staticMetadataMap, classDecs), old_convertMetadataMapToFinal(targetClass, staticMetadataMap), ret;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js b/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js
deleted file mode 100644
index a9f9e80a..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js
+++ /dev/null
@@ -1,183 +0,0 @@
-import _typeof from "./typeof.js";
-function createAddInitializerMethod(initializers, decoratorFinishedRef) {
- return function (initializer) {
- assertNotFinished(decoratorFinishedRef, "addInitializer"), assertCallable(initializer, "An initializer"), initializers.push(initializer);
- };
-}
-function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) {
- var kindStr;
- switch (kind) {
- case 1:
- kindStr = "accessor";
- break;
- case 2:
- kindStr = "method";
- break;
- case 3:
- kindStr = "getter";
- break;
- case 4:
- kindStr = "setter";
- break;
- default:
- kindStr = "field";
- }
- var get,
- set,
- ctx = {
- kind: kindStr,
- name: isPrivate ? "#" + name : name,
- "static": isStatic,
- "private": isPrivate
- },
- decoratorFinishedRef = {
- v: !1
- };
- 0 !== kind && (ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef)), 0 === kind ? isPrivate ? (get = desc.get, set = desc.set) : (get = function get() {
- return this[name];
- }, set = function set(v) {
- this[name] = v;
- }) : 2 === kind ? get = function get() {
- return desc.value;
- } : (1 !== kind && 3 !== kind || (get = function get() {
- return desc.get.call(this);
- }), 1 !== kind && 4 !== kind || (set = function set(v) {
- desc.set.call(this, v);
- })), ctx.access = get && set ? {
- get: get,
- set: set
- } : get ? {
- get: get
- } : {
- set: set
- };
- try {
- return dec(value, ctx);
- } finally {
- decoratorFinishedRef.v = !0;
- }
-}
-function assertNotFinished(decoratorFinishedRef, fnName) {
- if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
-}
-function assertCallable(fn, hint) {
- if ("function" != typeof fn) throw new TypeError(hint + " must be a function");
-}
-function assertValidReturnValue(kind, value) {
- var type = _typeof(value);
- if (1 === kind) {
- if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
- void 0 !== value.get && assertCallable(value.get, "accessor.get"), void 0 !== value.set && assertCallable(value.set, "accessor.set"), void 0 !== value.init && assertCallable(value.init, "accessor.init");
- } else if ("function" !== type) {
- var hint;
- throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0");
- }
-}
-function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) {
- var desc,
- init,
- value,
- newValue,
- get,
- set,
- decs = decInfo[0];
- if (isPrivate ? desc = 0 === kind || 1 === kind ? {
- get: decInfo[3],
- set: decInfo[4]
- } : 3 === kind ? {
- get: decInfo[3]
- } : 4 === kind ? {
- set: decInfo[3]
- } : {
- value: decInfo[3]
- } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = {
- get: desc.get,
- set: desc.set
- } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value)) && (assertValidReturnValue(kind, newValue), 0 === kind ? init = newValue : 1 === kind ? (init = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = {
- get: get,
- set: set
- }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) {
- var newInit;
- if (void 0 !== (newValue = memberDec(decs[i], name, desc, initializers, kind, isStatic, isPrivate, value))) assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = {
- get: get,
- set: set
- }) : value = newValue, void 0 !== newInit && (void 0 === init ? init = newInit : "function" == typeof init ? init = [init, newInit] : init.push(newInit));
- }
- if (0 === kind || 1 === kind) {
- if (void 0 === init) init = function init(instance, _init) {
- return _init;
- };else if ("function" != typeof init) {
- var ownInitializers = init;
- init = function init(instance, _init2) {
- for (var value = _init2, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value);
- return value;
- };
- } else {
- var originalInitializer = init;
- init = function init(instance, _init3) {
- return originalInitializer.call(instance, _init3);
- };
- }
- ret.push(init);
- }
- 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) {
- return value.get.call(instance, args);
- }), ret.push(function (instance, args) {
- return value.set.call(instance, args);
- })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) {
- return value.call(instance, args);
- }) : Object.defineProperty(base, name, desc));
-}
-function applyMemberDecs(ret, Class, decInfos) {
- for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) {
- var decInfo = decInfos[i];
- if (Array.isArray(decInfo)) {
- var base,
- initializers,
- kind = decInfo[1],
- name = decInfo[2],
- isPrivate = decInfo.length > 3,
- isStatic = kind >= 5;
- if (isStatic ? (base = Class, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) {
- var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields,
- existingKind = existingNonFields.get(name) || 0;
- if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
- !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0);
- }
- applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers);
- }
- }
- pushInitializers(ret, protoInitializers), pushInitializers(ret, staticInitializers);
-}
-function pushInitializers(ret, initializers) {
- initializers && ret.push(function (instance) {
- for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
- return instance;
- });
-}
-function applyClassDecs(ret, targetClass, classDecs) {
- if (classDecs.length > 0) {
- for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) {
- var decoratorFinishedRef = {
- v: !1
- };
- try {
- var nextNewClass = classDecs[i](newClass, {
- kind: "class",
- name: name,
- addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef)
- });
- } finally {
- decoratorFinishedRef.v = !0;
- }
- void 0 !== nextNewClass && (assertValidReturnValue(10, nextNewClass), newClass = nextNewClass);
- }
- ret.push(newClass, function () {
- for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass);
- });
- }
-}
-export default function applyDecs2203(targetClass, memberDecs, classDecs) {
- var ret = [];
- return applyMemberDecs(ret, targetClass, memberDecs), applyClassDecs(ret, targetClass, classDecs), ret;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
deleted file mode 100644
index 8a9fad8a..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length) len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
- return arr2;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js b/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
deleted file mode 100644
index be734fc3..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _arrayWithHoles(arr) {
- if (Array.isArray(arr)) return arr;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js b/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
deleted file mode 100644
index f7d8dc78..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import arrayLikeToArray from "./arrayLikeToArray.js";
-export default function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) return arrayLikeToArray(arr);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js b/project starter code/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
deleted file mode 100644
index 1f8fcf4b..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export default function _assertThisInitialized(self) {
- if (self === void 0) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return self;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js b/project starter code/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js
deleted file mode 100644
index d393d55b..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import OverloadYield from "./OverloadYield.js";
-export default function _asyncGeneratorDelegate(inner) {
- var iter = {},
- waiting = !1;
- function pump(key, value) {
- return waiting = !0, value = new Promise(function (resolve) {
- resolve(inner[key](value));
- }), {
- done: !1,
- value: new OverloadYield(value, 1)
- };
- }
- return iter["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () {
- return this;
- }, iter.next = function (value) {
- return waiting ? (waiting = !1, value) : pump("next", value);
- }, "function" == typeof inner["throw"] && (iter["throw"] = function (value) {
- if (waiting) throw waiting = !1, value;
- return pump("throw", value);
- }), "function" == typeof inner["return"] && (iter["return"] = function (value) {
- return waiting ? (waiting = !1, value) : pump("return", value);
- }), iter;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncIterator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/asyncIterator.js
deleted file mode 100644
index ae8aa397..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncIterator.js
+++ /dev/null
@@ -1,44 +0,0 @@
-export default function _asyncIterator(iterable) {
- var method,
- async,
- sync,
- retry = 2;
- for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) {
- if (async && null != (method = iterable[async])) return method.call(iterable);
- if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable));
- async = "@@asyncIterator", sync = "@@iterator";
- }
- throw new TypeError("Object is not async iterable");
-}
-function AsyncFromSyncIterator(s) {
- function AsyncFromSyncIteratorContinuation(r) {
- if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
- var done = r.done;
- return Promise.resolve(r.value).then(function (value) {
- return {
- value: value,
- done: done
- };
- });
- }
- return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) {
- this.s = s, this.n = s.next;
- }, AsyncFromSyncIterator.prototype = {
- s: null,
- n: null,
- next: function next() {
- return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
- },
- "return": function _return(value) {
- var ret = this.s["return"];
- return void 0 === ret ? Promise.resolve({
- value: value,
- done: !0
- }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
- },
- "throw": function _throw(value) {
- var thr = this.s["return"];
- return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
- }
- }, new AsyncFromSyncIterator(s);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
deleted file mode 100644
index c37aa2c7..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
+++ /dev/null
@@ -1,30 +0,0 @@
-function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
- try {
- var info = gen[key](arg);
- var value = info.value;
- } catch (error) {
- reject(error);
- return;
- }
- if (info.done) {
- resolve(value);
- } else {
- Promise.resolve(value).then(_next, _throw);
- }
-}
-export default function _asyncToGenerator(fn) {
- return function () {
- var self = this,
- args = arguments;
- return new Promise(function (resolve, reject) {
- var gen = fn.apply(self, args);
- function _next(value) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
- }
- function _throw(err) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
- }
- _next(undefined);
- });
- };
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js
deleted file mode 100644
index cfa05220..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import OverloadYield from "./OverloadYield.js";
-export default function _awaitAsyncGenerator(value) {
- return new OverloadYield(value, 0);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/checkInRHS.js b/project starter code/node_modules/@babel/runtime/helpers/esm/checkInRHS.js
deleted file mode 100644
index 928d53d2..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/checkInRHS.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import _typeof from "./typeof.js";
-export default function _checkInRHS(value) {
- if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== value ? _typeof(value) : "null"));
- return value;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js b/project starter code/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js
deleted file mode 100644
index 99014036..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default function _checkPrivateRedeclaration(obj, privateCollection) {
- if (privateCollection.has(obj)) {
- throw new TypeError("Cannot initialize the same private elements twice on an object");
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js
deleted file mode 100644
index 68684f23..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js
+++ /dev/null
@@ -1,17 +0,0 @@
-export default function _classApplyDescriptorDestructureSet(receiver, descriptor) {
- if (descriptor.set) {
- if (!("__destrObj" in descriptor)) {
- descriptor.__destrObj = {
- set value(v) {
- descriptor.set.call(receiver, v);
- }
- };
- }
- return descriptor.__destrObj;
- } else {
- if (!descriptor.writable) {
- throw new TypeError("attempted to set read only private field");
- }
- return descriptor;
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js
deleted file mode 100644
index 727e9e9b..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export default function _classApplyDescriptorGet(receiver, descriptor) {
- if (descriptor.get) {
- return descriptor.get.call(receiver);
- }
- return descriptor.value;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js
deleted file mode 100644
index b4df6d30..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js
+++ /dev/null
@@ -1,10 +0,0 @@
-export default function _classApplyDescriptorSet(receiver, descriptor, value) {
- if (descriptor.set) {
- descriptor.set.call(receiver, value);
- } else {
- if (!descriptor.writable) {
- throw new TypeError("attempted to set read only private field");
- }
- descriptor.value = value;
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classCallCheck.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classCallCheck.js
deleted file mode 100644
index 2f1738a3..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classCallCheck.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js
deleted file mode 100644
index 098ed309..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default function _classCheckPrivateStaticAccess(receiver, classConstructor) {
- if (receiver !== classConstructor) {
- throw new TypeError("Private static access of wrong provenance");
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js
deleted file mode 100644
index 0ef34b8d..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
- if (descriptor === undefined) {
- throw new TypeError("attempted to " + action + " private static field before its declaration");
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js
deleted file mode 100644
index 1a8d71ba..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export default function _classExtractFieldDescriptor(receiver, privateMap, action) {
- if (!privateMap.has(receiver)) {
- throw new TypeError("attempted to " + action + " private field on non-instance");
- }
- return privateMap.get(receiver);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js
deleted file mode 100644
index 46eea93a..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _classNameTDZError(name) {
- throw new ReferenceError("Class \"" + name + "\" cannot be referenced in computed property keys.");
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js
deleted file mode 100644
index fb588336..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet.js";
-import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js";
-export default function _classPrivateFieldDestructureSet(receiver, privateMap) {
- var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set");
- return classApplyDescriptorDestructureSet(receiver, descriptor);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js
deleted file mode 100644
index 53cd1379..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import classApplyDescriptorGet from "./classApplyDescriptorGet.js";
-import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js";
-export default function _classPrivateFieldGet(receiver, privateMap) {
- var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get");
- return classApplyDescriptorGet(receiver, descriptor);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js
deleted file mode 100644
index 2253dd84..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import checkPrivateRedeclaration from "./checkPrivateRedeclaration.js";
-export default function _classPrivateFieldInitSpec(obj, privateMap, value) {
- checkPrivateRedeclaration(obj, privateMap);
- privateMap.set(obj, value);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js
deleted file mode 100644
index 09e93304..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export default function _classPrivateFieldBase(receiver, privateKey) {
- if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
- throw new TypeError("attempted to use private field on non-instance");
- }
- return receiver;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js
deleted file mode 100644
index 5b7e5ac0..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js
+++ /dev/null
@@ -1,4 +0,0 @@
-var id = 0;
-export default function _classPrivateFieldKey(name) {
- return "__private_" + id++ + "_" + name;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js
deleted file mode 100644
index ad91be44..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import classApplyDescriptorSet from "./classApplyDescriptorSet.js";
-import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js";
-export default function _classPrivateFieldSet(receiver, privateMap, value) {
- var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set");
- classApplyDescriptorSet(receiver, descriptor, value);
- return value;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js
deleted file mode 100644
index f32a3da8..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export default function _classPrivateMethodGet(receiver, privateSet, fn) {
- if (!privateSet.has(receiver)) {
- throw new TypeError("attempted to get private field on non-instance");
- }
- return fn;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js
deleted file mode 100644
index 18d12915..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import checkPrivateRedeclaration from "./checkPrivateRedeclaration.js";
-export default function _classPrivateMethodInitSpec(obj, privateSet) {
- checkPrivateRedeclaration(obj, privateSet);
- privateSet.add(obj);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js
deleted file mode 100644
index 2bbaf3a7..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _classPrivateMethodSet() {
- throw new TypeError("attempted to reassign private method");
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js
deleted file mode 100644
index 77afcfb1..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet.js";
-import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js";
-import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js";
-export default function _classStaticPrivateFieldDestructureSet(receiver, classConstructor, descriptor) {
- classCheckPrivateStaticAccess(receiver, classConstructor);
- classCheckPrivateStaticFieldDescriptor(descriptor, "set");
- return classApplyDescriptorDestructureSet(receiver, descriptor);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js
deleted file mode 100644
index d253d311..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import classApplyDescriptorGet from "./classApplyDescriptorGet.js";
-import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js";
-import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js";
-export default function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
- classCheckPrivateStaticAccess(receiver, classConstructor);
- classCheckPrivateStaticFieldDescriptor(descriptor, "get");
- return classApplyDescriptorGet(receiver, descriptor);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js
deleted file mode 100644
index b0b0cc64..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import classApplyDescriptorSet from "./classApplyDescriptorSet.js";
-import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js";
-import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js";
-export default function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) {
- classCheckPrivateStaticAccess(receiver, classConstructor);
- classCheckPrivateStaticFieldDescriptor(descriptor, "set");
- classApplyDescriptorSet(receiver, descriptor, value);
- return value;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js
deleted file mode 100644
index fddc7b2d..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js";
-export default function _classStaticPrivateMethodGet(receiver, classConstructor, method) {
- classCheckPrivateStaticAccess(receiver, classConstructor);
- return method;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js
deleted file mode 100644
index d5ab60a9..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _classStaticPrivateMethodSet() {
- throw new TypeError("attempted to set read only static private field");
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/construct.js b/project starter code/node_modules/@babel/runtime/helpers/esm/construct.js
deleted file mode 100644
index 3860bdd0..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/construct.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import setPrototypeOf from "./setPrototypeOf.js";
-import isNativeReflectConstruct from "./isNativeReflectConstruct.js";
-export default function _construct(Parent, args, Class) {
- if (isNativeReflectConstruct()) {
- _construct = Reflect.construct.bind();
- } else {
- _construct = function _construct(Parent, args, Class) {
- var a = [null];
- a.push.apply(a, args);
- var Constructor = Function.bind.apply(Parent, a);
- var instance = new Constructor();
- if (Class) setPrototypeOf(instance, Class.prototype);
- return instance;
- };
- }
- return _construct.apply(null, arguments);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createClass.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createClass.js
deleted file mode 100644
index bbacdfec..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/createClass.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import toPropertyKey from "./toPropertyKey.js";
-function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
- }
-}
-export default function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", {
- writable: false
- });
- return Constructor;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js
deleted file mode 100644
index 5e0e0f19..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js
+++ /dev/null
@@ -1,52 +0,0 @@
-import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
-export default function _createForOfIteratorHelper(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (!it) {
- if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it) o = it;
- var i = 0;
- var F = function F() {};
- return {
- s: F,
- n: function n() {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- },
- e: function e(_e) {
- throw _e;
- },
- f: F
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- var normalCompletion = true,
- didErr = false,
- err;
- return {
- s: function s() {
- it = it.call(o);
- },
- n: function n() {
- var step = it.next();
- normalCompletion = step.done;
- return step;
- },
- e: function e(_e2) {
- didErr = true;
- err = _e2;
- },
- f: function f() {
- try {
- if (!normalCompletion && it["return"] != null) it["return"]();
- } finally {
- if (didErr) throw err;
- }
- }
- };
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js
deleted file mode 100644
index 043857dc..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
-export default function _createForOfIteratorHelperLoose(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it) return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it) o = it;
- var i = 0;
- return function () {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createSuper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createSuper.js
deleted file mode 100644
index 7c962976..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/createSuper.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import getPrototypeOf from "./getPrototypeOf.js";
-import isNativeReflectConstruct from "./isNativeReflectConstruct.js";
-import possibleConstructorReturn from "./possibleConstructorReturn.js";
-export default function _createSuper(Derived) {
- var hasNativeReflectConstruct = isNativeReflectConstruct();
- return function _createSuperInternal() {
- var Super = getPrototypeOf(Derived),
- result;
- if (hasNativeReflectConstruct) {
- var NewTarget = getPrototypeOf(this).constructor;
- result = Reflect.construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
- return possibleConstructorReturn(this, result);
- };
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/decorate.js b/project starter code/node_modules/@babel/runtime/helpers/esm/decorate.js
deleted file mode 100644
index e511dfe6..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/decorate.js
+++ /dev/null
@@ -1,342 +0,0 @@
-import toArray from "./toArray.js";
-import toPropertyKey from "./toPropertyKey.js";
-export default function _decorate(decorators, factory, superClass, mixins) {
- var api = _getDecoratorsApi();
- if (mixins) {
- for (var i = 0; i < mixins.length; i++) {
- api = mixins[i](api);
- }
- }
- var r = factory(function initialize(O) {
- api.initializeInstanceElements(O, decorated.elements);
- }, superClass);
- var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators);
- api.initializeClassElements(r.F, decorated.elements);
- return api.runClassFinishers(r.F, decorated.finishers);
-}
-function _getDecoratorsApi() {
- _getDecoratorsApi = function _getDecoratorsApi() {
- return api;
- };
- var api = {
- elementsDefinitionOrder: [["method"], ["field"]],
- initializeInstanceElements: function initializeInstanceElements(O, elements) {
- ["method", "field"].forEach(function (kind) {
- elements.forEach(function (element) {
- if (element.kind === kind && element.placement === "own") {
- this.defineClassElement(O, element);
- }
- }, this);
- }, this);
- },
- initializeClassElements: function initializeClassElements(F, elements) {
- var proto = F.prototype;
- ["method", "field"].forEach(function (kind) {
- elements.forEach(function (element) {
- var placement = element.placement;
- if (element.kind === kind && (placement === "static" || placement === "prototype")) {
- var receiver = placement === "static" ? F : proto;
- this.defineClassElement(receiver, element);
- }
- }, this);
- }, this);
- },
- defineClassElement: function defineClassElement(receiver, element) {
- var descriptor = element.descriptor;
- if (element.kind === "field") {
- var initializer = element.initializer;
- descriptor = {
- enumerable: descriptor.enumerable,
- writable: descriptor.writable,
- configurable: descriptor.configurable,
- value: initializer === void 0 ? void 0 : initializer.call(receiver)
- };
- }
- Object.defineProperty(receiver, element.key, descriptor);
- },
- decorateClass: function decorateClass(elements, decorators) {
- var newElements = [];
- var finishers = [];
- var placements = {
- "static": [],
- prototype: [],
- own: []
- };
- elements.forEach(function (element) {
- this.addElementPlacement(element, placements);
- }, this);
- elements.forEach(function (element) {
- if (!_hasDecorators(element)) return newElements.push(element);
- var elementFinishersExtras = this.decorateElement(element, placements);
- newElements.push(elementFinishersExtras.element);
- newElements.push.apply(newElements, elementFinishersExtras.extras);
- finishers.push.apply(finishers, elementFinishersExtras.finishers);
- }, this);
- if (!decorators) {
- return {
- elements: newElements,
- finishers: finishers
- };
- }
- var result = this.decorateConstructor(newElements, decorators);
- finishers.push.apply(finishers, result.finishers);
- result.finishers = finishers;
- return result;
- },
- addElementPlacement: function addElementPlacement(element, placements, silent) {
- var keys = placements[element.placement];
- if (!silent && keys.indexOf(element.key) !== -1) {
- throw new TypeError("Duplicated element (" + element.key + ")");
- }
- keys.push(element.key);
- },
- decorateElement: function decorateElement(element, placements) {
- var extras = [];
- var finishers = [];
- for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) {
- var keys = placements[element.placement];
- keys.splice(keys.indexOf(element.key), 1);
- var elementObject = this.fromElementDescriptor(element);
- var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject);
- element = elementFinisherExtras.element;
- this.addElementPlacement(element, placements);
- if (elementFinisherExtras.finisher) {
- finishers.push(elementFinisherExtras.finisher);
- }
- var newExtras = elementFinisherExtras.extras;
- if (newExtras) {
- for (var j = 0; j < newExtras.length; j++) {
- this.addElementPlacement(newExtras[j], placements);
- }
- extras.push.apply(extras, newExtras);
- }
- }
- return {
- element: element,
- finishers: finishers,
- extras: extras
- };
- },
- decorateConstructor: function decorateConstructor(elements, decorators) {
- var finishers = [];
- for (var i = decorators.length - 1; i >= 0; i--) {
- var obj = this.fromClassDescriptor(elements);
- var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj);
- if (elementsAndFinisher.finisher !== undefined) {
- finishers.push(elementsAndFinisher.finisher);
- }
- if (elementsAndFinisher.elements !== undefined) {
- elements = elementsAndFinisher.elements;
- for (var j = 0; j < elements.length - 1; j++) {
- for (var k = j + 1; k < elements.length; k++) {
- if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) {
- throw new TypeError("Duplicated element (" + elements[j].key + ")");
- }
- }
- }
- }
- }
- return {
- elements: elements,
- finishers: finishers
- };
- },
- fromElementDescriptor: function fromElementDescriptor(element) {
- var obj = {
- kind: element.kind,
- key: element.key,
- placement: element.placement,
- descriptor: element.descriptor
- };
- var desc = {
- value: "Descriptor",
- configurable: true
- };
- Object.defineProperty(obj, Symbol.toStringTag, desc);
- if (element.kind === "field") obj.initializer = element.initializer;
- return obj;
- },
- toElementDescriptors: function toElementDescriptors(elementObjects) {
- if (elementObjects === undefined) return;
- return toArray(elementObjects).map(function (elementObject) {
- var element = this.toElementDescriptor(elementObject);
- this.disallowProperty(elementObject, "finisher", "An element descriptor");
- this.disallowProperty(elementObject, "extras", "An element descriptor");
- return element;
- }, this);
- },
- toElementDescriptor: function toElementDescriptor(elementObject) {
- var kind = String(elementObject.kind);
- if (kind !== "method" && kind !== "field") {
- throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"');
- }
- var key = toPropertyKey(elementObject.key);
- var placement = String(elementObject.placement);
- if (placement !== "static" && placement !== "prototype" && placement !== "own") {
- throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"');
- }
- var descriptor = elementObject.descriptor;
- this.disallowProperty(elementObject, "elements", "An element descriptor");
- var element = {
- kind: kind,
- key: key,
- placement: placement,
- descriptor: Object.assign({}, descriptor)
- };
- if (kind !== "field") {
- this.disallowProperty(elementObject, "initializer", "A method descriptor");
- } else {
- this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
- this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
- this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
- element.initializer = elementObject.initializer;
- }
- return element;
- },
- toElementFinisherExtras: function toElementFinisherExtras(elementObject) {
- var element = this.toElementDescriptor(elementObject);
- var finisher = _optionalCallableProperty(elementObject, "finisher");
- var extras = this.toElementDescriptors(elementObject.extras);
- return {
- element: element,
- finisher: finisher,
- extras: extras
- };
- },
- fromClassDescriptor: function fromClassDescriptor(elements) {
- var obj = {
- kind: "class",
- elements: elements.map(this.fromElementDescriptor, this)
- };
- var desc = {
- value: "Descriptor",
- configurable: true
- };
- Object.defineProperty(obj, Symbol.toStringTag, desc);
- return obj;
- },
- toClassDescriptor: function toClassDescriptor(obj) {
- var kind = String(obj.kind);
- if (kind !== "class") {
- throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"');
- }
- this.disallowProperty(obj, "key", "A class descriptor");
- this.disallowProperty(obj, "placement", "A class descriptor");
- this.disallowProperty(obj, "descriptor", "A class descriptor");
- this.disallowProperty(obj, "initializer", "A class descriptor");
- this.disallowProperty(obj, "extras", "A class descriptor");
- var finisher = _optionalCallableProperty(obj, "finisher");
- var elements = this.toElementDescriptors(obj.elements);
- return {
- elements: elements,
- finisher: finisher
- };
- },
- runClassFinishers: function runClassFinishers(constructor, finishers) {
- for (var i = 0; i < finishers.length; i++) {
- var newConstructor = (0, finishers[i])(constructor);
- if (newConstructor !== undefined) {
- if (typeof newConstructor !== "function") {
- throw new TypeError("Finishers must return a constructor.");
- }
- constructor = newConstructor;
- }
- }
- return constructor;
- },
- disallowProperty: function disallowProperty(obj, name, objectType) {
- if (obj[name] !== undefined) {
- throw new TypeError(objectType + " can't have a ." + name + " property.");
- }
- }
- };
- return api;
-}
-function _createElementDescriptor(def) {
- var key = toPropertyKey(def.key);
- var descriptor;
- if (def.kind === "method") {
- descriptor = {
- value: def.value,
- writable: true,
- configurable: true,
- enumerable: false
- };
- } else if (def.kind === "get") {
- descriptor = {
- get: def.value,
- configurable: true,
- enumerable: false
- };
- } else if (def.kind === "set") {
- descriptor = {
- set: def.value,
- configurable: true,
- enumerable: false
- };
- } else if (def.kind === "field") {
- descriptor = {
- configurable: true,
- writable: true,
- enumerable: true
- };
- }
- var element = {
- kind: def.kind === "field" ? "field" : "method",
- key: key,
- placement: def["static"] ? "static" : def.kind === "field" ? "own" : "prototype",
- descriptor: descriptor
- };
- if (def.decorators) element.decorators = def.decorators;
- if (def.kind === "field") element.initializer = def.value;
- return element;
-}
-function _coalesceGetterSetter(element, other) {
- if (element.descriptor.get !== undefined) {
- other.descriptor.get = element.descriptor.get;
- } else {
- other.descriptor.set = element.descriptor.set;
- }
-}
-function _coalesceClassElements(elements) {
- var newElements = [];
- var isSameElement = function isSameElement(other) {
- return other.kind === "method" && other.key === element.key && other.placement === element.placement;
- };
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- var other;
- if (element.kind === "method" && (other = newElements.find(isSameElement))) {
- if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) {
- if (_hasDecorators(element) || _hasDecorators(other)) {
- throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated.");
- }
- other.descriptor = element.descriptor;
- } else {
- if (_hasDecorators(element)) {
- if (_hasDecorators(other)) {
- throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ").");
- }
- other.decorators = element.decorators;
- }
- _coalesceGetterSetter(element, other);
- }
- } else {
- newElements.push(element);
- }
- }
- return newElements;
-}
-function _hasDecorators(element) {
- return element.decorators && element.decorators.length;
-}
-function _isDataDescriptor(desc) {
- return desc !== undefined && !(desc.value === undefined && desc.writable === undefined);
-}
-function _optionalCallableProperty(obj, name) {
- var value = obj[name];
- if (value !== undefined && typeof value !== "function") {
- throw new TypeError("Expected '" + name + "' to be a function");
- }
- return value;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defaults.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defaults.js
deleted file mode 100644
index 9e59e9a8..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/defaults.js
+++ /dev/null
@@ -1,11 +0,0 @@
-export default function _defaults(obj, defaults) {
- var keys = Object.getOwnPropertyNames(defaults);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- var value = Object.getOwnPropertyDescriptor(defaults, key);
- if (value && value.configurable && obj[key] === undefined) {
- Object.defineProperty(obj, key, value);
- }
- }
- return obj;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defineAccessor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defineAccessor.js
deleted file mode 100644
index 154271d1..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/defineAccessor.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export default function _defineAccessor(type, obj, key, fn) {
- var desc = {
- configurable: !0,
- enumerable: !0
- };
- return desc[type] = fn, Object.defineProperty(obj, key, desc);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js
deleted file mode 100644
index 0c04128a..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js
+++ /dev/null
@@ -1,19 +0,0 @@
-export default function _defineEnumerableProperties(obj, descs) {
- for (var key in descs) {
- var desc = descs[key];
- desc.configurable = desc.enumerable = true;
- if ("value" in desc) desc.writable = true;
- Object.defineProperty(obj, key, desc);
- }
- if (Object.getOwnPropertySymbols) {
- var objectSymbols = Object.getOwnPropertySymbols(descs);
- for (var i = 0; i < objectSymbols.length; i++) {
- var sym = objectSymbols[i];
- var desc = descs[sym];
- desc.configurable = desc.enumerable = true;
- if ("value" in desc) desc.writable = true;
- Object.defineProperty(obj, sym, desc);
- }
- }
- return obj;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defineProperty.js
deleted file mode 100644
index 56c06a25..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/defineProperty.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import toPropertyKey from "./toPropertyKey.js";
-export default function _defineProperty(obj, key, value) {
- key = toPropertyKey(key);
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/extends.js b/project starter code/node_modules/@babel/runtime/helpers/esm/extends.js
deleted file mode 100644
index ab17131f..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/extends.js
+++ /dev/null
@@ -1,14 +0,0 @@
-export default function _extends() {
- _extends = Object.assign ? Object.assign.bind() : function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- };
- return _extends.apply(this, arguments);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/get.js b/project starter code/node_modules/@babel/runtime/helpers/esm/get.js
deleted file mode 100644
index 0705d5fc..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/get.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import superPropBase from "./superPropBase.js";
-export default function _get() {
- if (typeof Reflect !== "undefined" && Reflect.get) {
- _get = Reflect.get.bind();
- } else {
- _get = function _get(target, property, receiver) {
- var base = superPropBase(target, property);
- if (!base) return;
- var desc = Object.getOwnPropertyDescriptor(base, property);
- if (desc.get) {
- return desc.get.call(arguments.length < 3 ? target : receiver);
- }
- return desc.value;
- };
- }
- return _get.apply(this, arguments);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
deleted file mode 100644
index e9bb1d54..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export default function _getPrototypeOf(o) {
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
- return o.__proto__ || Object.getPrototypeOf(o);
- };
- return _getPrototypeOf(o);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/identity.js b/project starter code/node_modules/@babel/runtime/helpers/esm/identity.js
deleted file mode 100644
index a1e7e4cd..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/identity.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _identity(x) {
- return x;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/inherits.js b/project starter code/node_modules/@babel/runtime/helpers/esm/inherits.js
deleted file mode 100644
index 0b0a0eac..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/inherits.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import setPrototypeOf from "./setPrototypeOf.js";
-export default function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function");
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- writable: true,
- configurable: true
- }
- });
- Object.defineProperty(subClass, "prototype", {
- writable: false
- });
- if (superClass) setPrototypeOf(subClass, superClass);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
deleted file mode 100644
index 90bb7965..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import setPrototypeOf from "./setPrototypeOf.js";
-export default function _inheritsLoose(subClass, superClass) {
- subClass.prototype = Object.create(superClass.prototype);
- subClass.prototype.constructor = subClass;
- setPrototypeOf(subClass, superClass);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js
deleted file mode 100644
index 26fdea08..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js
+++ /dev/null
@@ -1,9 +0,0 @@
-export default function _initializerDefineProperty(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js
deleted file mode 100644
index 30d518cf..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.');
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/instanceof.js b/project starter code/node_modules/@babel/runtime/helpers/esm/instanceof.js
deleted file mode 100644
index 8c43b717..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/instanceof.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export default function _instanceof(left, right) {
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
- return !!right[Symbol.hasInstance](left);
- } else {
- return left instanceof right;
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js b/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js
deleted file mode 100644
index c2df7b64..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- };
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js b/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js
deleted file mode 100644
index 6ec63091..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import _typeof from "./typeof.js";
-function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}
-export default function _interopRequireWildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) {
- return obj;
- }
- if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
- return {
- "default": obj
- };
- }
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) {
- return cache.get(obj);
- }
- var newObj = {};
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for (var key in obj) {
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) {
- Object.defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
- newObj["default"] = obj;
- if (cache) {
- cache.set(obj, newObj);
- }
- return newObj;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js b/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
deleted file mode 100644
index 7b1bc821..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _isNativeFunction(fn) {
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js b/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
deleted file mode 100644
index 61840807..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
+++ /dev/null
@@ -1,11 +0,0 @@
-export default function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
- if (Reflect.construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArray.js
deleted file mode 100644
index cfe9fbd3..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArray.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _iterableToArray(iter) {
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js b/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
deleted file mode 100644
index 5c31a593..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
+++ /dev/null
@@ -1,27 +0,0 @@
-export default function _iterableToArrayLimit(arr, i) {
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
- if (null != _i) {
- var _s,
- _e,
- _x,
- _r,
- _arr = [],
- _n = !0,
- _d = !1;
- try {
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
- if (Object(_i) !== _i) return;
- _n = !1;
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
- } catch (err) {
- _d = !0, _e = err;
- } finally {
- try {
- if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
- } finally {
- if (_d) throw _e;
- }
- }
- return _arr;
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js
deleted file mode 100644
index 9237c307..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js
+++ /dev/null
@@ -1,9 +0,0 @@
-export default function _iterableToArrayLimitLoose(arr, i) {
- var _i = arr && ("undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]);
- if (null != _i) {
- var _s,
- _arr = [];
- for (_i = _i.call(arr); arr.length < i && !(_s = _i.next()).done;) _arr.push(_s.value);
- return _arr;
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/jsx.js b/project starter code/node_modules/@babel/runtime/helpers/esm/jsx.js
deleted file mode 100644
index 742afd5c..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/jsx.js
+++ /dev/null
@@ -1,21 +0,0 @@
-var REACT_ELEMENT_TYPE;
-export default function _createRawReactElement(type, props, key, children) {
- REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103);
- var defaultProps = type && type.defaultProps,
- childrenLength = arguments.length - 3;
- if (props || 0 === childrenLength || (props = {
- children: void 0
- }), 1 === childrenLength) props.children = children;else if (childrenLength > 1) {
- for (var childArray = new Array(childrenLength), i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 3];
- props.children = childArray;
- }
- if (props && defaultProps) for (var propName in defaultProps) void 0 === props[propName] && (props[propName] = defaultProps[propName]);else props || (props = defaultProps || {});
- return {
- $$typeof: REACT_ELEMENT_TYPE,
- type: type,
- key: void 0 === key ? null : "" + key,
- ref: null,
- props: props,
- _owner: null
- };
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js b/project starter code/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js
deleted file mode 100644
index 38fd78fb..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import arrayLikeToArray from "./arrayLikeToArray.js";
-export default function _maybeArrayLike(next, arr, i) {
- if (arr && !Array.isArray(arr) && typeof arr.length === "number") {
- var len = arr.length;
- return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len);
- }
- return next(arr, i);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js b/project starter code/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js
deleted file mode 100644
index d6cd8643..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default function _newArrowCheck(innerThis, boundThis) {
- if (innerThis !== boundThis) {
- throw new TypeError("Cannot instantiate an arrow function");
- }
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js b/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
deleted file mode 100644
index b349d006..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js b/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
deleted file mode 100644
index 82d82961..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js
deleted file mode 100644
index 251b8595..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _objectDestructuringEmpty(obj) {
- if (obj == null) throw new TypeError("Cannot destructure " + obj);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread.js
deleted file mode 100644
index a4e05e56..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import defineProperty from "./defineProperty.js";
-export default function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? Object(arguments[i]) : {};
- var ownKeys = Object.keys(source);
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
- ownKeys.forEach(function (key) {
- defineProperty(target, key, source[key]);
- });
- }
- return target;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread2.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread2.js
deleted file mode 100644
index 7d69accd..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread2.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import defineProperty from "./defineProperty.js";
-function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function (sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
-}
-export default function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
- defineProperty(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
deleted file mode 100644
index 36804a39..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import objectWithoutPropertiesLoose from "./objectWithoutPropertiesLoose.js";
-export default function _objectWithoutProperties(source, excluded) {
- if (source == null) return {};
- var target = objectWithoutPropertiesLoose(source, excluded);
- var key, i;
- if (Object.getOwnPropertySymbols) {
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
- for (i = 0; i < sourceSymbolKeys.length; i++) {
- key = sourceSymbolKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
- target[key] = source[key];
- }
- }
- return target;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
deleted file mode 100644
index 4b308bde..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
+++ /dev/null
@@ -1,12 +0,0 @@
-export default function _objectWithoutPropertiesLoose(source, excluded) {
- if (source == null) return {};
- var target = {};
- var sourceKeys = Object.keys(source);
- var key, i;
- for (i = 0; i < sourceKeys.length; i++) {
- key = sourceKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- target[key] = source[key];
- }
- return target;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/package.json b/project starter code/node_modules/@babel/runtime/helpers/esm/package.json
deleted file mode 100644
index aead43de..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "type": "module"
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js b/project starter code/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
deleted file mode 100644
index 87788244..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import _typeof from "./typeof.js";
-import assertThisInitialized from "./assertThisInitialized.js";
-export default function _possibleConstructorReturn(self, call) {
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
- return call;
- } else if (call !== void 0) {
- throw new TypeError("Derived constructors may only return object or undefined");
- }
- return assertThisInitialized(self);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/readOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/esm/readOnlyError.js
deleted file mode 100644
index 166e40e5..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/readOnlyError.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _readOnlyError(name) {
- throw new TypeError("\"" + name + "\" is read-only");
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js b/project starter code/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js
deleted file mode 100644
index 562d8119..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js
+++ /dev/null
@@ -1,303 +0,0 @@
-import _typeof from "./typeof.js";
-export default function _regeneratorRuntime() {
- "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- _regeneratorRuntime = function _regeneratorRuntime() {
- return exports;
- };
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- defineProperty = Object.defineProperty || function (obj, key, desc) {
- obj[key] = desc.value;
- },
- $Symbol = "function" == typeof Symbol ? Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return Object.defineProperty(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), obj[key];
- }
- try {
- define({}, "");
- } catch (err) {
- define = function define(obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
- generator = Object.create(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return defineProperty(generator, "_invoke", {
- value: makeInvokeMethod(innerFn, self, context)
- }), generator;
- }
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = Object.getPrototypeOf,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
- result.value = unwrapped, resolve(result);
- }, function (error) {
- return invoke("throw", error, resolve, reject);
- });
- }
- reject(record.arg);
- }
- var previousPromise;
- defineProperty(this, "_invoke", {
- value: function value(method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- }
- });
- }
- function makeInvokeMethod(innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state) throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg;;) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
- if ("suspendedStart" === state) throw state = "completed", context.arg;
- context.dispatchException(context.arg);
- } else "return" === context.method && context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
- return {
- value: record.arg,
- done: context.done
- };
- }
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
- }
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var methodName = context.method,
- method = delegate.iterator[methodName];
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
- var info = record.arg;
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal", delete record.arg, entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{
- tryLoc: "root"
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
- return next.value = undefined, next.done = !0, next;
- };
- return next.next = next;
- }
- }
- return {
- next: doneResult
- };
- }
- function doneResult() {
- return {
- value: undefined,
- done: !0
- };
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
- value: GeneratorFunctionPrototype,
- configurable: !0
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
- value: GeneratorFunction,
- configurable: !0
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
- }, exports.mark = function (genFun) {
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
- }, exports.awrap = function (arg) {
- return {
- __await: arg
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- void 0 === PromiseImpl && (PromiseImpl = Promise);
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
- return this;
- }), define(Gp, "toString", function () {
- return "[object Generator]";
- }), exports.keys = function (val) {
- var object = Object(val),
- keys = [];
- for (var key in object) keys.push(key);
- return keys.reverse(), function next() {
- for (; keys.length;) {
- var key = keys.pop();
- if (key in object) return next.value = key, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, exports.values = values, Context.prototype = {
- constructor: Context,
- reset: function reset(skipTempReset) {
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
- },
- stop: function stop() {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function dispatchException(exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally) throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function abrupt(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
- },
- complete: function complete(record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
- },
- finish: function finish(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
- }
- },
- "catch": function _catch(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
- return this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
- }
- }, exports;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/set.js b/project starter code/node_modules/@babel/runtime/helpers/esm/set.js
deleted file mode 100644
index c9ee6c72..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/set.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import superPropBase from "./superPropBase.js";
-import defineProperty from "./defineProperty.js";
-function set(target, property, value, receiver) {
- if (typeof Reflect !== "undefined" && Reflect.set) {
- set = Reflect.set;
- } else {
- set = function set(target, property, value, receiver) {
- var base = superPropBase(target, property);
- var desc;
- if (base) {
- desc = Object.getOwnPropertyDescriptor(base, property);
- if (desc.set) {
- desc.set.call(receiver, value);
- return true;
- } else if (!desc.writable) {
- return false;
- }
- }
- desc = Object.getOwnPropertyDescriptor(receiver, property);
- if (desc) {
- if (!desc.writable) {
- return false;
- }
- desc.value = value;
- Object.defineProperty(receiver, property, desc);
- } else {
- defineProperty(receiver, property, value);
- }
- return true;
- };
- }
- return set(target, property, value, receiver);
-}
-export default function _set(target, property, value, receiver, isStrict) {
- var s = set(target, property, value, receiver || target);
- if (!s && isStrict) {
- throw new TypeError('failed to set property');
- }
- return value;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
deleted file mode 100644
index 905e13c0..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export default function _setPrototypeOf(o, p) {
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
- o.__proto__ = p;
- return o;
- };
- return _setPrototypeOf(o, p);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js b/project starter code/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js
deleted file mode 100644
index cadd9bb5..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export default function _skipFirstGeneratorNext(fn) {
- return function () {
- var it = fn.apply(this, arguments);
- it.next();
- return it;
- };
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
deleted file mode 100644
index 618200b9..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import arrayWithHoles from "./arrayWithHoles.js";
-import iterableToArrayLimit from "./iterableToArrayLimit.js";
-import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
-import nonIterableRest from "./nonIterableRest.js";
-export default function _slicedToArray(arr, i) {
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js
deleted file mode 100644
index efc7429e..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import arrayWithHoles from "./arrayWithHoles.js";
-import iterableToArrayLimitLoose from "./iterableToArrayLimitLoose.js";
-import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
-import nonIterableRest from "./nonIterableRest.js";
-export default function _slicedToArrayLoose(arr, i) {
- return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/superPropBase.js b/project starter code/node_modules/@babel/runtime/helpers/esm/superPropBase.js
deleted file mode 100644
index 605724d7..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/superPropBase.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import getPrototypeOf from "./getPrototypeOf.js";
-export default function _superPropBase(object, property) {
- while (!Object.prototype.hasOwnProperty.call(object, property)) {
- object = getPrototypeOf(object);
- if (object === null) break;
- }
- return object;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js b/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js
deleted file mode 100644
index 990d5e43..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js
+++ /dev/null
@@ -1,10 +0,0 @@
-export default function _taggedTemplateLiteral(strings, raw) {
- if (!raw) {
- raw = strings.slice(0);
- }
- return Object.freeze(Object.defineProperties(strings, {
- raw: {
- value: Object.freeze(raw)
- }
- }));
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js
deleted file mode 100644
index 9fcba323..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export default function _taggedTemplateLiteralLoose(strings, raw) {
- if (!raw) {
- raw = strings.slice(0);
- }
- strings.raw = raw;
- return strings;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/tdz.js b/project starter code/node_modules/@babel/runtime/helpers/esm/tdz.js
deleted file mode 100644
index d5d0adc8..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/tdz.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _tdzError(name) {
- throw new ReferenceError(name + " is not defined - temporal dead zone");
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalRef.js b/project starter code/node_modules/@babel/runtime/helpers/esm/temporalRef.js
deleted file mode 100644
index b25f7c44..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalRef.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import undef from "./temporalUndefined.js";
-import err from "./tdz.js";
-export default function _temporalRef(val, name) {
- return val === undef ? err(name) : val;
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js b/project starter code/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js
deleted file mode 100644
index 1a357173..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js
+++ /dev/null
@@ -1 +0,0 @@
-export default function _temporalUndefined() {}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toArray.js
deleted file mode 100644
index ad7c871a..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/toArray.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import arrayWithHoles from "./arrayWithHoles.js";
-import iterableToArray from "./iterableToArray.js";
-import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
-import nonIterableRest from "./nonIterableRest.js";
-export default function _toArray(arr) {
- return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
deleted file mode 100644
index bd912855..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import arrayWithoutHoles from "./arrayWithoutHoles.js";
-import iterableToArray from "./iterableToArray.js";
-import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
-import nonIterableSpread from "./nonIterableSpread.js";
-export default function _toConsumableArray(arr) {
- return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toPrimitive.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toPrimitive.js
deleted file mode 100644
index cbfabb7f..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/toPrimitive.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import _typeof from "./typeof.js";
-export default function _toPrimitive(input, hint) {
- if (_typeof(input) !== "object" || input === null) return input;
- var prim = input[Symbol.toPrimitive];
- if (prim !== undefined) {
- var res = prim.call(input, hint || "default");
- if (_typeof(res) !== "object") return res;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (hint === "string" ? String : Number)(input);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
deleted file mode 100644
index 0fcc93b3..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import _typeof from "./typeof.js";
-import toPrimitive from "./toPrimitive.js";
-export default function _toPropertyKey(arg) {
- var key = toPrimitive(arg, "string");
- return _typeof(key) === "symbol" ? key : String(key);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/typeof.js b/project starter code/node_modules/@babel/runtime/helpers/esm/typeof.js
deleted file mode 100644
index 92100c66..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/typeof.js
+++ /dev/null
@@ -1,9 +0,0 @@
-export default function _typeof(obj) {
- "@babel/helpers - typeof";
-
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- }, _typeof(obj);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
deleted file mode 100644
index c0f63bd5..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import arrayLikeToArray from "./arrayLikeToArray.js";
-export default function _unsupportedIterableToArray(o, minLen) {
- if (!o) return;
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor) n = o.constructor.name;
- if (n === "Map" || n === "Set") return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js
deleted file mode 100644
index 723b2dda..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import AsyncGenerator from "./AsyncGenerator.js";
-export default function _wrapAsyncGenerator(fn) {
- return function () {
- return new AsyncGenerator(fn.apply(this, arguments));
- };
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
deleted file mode 100644
index 43d0ded7..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import getPrototypeOf from "./getPrototypeOf.js";
-import setPrototypeOf from "./setPrototypeOf.js";
-import isNativeFunction from "./isNativeFunction.js";
-import construct from "./construct.js";
-export default function _wrapNativeSuper(Class) {
- var _cache = typeof Map === "function" ? new Map() : undefined;
- _wrapNativeSuper = function _wrapNativeSuper(Class) {
- if (Class === null || !isNativeFunction(Class)) return Class;
- if (typeof Class !== "function") {
- throw new TypeError("Super expression must either be null or a function");
- }
- if (typeof _cache !== "undefined") {
- if (_cache.has(Class)) return _cache.get(Class);
- _cache.set(Class, Wrapper);
- }
- function Wrapper() {
- return construct(Class, arguments, getPrototypeOf(this).constructor);
- }
- Wrapper.prototype = Object.create(Class.prototype, {
- constructor: {
- value: Wrapper,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- return setPrototypeOf(Wrapper, Class);
- };
- return _wrapNativeSuper(Class);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js b/project starter code/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js
deleted file mode 100644
index 620d84c7..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import _typeof from "./typeof.js";
-import setPrototypeOf from "./setPrototypeOf.js";
-import inherits from "./inherits.js";
-export default function _wrapRegExp() {
- _wrapRegExp = function _wrapRegExp(re, groups) {
- return new BabelRegExp(re, void 0, groups);
- };
- var _super = RegExp.prototype,
- _groups = new WeakMap();
- function BabelRegExp(re, flags, groups) {
- var _this = new RegExp(re, flags);
- return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf(_this, BabelRegExp.prototype);
- }
- function buildGroups(result, re) {
- var g = _groups.get(re);
- return Object.keys(g).reduce(function (groups, name) {
- var i = g[name];
- if ("number" == typeof i) groups[name] = result[i];else {
- for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
- groups[name] = result[i[k]];
- }
- return groups;
- }, Object.create(null));
- }
- return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
- var result = _super.exec.call(this, str);
- if (result) {
- result.groups = buildGroups(result, this);
- var indices = result.indices;
- indices && (indices.groups = buildGroups(indices, this));
- }
- return result;
- }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
- if ("string" == typeof substitution) {
- var groups = _groups.get(this);
- return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
- var group = groups[name];
- return "$" + (Array.isArray(group) ? group.join("$") : group);
- }));
- }
- if ("function" == typeof substitution) {
- var _this = this;
- return _super[Symbol.replace].call(this, str, function () {
- var args = arguments;
- return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
- });
- }
- return _super[Symbol.replace].call(this, str, substitution);
- }, _wrapRegExp.apply(this, arguments);
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js
deleted file mode 100644
index 9170bd45..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export default function _writeOnlyError(name) {
- throw new TypeError("\"" + name + "\" is write-only");
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/extends.js b/project starter code/node_modules/@babel/runtime/helpers/extends.js
deleted file mode 100644
index bb111607..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/extends.js
+++ /dev/null
@@ -1,15 +0,0 @@
-function _extends() {
- module.exports = _extends = Object.assign ? Object.assign.bind() : function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _extends.apply(this, arguments);
-}
-module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/get.js b/project starter code/node_modules/@babel/runtime/helpers/get.js
deleted file mode 100644
index 9b44d2fb..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/get.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var superPropBase = require("./superPropBase.js");
-function _get() {
- if (typeof Reflect !== "undefined" && Reflect.get) {
- module.exports = _get = Reflect.get.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports;
- } else {
- module.exports = _get = function _get(target, property, receiver) {
- var base = superPropBase(target, property);
- if (!base) return;
- var desc = Object.getOwnPropertyDescriptor(base, property);
- if (desc.get) {
- return desc.get.call(arguments.length < 3 ? target : receiver);
- }
- return desc.value;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- }
- return _get.apply(this, arguments);
-}
-module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/getPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/getPrototypeOf.js
deleted file mode 100644
index 0639a655..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/getPrototypeOf.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function _getPrototypeOf(o) {
- module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
- return o.__proto__ || Object.getPrototypeOf(o);
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _getPrototypeOf(o);
-}
-module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/identity.js b/project starter code/node_modules/@babel/runtime/helpers/identity.js
deleted file mode 100644
index 7dd82dc7..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/identity.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _identity(x) {
- return x;
-}
-module.exports = _identity, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/inherits.js b/project starter code/node_modules/@babel/runtime/helpers/inherits.js
deleted file mode 100644
index 6521cce3..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/inherits.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var setPrototypeOf = require("./setPrototypeOf.js");
-function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function");
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- writable: true,
- configurable: true
- }
- });
- Object.defineProperty(subClass, "prototype", {
- writable: false
- });
- if (superClass) setPrototypeOf(subClass, superClass);
-}
-module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/inheritsLoose.js b/project starter code/node_modules/@babel/runtime/helpers/inheritsLoose.js
deleted file mode 100644
index 19a60c93..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/inheritsLoose.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var setPrototypeOf = require("./setPrototypeOf.js");
-function _inheritsLoose(subClass, superClass) {
- subClass.prototype = Object.create(superClass.prototype);
- subClass.prototype.constructor = subClass;
- setPrototypeOf(subClass, superClass);
-}
-module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/initializerDefineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/initializerDefineProperty.js
deleted file mode 100644
index 7f35d503..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/initializerDefineProperty.js
+++ /dev/null
@@ -1,10 +0,0 @@
-function _initializerDefineProperty(target, property, descriptor, context) {
- if (!descriptor) return;
- Object.defineProperty(target, property, {
- enumerable: descriptor.enumerable,
- configurable: descriptor.configurable,
- writable: descriptor.writable,
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
- });
-}
-module.exports = _initializerDefineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/initializerWarningHelper.js b/project starter code/node_modules/@babel/runtime/helpers/initializerWarningHelper.js
deleted file mode 100644
index c58b04ee..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/initializerWarningHelper.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _initializerWarningHelper(descriptor, context) {
- throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.');
-}
-module.exports = _initializerWarningHelper, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/instanceof.js b/project starter code/node_modules/@babel/runtime/helpers/instanceof.js
deleted file mode 100644
index bc3d9e7f..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/instanceof.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function _instanceof(left, right) {
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
- return !!right[Symbol.hasInstance](left);
- } else {
- return left instanceof right;
- }
-}
-module.exports = _instanceof, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/interopRequireDefault.js b/project starter code/node_modules/@babel/runtime/helpers/interopRequireDefault.js
deleted file mode 100644
index 429b270d..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/interopRequireDefault.js
+++ /dev/null
@@ -1,6 +0,0 @@
-function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- };
-}
-module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/interopRequireWildcard.js b/project starter code/node_modules/@babel/runtime/helpers/interopRequireWildcard.js
deleted file mode 100644
index 3765dcc7..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/interopRequireWildcard.js
+++ /dev/null
@@ -1,41 +0,0 @@
-var _typeof = require("./typeof.js")["default"];
-function _getRequireWildcardCache(nodeInterop) {
- if (typeof WeakMap !== "function") return null;
- var cacheBabelInterop = new WeakMap();
- var cacheNodeInterop = new WeakMap();
- return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
-}
-function _interopRequireWildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) {
- return obj;
- }
- if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
- return {
- "default": obj
- };
- }
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) {
- return cache.get(obj);
- }
- var newObj = {};
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for (var key in obj) {
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) {
- Object.defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
- newObj["default"] = obj;
- if (cache) {
- cache.set(obj, newObj);
- }
- return newObj;
-}
-module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/isNativeFunction.js b/project starter code/node_modules/@babel/runtime/helpers/isNativeFunction.js
deleted file mode 100644
index ea595353..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/isNativeFunction.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _isNativeFunction(fn) {
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
-}
-module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js b/project starter code/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js
deleted file mode 100644
index 6b4e73f0..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js
+++ /dev/null
@@ -1,12 +0,0 @@
-function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
- if (Reflect.construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
-}
-module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/iterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/iterableToArray.js
deleted file mode 100644
index 89607526..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/iterableToArray.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _iterableToArray(iter) {
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
-}
-module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js b/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js
deleted file mode 100644
index 20a18351..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js
+++ /dev/null
@@ -1,28 +0,0 @@
-function _iterableToArrayLimit(arr, i) {
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
- if (null != _i) {
- var _s,
- _e,
- _x,
- _r,
- _arr = [],
- _n = !0,
- _d = !1;
- try {
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
- if (Object(_i) !== _i) return;
- _n = !1;
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
- } catch (err) {
- _d = !0, _e = err;
- } finally {
- try {
- if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
- } finally {
- if (_d) throw _e;
- }
- }
- return _arr;
- }
-}
-module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js b/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js
deleted file mode 100644
index c56bebdb..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js
+++ /dev/null
@@ -1,10 +0,0 @@
-function _iterableToArrayLimitLoose(arr, i) {
- var _i = arr && ("undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]);
- if (null != _i) {
- var _s,
- _arr = [];
- for (_i = _i.call(arr); arr.length < i && !(_s = _i.next()).done;) _arr.push(_s.value);
- return _arr;
- }
-}
-module.exports = _iterableToArrayLimitLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/jsx.js b/project starter code/node_modules/@babel/runtime/helpers/jsx.js
deleted file mode 100644
index 8c6de765..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/jsx.js
+++ /dev/null
@@ -1,22 +0,0 @@
-var REACT_ELEMENT_TYPE;
-function _createRawReactElement(type, props, key, children) {
- REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103);
- var defaultProps = type && type.defaultProps,
- childrenLength = arguments.length - 3;
- if (props || 0 === childrenLength || (props = {
- children: void 0
- }), 1 === childrenLength) props.children = children;else if (childrenLength > 1) {
- for (var childArray = new Array(childrenLength), i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 3];
- props.children = childArray;
- }
- if (props && defaultProps) for (var propName in defaultProps) void 0 === props[propName] && (props[propName] = defaultProps[propName]);else props || (props = defaultProps || {});
- return {
- $$typeof: REACT_ELEMENT_TYPE,
- type: type,
- key: void 0 === key ? null : "" + key,
- ref: null,
- props: props,
- _owner: null
- };
-}
-module.exports = _createRawReactElement, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/maybeArrayLike.js b/project starter code/node_modules/@babel/runtime/helpers/maybeArrayLike.js
deleted file mode 100644
index 5d000975..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/maybeArrayLike.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var arrayLikeToArray = require("./arrayLikeToArray.js");
-function _maybeArrayLike(next, arr, i) {
- if (arr && !Array.isArray(arr) && typeof arr.length === "number") {
- var len = arr.length;
- return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len);
- }
- return next(arr, i);
-}
-module.exports = _maybeArrayLike, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/newArrowCheck.js b/project starter code/node_modules/@babel/runtime/helpers/newArrowCheck.js
deleted file mode 100644
index 9c680c8d..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/newArrowCheck.js
+++ /dev/null
@@ -1,6 +0,0 @@
-function _newArrowCheck(innerThis, boundThis) {
- if (innerThis !== boundThis) {
- throw new TypeError("Cannot instantiate an arrow function");
- }
-}
-module.exports = _newArrowCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/nonIterableRest.js b/project starter code/node_modules/@babel/runtime/helpers/nonIterableRest.js
deleted file mode 100644
index 95265ba3..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/nonIterableRest.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/nonIterableSpread.js b/project starter code/node_modules/@babel/runtime/helpers/nonIterableSpread.js
deleted file mode 100644
index 3fcf23f0..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/nonIterableSpread.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js b/project starter code/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js
deleted file mode 100644
index 5b405e00..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _objectDestructuringEmpty(obj) {
- if (obj == null) throw new TypeError("Cannot destructure " + obj);
-}
-module.exports = _objectDestructuringEmpty, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectSpread.js b/project starter code/node_modules/@babel/runtime/helpers/objectSpread.js
deleted file mode 100644
index f3934031..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/objectSpread.js
+++ /dev/null
@@ -1,17 +0,0 @@
-var defineProperty = require("./defineProperty.js");
-function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? Object(arguments[i]) : {};
- var ownKeys = Object.keys(source);
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
- ownKeys.forEach(function (key) {
- defineProperty(target, key, source[key]);
- });
- }
- return target;
-}
-module.exports = _objectSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectSpread2.js b/project starter code/node_modules/@babel/runtime/helpers/objectSpread2.js
deleted file mode 100644
index 214f9e04..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/objectSpread2.js
+++ /dev/null
@@ -1,23 +0,0 @@
-var defineProperty = require("./defineProperty.js");
-function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function (sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
- return keys;
-}
-function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
- defineProperty(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
-}
-module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutProperties.js b/project starter code/node_modules/@babel/runtime/helpers/objectWithoutProperties.js
deleted file mode 100644
index cf526bc8..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutProperties.js
+++ /dev/null
@@ -1,17 +0,0 @@
-var objectWithoutPropertiesLoose = require("./objectWithoutPropertiesLoose.js");
-function _objectWithoutProperties(source, excluded) {
- if (source == null) return {};
- var target = objectWithoutPropertiesLoose(source, excluded);
- var key, i;
- if (Object.getOwnPropertySymbols) {
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
- for (i = 0; i < sourceSymbolKeys.length; i++) {
- key = sourceSymbolKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
- target[key] = source[key];
- }
- }
- return target;
-}
-module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js b/project starter code/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js
deleted file mode 100644
index 3c65a9db..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js
+++ /dev/null
@@ -1,13 +0,0 @@
-function _objectWithoutPropertiesLoose(source, excluded) {
- if (source == null) return {};
- var target = {};
- var sourceKeys = Object.keys(source);
- var key, i;
- for (i = 0; i < sourceKeys.length; i++) {
- key = sourceKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- target[key] = source[key];
- }
- return target;
-}
-module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js b/project starter code/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js
deleted file mode 100644
index b2424b00..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js
+++ /dev/null
@@ -1,11 +0,0 @@
-var _typeof = require("./typeof.js")["default"];
-var assertThisInitialized = require("./assertThisInitialized.js");
-function _possibleConstructorReturn(self, call) {
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
- return call;
- } else if (call !== void 0) {
- throw new TypeError("Derived constructors may only return object or undefined");
- }
- return assertThisInitialized(self);
-}
-module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/readOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/readOnlyError.js
deleted file mode 100644
index 6637a0e0..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/readOnlyError.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _readOnlyError(name) {
- throw new TypeError("\"" + name + "\" is read-only");
-}
-module.exports = _readOnlyError, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/regeneratorRuntime.js b/project starter code/node_modules/@babel/runtime/helpers/regeneratorRuntime.js
deleted file mode 100644
index 98db5918..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/regeneratorRuntime.js
+++ /dev/null
@@ -1,304 +0,0 @@
-var _typeof = require("./typeof.js")["default"];
-function _regeneratorRuntime() {
- "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
- return exports;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- defineProperty = Object.defineProperty || function (obj, key, desc) {
- obj[key] = desc.value;
- },
- $Symbol = "function" == typeof Symbol ? Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return Object.defineProperty(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), obj[key];
- }
- try {
- define({}, "");
- } catch (err) {
- define = function define(obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
- generator = Object.create(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return defineProperty(generator, "_invoke", {
- value: makeInvokeMethod(innerFn, self, context)
- }), generator;
- }
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = Object.getPrototypeOf,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
- result.value = unwrapped, resolve(result);
- }, function (error) {
- return invoke("throw", error, resolve, reject);
- });
- }
- reject(record.arg);
- }
- var previousPromise;
- defineProperty(this, "_invoke", {
- value: function value(method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- }
- });
- }
- function makeInvokeMethod(innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state) throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg;;) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
- if ("suspendedStart" === state) throw state = "completed", context.arg;
- context.dispatchException(context.arg);
- } else "return" === context.method && context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
- return {
- value: record.arg,
- done: context.done
- };
- }
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
- }
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var methodName = context.method,
- method = delegate.iterator[methodName];
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
- var info = record.arg;
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal", delete record.arg, entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{
- tryLoc: "root"
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
- return next.value = undefined, next.done = !0, next;
- };
- return next.next = next;
- }
- }
- return {
- next: doneResult
- };
- }
- function doneResult() {
- return {
- value: undefined,
- done: !0
- };
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
- value: GeneratorFunctionPrototype,
- configurable: !0
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
- value: GeneratorFunction,
- configurable: !0
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
- }, exports.mark = function (genFun) {
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
- }, exports.awrap = function (arg) {
- return {
- __await: arg
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- void 0 === PromiseImpl && (PromiseImpl = Promise);
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
- return this;
- }), define(Gp, "toString", function () {
- return "[object Generator]";
- }), exports.keys = function (val) {
- var object = Object(val),
- keys = [];
- for (var key in object) keys.push(key);
- return keys.reverse(), function next() {
- for (; keys.length;) {
- var key = keys.pop();
- if (key in object) return next.value = key, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, exports.values = values, Context.prototype = {
- constructor: Context,
- reset: function reset(skipTempReset) {
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
- },
- stop: function stop() {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function dispatchException(exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally) throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function abrupt(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
- },
- complete: function complete(record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
- },
- finish: function finish(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
- }
- },
- "catch": function _catch(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
- return this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
- }
- }, exports;
-}
-module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/set.js b/project starter code/node_modules/@babel/runtime/helpers/set.js
deleted file mode 100644
index e1356241..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/set.js
+++ /dev/null
@@ -1,41 +0,0 @@
-var superPropBase = require("./superPropBase.js");
-var defineProperty = require("./defineProperty.js");
-function set(target, property, value, receiver) {
- if (typeof Reflect !== "undefined" && Reflect.set) {
- set = Reflect.set;
- } else {
- set = function set(target, property, value, receiver) {
- var base = superPropBase(target, property);
- var desc;
- if (base) {
- desc = Object.getOwnPropertyDescriptor(base, property);
- if (desc.set) {
- desc.set.call(receiver, value);
- return true;
- } else if (!desc.writable) {
- return false;
- }
- }
- desc = Object.getOwnPropertyDescriptor(receiver, property);
- if (desc) {
- if (!desc.writable) {
- return false;
- }
- desc.value = value;
- Object.defineProperty(receiver, property, desc);
- } else {
- defineProperty(receiver, property, value);
- }
- return true;
- };
- }
- return set(target, property, value, receiver);
-}
-function _set(target, property, value, receiver, isStrict) {
- var s = set(target, property, value, receiver || target);
- if (!s && isStrict) {
- throw new TypeError('failed to set property');
- }
- return value;
-}
-module.exports = _set, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/setPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/setPrototypeOf.js
deleted file mode 100644
index e0d8b518..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/setPrototypeOf.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function _setPrototypeOf(o, p) {
- module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
- o.__proto__ = p;
- return o;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _setPrototypeOf(o, p);
-}
-module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js b/project starter code/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js
deleted file mode 100644
index ca269aad..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function _skipFirstGeneratorNext(fn) {
- return function () {
- var it = fn.apply(this, arguments);
- it.next();
- return it;
- };
-}
-module.exports = _skipFirstGeneratorNext, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/slicedToArray.js b/project starter code/node_modules/@babel/runtime/helpers/slicedToArray.js
deleted file mode 100644
index 534b61aa..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/slicedToArray.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var arrayWithHoles = require("./arrayWithHoles.js");
-var iterableToArrayLimit = require("./iterableToArrayLimit.js");
-var unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
-var nonIterableRest = require("./nonIterableRest.js");
-function _slicedToArray(arr, i) {
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
-}
-module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js b/project starter code/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js
deleted file mode 100644
index b1989b48..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var arrayWithHoles = require("./arrayWithHoles.js");
-var iterableToArrayLimitLoose = require("./iterableToArrayLimitLoose.js");
-var unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
-var nonIterableRest = require("./nonIterableRest.js");
-function _slicedToArrayLoose(arr, i) {
- return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
-}
-module.exports = _slicedToArrayLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/superPropBase.js b/project starter code/node_modules/@babel/runtime/helpers/superPropBase.js
deleted file mode 100644
index e43a0293..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/superPropBase.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var getPrototypeOf = require("./getPrototypeOf.js");
-function _superPropBase(object, property) {
- while (!Object.prototype.hasOwnProperty.call(object, property)) {
- object = getPrototypeOf(object);
- if (object === null) break;
- }
- return object;
-}
-module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js b/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js
deleted file mode 100644
index 1ab0e7a2..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js
+++ /dev/null
@@ -1,11 +0,0 @@
-function _taggedTemplateLiteral(strings, raw) {
- if (!raw) {
- raw = strings.slice(0);
- }
- return Object.freeze(Object.defineProperties(strings, {
- raw: {
- value: Object.freeze(raw)
- }
- }));
-}
-module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js b/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js
deleted file mode 100644
index 904e1a7d..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function _taggedTemplateLiteralLoose(strings, raw) {
- if (!raw) {
- raw = strings.slice(0);
- }
- strings.raw = raw;
- return strings;
-}
-module.exports = _taggedTemplateLiteralLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/tdz.js b/project starter code/node_modules/@babel/runtime/helpers/tdz.js
deleted file mode 100644
index 0641c76d..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/tdz.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _tdzError(name) {
- throw new ReferenceError(name + " is not defined - temporal dead zone");
-}
-module.exports = _tdzError, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/temporalRef.js b/project starter code/node_modules/@babel/runtime/helpers/temporalRef.js
deleted file mode 100644
index a9be53d2..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/temporalRef.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var temporalUndefined = require("./temporalUndefined.js");
-var tdz = require("./tdz.js");
-function _temporalRef(val, name) {
- return val === temporalUndefined ? tdz(name) : val;
-}
-module.exports = _temporalRef, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/temporalUndefined.js b/project starter code/node_modules/@babel/runtime/helpers/temporalUndefined.js
deleted file mode 100644
index f8def800..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/temporalUndefined.js
+++ /dev/null
@@ -1,2 +0,0 @@
-function _temporalUndefined() {}
-module.exports = _temporalUndefined, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/toArray.js b/project starter code/node_modules/@babel/runtime/helpers/toArray.js
deleted file mode 100644
index 5c808c2e..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/toArray.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var arrayWithHoles = require("./arrayWithHoles.js");
-var iterableToArray = require("./iterableToArray.js");
-var unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
-var nonIterableRest = require("./nonIterableRest.js");
-function _toArray(arr) {
- return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
-}
-module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/toConsumableArray.js b/project starter code/node_modules/@babel/runtime/helpers/toConsumableArray.js
deleted file mode 100644
index 547c6c44..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/toConsumableArray.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var arrayWithoutHoles = require("./arrayWithoutHoles.js");
-var iterableToArray = require("./iterableToArray.js");
-var unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
-var nonIterableSpread = require("./nonIterableSpread.js");
-function _toConsumableArray(arr) {
- return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
-}
-module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/toPrimitive.js b/project starter code/node_modules/@babel/runtime/helpers/toPrimitive.js
deleted file mode 100644
index adf63bb5..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/toPrimitive.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var _typeof = require("./typeof.js")["default"];
-function _toPrimitive(input, hint) {
- if (_typeof(input) !== "object" || input === null) return input;
- var prim = input[Symbol.toPrimitive];
- if (prim !== undefined) {
- var res = prim.call(input, hint || "default");
- if (_typeof(res) !== "object") return res;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (hint === "string" ? String : Number)(input);
-}
-module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/toPropertyKey.js b/project starter code/node_modules/@babel/runtime/helpers/toPropertyKey.js
deleted file mode 100644
index 320bb2b9..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/toPropertyKey.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var _typeof = require("./typeof.js")["default"];
-var toPrimitive = require("./toPrimitive.js");
-function _toPropertyKey(arg) {
- var key = toPrimitive(arg, "string");
- return _typeof(key) === "symbol" ? key : String(key);
-}
-module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/typeof.js b/project starter code/node_modules/@babel/runtime/helpers/typeof.js
deleted file mode 100644
index aa88477c..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/typeof.js
+++ /dev/null
@@ -1,10 +0,0 @@
-function _typeof(obj) {
- "@babel/helpers - typeof";
-
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
-}
-module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js
deleted file mode 100644
index b7d18c6a..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var arrayLikeToArray = require("./arrayLikeToArray.js");
-function _unsupportedIterableToArray(o, minLen) {
- if (!o) return;
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor) n = o.constructor.name;
- if (n === "Map" || n === "Set") return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
-}
-module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js
deleted file mode 100644
index a62dcf02..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var AsyncGenerator = require("./AsyncGenerator.js");
-function _wrapAsyncGenerator(fn) {
- return function () {
- return new AsyncGenerator(fn.apply(this, arguments));
- };
-}
-module.exports = _wrapAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/wrapNativeSuper.js b/project starter code/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
deleted file mode 100644
index b6ea60c6..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
+++ /dev/null
@@ -1,31 +0,0 @@
-var getPrototypeOf = require("./getPrototypeOf.js");
-var setPrototypeOf = require("./setPrototypeOf.js");
-var isNativeFunction = require("./isNativeFunction.js");
-var construct = require("./construct.js");
-function _wrapNativeSuper(Class) {
- var _cache = typeof Map === "function" ? new Map() : undefined;
- module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
- if (Class === null || !isNativeFunction(Class)) return Class;
- if (typeof Class !== "function") {
- throw new TypeError("Super expression must either be null or a function");
- }
- if (typeof _cache !== "undefined") {
- if (_cache.has(Class)) return _cache.get(Class);
- _cache.set(Class, Wrapper);
- }
- function Wrapper() {
- return construct(Class, arguments, getPrototypeOf(this).constructor);
- }
- Wrapper.prototype = Object.create(Class.prototype, {
- constructor: {
- value: Wrapper,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- return setPrototypeOf(Wrapper, Class);
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _wrapNativeSuper(Class);
-}
-module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/wrapRegExp.js b/project starter code/node_modules/@babel/runtime/helpers/wrapRegExp.js
deleted file mode 100644
index da710f83..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/wrapRegExp.js
+++ /dev/null
@@ -1,51 +0,0 @@
-var _typeof = require("./typeof.js")["default"];
-var setPrototypeOf = require("./setPrototypeOf.js");
-var inherits = require("./inherits.js");
-function _wrapRegExp() {
- module.exports = _wrapRegExp = function _wrapRegExp(re, groups) {
- return new BabelRegExp(re, void 0, groups);
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- var _super = RegExp.prototype,
- _groups = new WeakMap();
- function BabelRegExp(re, flags, groups) {
- var _this = new RegExp(re, flags);
- return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf(_this, BabelRegExp.prototype);
- }
- function buildGroups(result, re) {
- var g = _groups.get(re);
- return Object.keys(g).reduce(function (groups, name) {
- var i = g[name];
- if ("number" == typeof i) groups[name] = result[i];else {
- for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
- groups[name] = result[i[k]];
- }
- return groups;
- }, Object.create(null));
- }
- return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
- var result = _super.exec.call(this, str);
- if (result) {
- result.groups = buildGroups(result, this);
- var indices = result.indices;
- indices && (indices.groups = buildGroups(indices, this));
- }
- return result;
- }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
- if ("string" == typeof substitution) {
- var groups = _groups.get(this);
- return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
- var group = groups[name];
- return "$" + (Array.isArray(group) ? group.join("$") : group);
- }));
- }
- if ("function" == typeof substitution) {
- var _this = this;
- return _super[Symbol.replace].call(this, str, function () {
- var args = arguments;
- return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
- });
- }
- return _super[Symbol.replace].call(this, str, substitution);
- }, _wrapRegExp.apply(this, arguments);
-}
-module.exports = _wrapRegExp, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/helpers/writeOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/writeOnlyError.js
deleted file mode 100644
index c66c6f29..00000000
--- a/project starter code/node_modules/@babel/runtime/helpers/writeOnlyError.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function _writeOnlyError(name) {
- throw new TypeError("\"" + name + "\" is write-only");
-}
-module.exports = _writeOnlyError, module.exports.__esModule = true, module.exports["default"] = module.exports;
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/package.json b/project starter code/node_modules/@babel/runtime/package.json
deleted file mode 100644
index 85b2cced..00000000
--- a/project starter code/node_modules/@babel/runtime/package.json
+++ /dev/null
@@ -1,912 +0,0 @@
-{
- "name": "@babel/runtime",
- "version": "7.20.7",
- "description": "babel's modular runtime helpers",
- "license": "MIT",
- "publishConfig": {
- "access": "public"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/babel/babel.git",
- "directory": "packages/babel-runtime"
- },
- "homepage": "https://babel.dev/docs/en/next/babel-runtime",
- "author": "The Babel Team (https://babel.dev/team)",
- "dependencies": {
- "regenerator-runtime": "^0.13.11"
- },
- "exports": {
- "./helpers/AsyncGenerator": [
- {
- "node": "./helpers/AsyncGenerator.js",
- "import": "./helpers/esm/AsyncGenerator.js",
- "default": "./helpers/AsyncGenerator.js"
- },
- "./helpers/AsyncGenerator.js"
- ],
- "./helpers/esm/AsyncGenerator": "./helpers/esm/AsyncGenerator.js",
- "./helpers/OverloadYield": [
- {
- "node": "./helpers/OverloadYield.js",
- "import": "./helpers/esm/OverloadYield.js",
- "default": "./helpers/OverloadYield.js"
- },
- "./helpers/OverloadYield.js"
- ],
- "./helpers/esm/OverloadYield": "./helpers/esm/OverloadYield.js",
- "./helpers/applyDecs": [
- {
- "node": "./helpers/applyDecs.js",
- "import": "./helpers/esm/applyDecs.js",
- "default": "./helpers/applyDecs.js"
- },
- "./helpers/applyDecs.js"
- ],
- "./helpers/esm/applyDecs": "./helpers/esm/applyDecs.js",
- "./helpers/applyDecs2203": [
- {
- "node": "./helpers/applyDecs2203.js",
- "import": "./helpers/esm/applyDecs2203.js",
- "default": "./helpers/applyDecs2203.js"
- },
- "./helpers/applyDecs2203.js"
- ],
- "./helpers/esm/applyDecs2203": "./helpers/esm/applyDecs2203.js",
- "./helpers/asyncGeneratorDelegate": [
- {
- "node": "./helpers/asyncGeneratorDelegate.js",
- "import": "./helpers/esm/asyncGeneratorDelegate.js",
- "default": "./helpers/asyncGeneratorDelegate.js"
- },
- "./helpers/asyncGeneratorDelegate.js"
- ],
- "./helpers/esm/asyncGeneratorDelegate": "./helpers/esm/asyncGeneratorDelegate.js",
- "./helpers/asyncIterator": [
- {
- "node": "./helpers/asyncIterator.js",
- "import": "./helpers/esm/asyncIterator.js",
- "default": "./helpers/asyncIterator.js"
- },
- "./helpers/asyncIterator.js"
- ],
- "./helpers/esm/asyncIterator": "./helpers/esm/asyncIterator.js",
- "./helpers/awaitAsyncGenerator": [
- {
- "node": "./helpers/awaitAsyncGenerator.js",
- "import": "./helpers/esm/awaitAsyncGenerator.js",
- "default": "./helpers/awaitAsyncGenerator.js"
- },
- "./helpers/awaitAsyncGenerator.js"
- ],
- "./helpers/esm/awaitAsyncGenerator": "./helpers/esm/awaitAsyncGenerator.js",
- "./helpers/checkInRHS": [
- {
- "node": "./helpers/checkInRHS.js",
- "import": "./helpers/esm/checkInRHS.js",
- "default": "./helpers/checkInRHS.js"
- },
- "./helpers/checkInRHS.js"
- ],
- "./helpers/esm/checkInRHS": "./helpers/esm/checkInRHS.js",
- "./helpers/defineAccessor": [
- {
- "node": "./helpers/defineAccessor.js",
- "import": "./helpers/esm/defineAccessor.js",
- "default": "./helpers/defineAccessor.js"
- },
- "./helpers/defineAccessor.js"
- ],
- "./helpers/esm/defineAccessor": "./helpers/esm/defineAccessor.js",
- "./helpers/iterableToArrayLimit": [
- {
- "node": "./helpers/iterableToArrayLimit.js",
- "import": "./helpers/esm/iterableToArrayLimit.js",
- "default": "./helpers/iterableToArrayLimit.js"
- },
- "./helpers/iterableToArrayLimit.js"
- ],
- "./helpers/esm/iterableToArrayLimit": "./helpers/esm/iterableToArrayLimit.js",
- "./helpers/iterableToArrayLimitLoose": [
- {
- "node": "./helpers/iterableToArrayLimitLoose.js",
- "import": "./helpers/esm/iterableToArrayLimitLoose.js",
- "default": "./helpers/iterableToArrayLimitLoose.js"
- },
- "./helpers/iterableToArrayLimitLoose.js"
- ],
- "./helpers/esm/iterableToArrayLimitLoose": "./helpers/esm/iterableToArrayLimitLoose.js",
- "./helpers/jsx": [
- {
- "node": "./helpers/jsx.js",
- "import": "./helpers/esm/jsx.js",
- "default": "./helpers/jsx.js"
- },
- "./helpers/jsx.js"
- ],
- "./helpers/esm/jsx": "./helpers/esm/jsx.js",
- "./helpers/objectSpread2": [
- {
- "node": "./helpers/objectSpread2.js",
- "import": "./helpers/esm/objectSpread2.js",
- "default": "./helpers/objectSpread2.js"
- },
- "./helpers/objectSpread2.js"
- ],
- "./helpers/esm/objectSpread2": "./helpers/esm/objectSpread2.js",
- "./helpers/regeneratorRuntime": [
- {
- "node": "./helpers/regeneratorRuntime.js",
- "import": "./helpers/esm/regeneratorRuntime.js",
- "default": "./helpers/regeneratorRuntime.js"
- },
- "./helpers/regeneratorRuntime.js"
- ],
- "./helpers/esm/regeneratorRuntime": "./helpers/esm/regeneratorRuntime.js",
- "./helpers/typeof": [
- {
- "node": "./helpers/typeof.js",
- "import": "./helpers/esm/typeof.js",
- "default": "./helpers/typeof.js"
- },
- "./helpers/typeof.js"
- ],
- "./helpers/esm/typeof": "./helpers/esm/typeof.js",
- "./helpers/wrapRegExp": [
- {
- "node": "./helpers/wrapRegExp.js",
- "import": "./helpers/esm/wrapRegExp.js",
- "default": "./helpers/wrapRegExp.js"
- },
- "./helpers/wrapRegExp.js"
- ],
- "./helpers/esm/wrapRegExp": "./helpers/esm/wrapRegExp.js",
- "./helpers/AwaitValue": [
- {
- "node": "./helpers/AwaitValue.js",
- "import": "./helpers/esm/AwaitValue.js",
- "default": "./helpers/AwaitValue.js"
- },
- "./helpers/AwaitValue.js"
- ],
- "./helpers/esm/AwaitValue": "./helpers/esm/AwaitValue.js",
- "./helpers/wrapAsyncGenerator": [
- {
- "node": "./helpers/wrapAsyncGenerator.js",
- "import": "./helpers/esm/wrapAsyncGenerator.js",
- "default": "./helpers/wrapAsyncGenerator.js"
- },
- "./helpers/wrapAsyncGenerator.js"
- ],
- "./helpers/esm/wrapAsyncGenerator": "./helpers/esm/wrapAsyncGenerator.js",
- "./helpers/asyncToGenerator": [
- {
- "node": "./helpers/asyncToGenerator.js",
- "import": "./helpers/esm/asyncToGenerator.js",
- "default": "./helpers/asyncToGenerator.js"
- },
- "./helpers/asyncToGenerator.js"
- ],
- "./helpers/esm/asyncToGenerator": "./helpers/esm/asyncToGenerator.js",
- "./helpers/classCallCheck": [
- {
- "node": "./helpers/classCallCheck.js",
- "import": "./helpers/esm/classCallCheck.js",
- "default": "./helpers/classCallCheck.js"
- },
- "./helpers/classCallCheck.js"
- ],
- "./helpers/esm/classCallCheck": "./helpers/esm/classCallCheck.js",
- "./helpers/createClass": [
- {
- "node": "./helpers/createClass.js",
- "import": "./helpers/esm/createClass.js",
- "default": "./helpers/createClass.js"
- },
- "./helpers/createClass.js"
- ],
- "./helpers/esm/createClass": "./helpers/esm/createClass.js",
- "./helpers/defineEnumerableProperties": [
- {
- "node": "./helpers/defineEnumerableProperties.js",
- "import": "./helpers/esm/defineEnumerableProperties.js",
- "default": "./helpers/defineEnumerableProperties.js"
- },
- "./helpers/defineEnumerableProperties.js"
- ],
- "./helpers/esm/defineEnumerableProperties": "./helpers/esm/defineEnumerableProperties.js",
- "./helpers/defaults": [
- {
- "node": "./helpers/defaults.js",
- "import": "./helpers/esm/defaults.js",
- "default": "./helpers/defaults.js"
- },
- "./helpers/defaults.js"
- ],
- "./helpers/esm/defaults": "./helpers/esm/defaults.js",
- "./helpers/defineProperty": [
- {
- "node": "./helpers/defineProperty.js",
- "import": "./helpers/esm/defineProperty.js",
- "default": "./helpers/defineProperty.js"
- },
- "./helpers/defineProperty.js"
- ],
- "./helpers/esm/defineProperty": "./helpers/esm/defineProperty.js",
- "./helpers/extends": [
- {
- "node": "./helpers/extends.js",
- "import": "./helpers/esm/extends.js",
- "default": "./helpers/extends.js"
- },
- "./helpers/extends.js"
- ],
- "./helpers/esm/extends": "./helpers/esm/extends.js",
- "./helpers/objectSpread": [
- {
- "node": "./helpers/objectSpread.js",
- "import": "./helpers/esm/objectSpread.js",
- "default": "./helpers/objectSpread.js"
- },
- "./helpers/objectSpread.js"
- ],
- "./helpers/esm/objectSpread": "./helpers/esm/objectSpread.js",
- "./helpers/inherits": [
- {
- "node": "./helpers/inherits.js",
- "import": "./helpers/esm/inherits.js",
- "default": "./helpers/inherits.js"
- },
- "./helpers/inherits.js"
- ],
- "./helpers/esm/inherits": "./helpers/esm/inherits.js",
- "./helpers/inheritsLoose": [
- {
- "node": "./helpers/inheritsLoose.js",
- "import": "./helpers/esm/inheritsLoose.js",
- "default": "./helpers/inheritsLoose.js"
- },
- "./helpers/inheritsLoose.js"
- ],
- "./helpers/esm/inheritsLoose": "./helpers/esm/inheritsLoose.js",
- "./helpers/getPrototypeOf": [
- {
- "node": "./helpers/getPrototypeOf.js",
- "import": "./helpers/esm/getPrototypeOf.js",
- "default": "./helpers/getPrototypeOf.js"
- },
- "./helpers/getPrototypeOf.js"
- ],
- "./helpers/esm/getPrototypeOf": "./helpers/esm/getPrototypeOf.js",
- "./helpers/setPrototypeOf": [
- {
- "node": "./helpers/setPrototypeOf.js",
- "import": "./helpers/esm/setPrototypeOf.js",
- "default": "./helpers/setPrototypeOf.js"
- },
- "./helpers/setPrototypeOf.js"
- ],
- "./helpers/esm/setPrototypeOf": "./helpers/esm/setPrototypeOf.js",
- "./helpers/isNativeReflectConstruct": [
- {
- "node": "./helpers/isNativeReflectConstruct.js",
- "import": "./helpers/esm/isNativeReflectConstruct.js",
- "default": "./helpers/isNativeReflectConstruct.js"
- },
- "./helpers/isNativeReflectConstruct.js"
- ],
- "./helpers/esm/isNativeReflectConstruct": "./helpers/esm/isNativeReflectConstruct.js",
- "./helpers/construct": [
- {
- "node": "./helpers/construct.js",
- "import": "./helpers/esm/construct.js",
- "default": "./helpers/construct.js"
- },
- "./helpers/construct.js"
- ],
- "./helpers/esm/construct": "./helpers/esm/construct.js",
- "./helpers/isNativeFunction": [
- {
- "node": "./helpers/isNativeFunction.js",
- "import": "./helpers/esm/isNativeFunction.js",
- "default": "./helpers/isNativeFunction.js"
- },
- "./helpers/isNativeFunction.js"
- ],
- "./helpers/esm/isNativeFunction": "./helpers/esm/isNativeFunction.js",
- "./helpers/wrapNativeSuper": [
- {
- "node": "./helpers/wrapNativeSuper.js",
- "import": "./helpers/esm/wrapNativeSuper.js",
- "default": "./helpers/wrapNativeSuper.js"
- },
- "./helpers/wrapNativeSuper.js"
- ],
- "./helpers/esm/wrapNativeSuper": "./helpers/esm/wrapNativeSuper.js",
- "./helpers/instanceof": [
- {
- "node": "./helpers/instanceof.js",
- "import": "./helpers/esm/instanceof.js",
- "default": "./helpers/instanceof.js"
- },
- "./helpers/instanceof.js"
- ],
- "./helpers/esm/instanceof": "./helpers/esm/instanceof.js",
- "./helpers/interopRequireDefault": [
- {
- "node": "./helpers/interopRequireDefault.js",
- "import": "./helpers/esm/interopRequireDefault.js",
- "default": "./helpers/interopRequireDefault.js"
- },
- "./helpers/interopRequireDefault.js"
- ],
- "./helpers/esm/interopRequireDefault": "./helpers/esm/interopRequireDefault.js",
- "./helpers/interopRequireWildcard": [
- {
- "node": "./helpers/interopRequireWildcard.js",
- "import": "./helpers/esm/interopRequireWildcard.js",
- "default": "./helpers/interopRequireWildcard.js"
- },
- "./helpers/interopRequireWildcard.js"
- ],
- "./helpers/esm/interopRequireWildcard": "./helpers/esm/interopRequireWildcard.js",
- "./helpers/newArrowCheck": [
- {
- "node": "./helpers/newArrowCheck.js",
- "import": "./helpers/esm/newArrowCheck.js",
- "default": "./helpers/newArrowCheck.js"
- },
- "./helpers/newArrowCheck.js"
- ],
- "./helpers/esm/newArrowCheck": "./helpers/esm/newArrowCheck.js",
- "./helpers/objectDestructuringEmpty": [
- {
- "node": "./helpers/objectDestructuringEmpty.js",
- "import": "./helpers/esm/objectDestructuringEmpty.js",
- "default": "./helpers/objectDestructuringEmpty.js"
- },
- "./helpers/objectDestructuringEmpty.js"
- ],
- "./helpers/esm/objectDestructuringEmpty": "./helpers/esm/objectDestructuringEmpty.js",
- "./helpers/objectWithoutPropertiesLoose": [
- {
- "node": "./helpers/objectWithoutPropertiesLoose.js",
- "import": "./helpers/esm/objectWithoutPropertiesLoose.js",
- "default": "./helpers/objectWithoutPropertiesLoose.js"
- },
- "./helpers/objectWithoutPropertiesLoose.js"
- ],
- "./helpers/esm/objectWithoutPropertiesLoose": "./helpers/esm/objectWithoutPropertiesLoose.js",
- "./helpers/objectWithoutProperties": [
- {
- "node": "./helpers/objectWithoutProperties.js",
- "import": "./helpers/esm/objectWithoutProperties.js",
- "default": "./helpers/objectWithoutProperties.js"
- },
- "./helpers/objectWithoutProperties.js"
- ],
- "./helpers/esm/objectWithoutProperties": "./helpers/esm/objectWithoutProperties.js",
- "./helpers/assertThisInitialized": [
- {
- "node": "./helpers/assertThisInitialized.js",
- "import": "./helpers/esm/assertThisInitialized.js",
- "default": "./helpers/assertThisInitialized.js"
- },
- "./helpers/assertThisInitialized.js"
- ],
- "./helpers/esm/assertThisInitialized": "./helpers/esm/assertThisInitialized.js",
- "./helpers/possibleConstructorReturn": [
- {
- "node": "./helpers/possibleConstructorReturn.js",
- "import": "./helpers/esm/possibleConstructorReturn.js",
- "default": "./helpers/possibleConstructorReturn.js"
- },
- "./helpers/possibleConstructorReturn.js"
- ],
- "./helpers/esm/possibleConstructorReturn": "./helpers/esm/possibleConstructorReturn.js",
- "./helpers/createSuper": [
- {
- "node": "./helpers/createSuper.js",
- "import": "./helpers/esm/createSuper.js",
- "default": "./helpers/createSuper.js"
- },
- "./helpers/createSuper.js"
- ],
- "./helpers/esm/createSuper": "./helpers/esm/createSuper.js",
- "./helpers/superPropBase": [
- {
- "node": "./helpers/superPropBase.js",
- "import": "./helpers/esm/superPropBase.js",
- "default": "./helpers/superPropBase.js"
- },
- "./helpers/superPropBase.js"
- ],
- "./helpers/esm/superPropBase": "./helpers/esm/superPropBase.js",
- "./helpers/get": [
- {
- "node": "./helpers/get.js",
- "import": "./helpers/esm/get.js",
- "default": "./helpers/get.js"
- },
- "./helpers/get.js"
- ],
- "./helpers/esm/get": "./helpers/esm/get.js",
- "./helpers/set": [
- {
- "node": "./helpers/set.js",
- "import": "./helpers/esm/set.js",
- "default": "./helpers/set.js"
- },
- "./helpers/set.js"
- ],
- "./helpers/esm/set": "./helpers/esm/set.js",
- "./helpers/taggedTemplateLiteral": [
- {
- "node": "./helpers/taggedTemplateLiteral.js",
- "import": "./helpers/esm/taggedTemplateLiteral.js",
- "default": "./helpers/taggedTemplateLiteral.js"
- },
- "./helpers/taggedTemplateLiteral.js"
- ],
- "./helpers/esm/taggedTemplateLiteral": "./helpers/esm/taggedTemplateLiteral.js",
- "./helpers/taggedTemplateLiteralLoose": [
- {
- "node": "./helpers/taggedTemplateLiteralLoose.js",
- "import": "./helpers/esm/taggedTemplateLiteralLoose.js",
- "default": "./helpers/taggedTemplateLiteralLoose.js"
- },
- "./helpers/taggedTemplateLiteralLoose.js"
- ],
- "./helpers/esm/taggedTemplateLiteralLoose": "./helpers/esm/taggedTemplateLiteralLoose.js",
- "./helpers/readOnlyError": [
- {
- "node": "./helpers/readOnlyError.js",
- "import": "./helpers/esm/readOnlyError.js",
- "default": "./helpers/readOnlyError.js"
- },
- "./helpers/readOnlyError.js"
- ],
- "./helpers/esm/readOnlyError": "./helpers/esm/readOnlyError.js",
- "./helpers/writeOnlyError": [
- {
- "node": "./helpers/writeOnlyError.js",
- "import": "./helpers/esm/writeOnlyError.js",
- "default": "./helpers/writeOnlyError.js"
- },
- "./helpers/writeOnlyError.js"
- ],
- "./helpers/esm/writeOnlyError": "./helpers/esm/writeOnlyError.js",
- "./helpers/classNameTDZError": [
- {
- "node": "./helpers/classNameTDZError.js",
- "import": "./helpers/esm/classNameTDZError.js",
- "default": "./helpers/classNameTDZError.js"
- },
- "./helpers/classNameTDZError.js"
- ],
- "./helpers/esm/classNameTDZError": "./helpers/esm/classNameTDZError.js",
- "./helpers/temporalUndefined": [
- {
- "node": "./helpers/temporalUndefined.js",
- "import": "./helpers/esm/temporalUndefined.js",
- "default": "./helpers/temporalUndefined.js"
- },
- "./helpers/temporalUndefined.js"
- ],
- "./helpers/esm/temporalUndefined": "./helpers/esm/temporalUndefined.js",
- "./helpers/tdz": [
- {
- "node": "./helpers/tdz.js",
- "import": "./helpers/esm/tdz.js",
- "default": "./helpers/tdz.js"
- },
- "./helpers/tdz.js"
- ],
- "./helpers/esm/tdz": "./helpers/esm/tdz.js",
- "./helpers/temporalRef": [
- {
- "node": "./helpers/temporalRef.js",
- "import": "./helpers/esm/temporalRef.js",
- "default": "./helpers/temporalRef.js"
- },
- "./helpers/temporalRef.js"
- ],
- "./helpers/esm/temporalRef": "./helpers/esm/temporalRef.js",
- "./helpers/slicedToArray": [
- {
- "node": "./helpers/slicedToArray.js",
- "import": "./helpers/esm/slicedToArray.js",
- "default": "./helpers/slicedToArray.js"
- },
- "./helpers/slicedToArray.js"
- ],
- "./helpers/esm/slicedToArray": "./helpers/esm/slicedToArray.js",
- "./helpers/slicedToArrayLoose": [
- {
- "node": "./helpers/slicedToArrayLoose.js",
- "import": "./helpers/esm/slicedToArrayLoose.js",
- "default": "./helpers/slicedToArrayLoose.js"
- },
- "./helpers/slicedToArrayLoose.js"
- ],
- "./helpers/esm/slicedToArrayLoose": "./helpers/esm/slicedToArrayLoose.js",
- "./helpers/toArray": [
- {
- "node": "./helpers/toArray.js",
- "import": "./helpers/esm/toArray.js",
- "default": "./helpers/toArray.js"
- },
- "./helpers/toArray.js"
- ],
- "./helpers/esm/toArray": "./helpers/esm/toArray.js",
- "./helpers/toConsumableArray": [
- {
- "node": "./helpers/toConsumableArray.js",
- "import": "./helpers/esm/toConsumableArray.js",
- "default": "./helpers/toConsumableArray.js"
- },
- "./helpers/toConsumableArray.js"
- ],
- "./helpers/esm/toConsumableArray": "./helpers/esm/toConsumableArray.js",
- "./helpers/arrayWithoutHoles": [
- {
- "node": "./helpers/arrayWithoutHoles.js",
- "import": "./helpers/esm/arrayWithoutHoles.js",
- "default": "./helpers/arrayWithoutHoles.js"
- },
- "./helpers/arrayWithoutHoles.js"
- ],
- "./helpers/esm/arrayWithoutHoles": "./helpers/esm/arrayWithoutHoles.js",
- "./helpers/arrayWithHoles": [
- {
- "node": "./helpers/arrayWithHoles.js",
- "import": "./helpers/esm/arrayWithHoles.js",
- "default": "./helpers/arrayWithHoles.js"
- },
- "./helpers/arrayWithHoles.js"
- ],
- "./helpers/esm/arrayWithHoles": "./helpers/esm/arrayWithHoles.js",
- "./helpers/maybeArrayLike": [
- {
- "node": "./helpers/maybeArrayLike.js",
- "import": "./helpers/esm/maybeArrayLike.js",
- "default": "./helpers/maybeArrayLike.js"
- },
- "./helpers/maybeArrayLike.js"
- ],
- "./helpers/esm/maybeArrayLike": "./helpers/esm/maybeArrayLike.js",
- "./helpers/iterableToArray": [
- {
- "node": "./helpers/iterableToArray.js",
- "import": "./helpers/esm/iterableToArray.js",
- "default": "./helpers/iterableToArray.js"
- },
- "./helpers/iterableToArray.js"
- ],
- "./helpers/esm/iterableToArray": "./helpers/esm/iterableToArray.js",
- "./helpers/unsupportedIterableToArray": [
- {
- "node": "./helpers/unsupportedIterableToArray.js",
- "import": "./helpers/esm/unsupportedIterableToArray.js",
- "default": "./helpers/unsupportedIterableToArray.js"
- },
- "./helpers/unsupportedIterableToArray.js"
- ],
- "./helpers/esm/unsupportedIterableToArray": "./helpers/esm/unsupportedIterableToArray.js",
- "./helpers/arrayLikeToArray": [
- {
- "node": "./helpers/arrayLikeToArray.js",
- "import": "./helpers/esm/arrayLikeToArray.js",
- "default": "./helpers/arrayLikeToArray.js"
- },
- "./helpers/arrayLikeToArray.js"
- ],
- "./helpers/esm/arrayLikeToArray": "./helpers/esm/arrayLikeToArray.js",
- "./helpers/nonIterableSpread": [
- {
- "node": "./helpers/nonIterableSpread.js",
- "import": "./helpers/esm/nonIterableSpread.js",
- "default": "./helpers/nonIterableSpread.js"
- },
- "./helpers/nonIterableSpread.js"
- ],
- "./helpers/esm/nonIterableSpread": "./helpers/esm/nonIterableSpread.js",
- "./helpers/nonIterableRest": [
- {
- "node": "./helpers/nonIterableRest.js",
- "import": "./helpers/esm/nonIterableRest.js",
- "default": "./helpers/nonIterableRest.js"
- },
- "./helpers/nonIterableRest.js"
- ],
- "./helpers/esm/nonIterableRest": "./helpers/esm/nonIterableRest.js",
- "./helpers/createForOfIteratorHelper": [
- {
- "node": "./helpers/createForOfIteratorHelper.js",
- "import": "./helpers/esm/createForOfIteratorHelper.js",
- "default": "./helpers/createForOfIteratorHelper.js"
- },
- "./helpers/createForOfIteratorHelper.js"
- ],
- "./helpers/esm/createForOfIteratorHelper": "./helpers/esm/createForOfIteratorHelper.js",
- "./helpers/createForOfIteratorHelperLoose": [
- {
- "node": "./helpers/createForOfIteratorHelperLoose.js",
- "import": "./helpers/esm/createForOfIteratorHelperLoose.js",
- "default": "./helpers/createForOfIteratorHelperLoose.js"
- },
- "./helpers/createForOfIteratorHelperLoose.js"
- ],
- "./helpers/esm/createForOfIteratorHelperLoose": "./helpers/esm/createForOfIteratorHelperLoose.js",
- "./helpers/skipFirstGeneratorNext": [
- {
- "node": "./helpers/skipFirstGeneratorNext.js",
- "import": "./helpers/esm/skipFirstGeneratorNext.js",
- "default": "./helpers/skipFirstGeneratorNext.js"
- },
- "./helpers/skipFirstGeneratorNext.js"
- ],
- "./helpers/esm/skipFirstGeneratorNext": "./helpers/esm/skipFirstGeneratorNext.js",
- "./helpers/toPrimitive": [
- {
- "node": "./helpers/toPrimitive.js",
- "import": "./helpers/esm/toPrimitive.js",
- "default": "./helpers/toPrimitive.js"
- },
- "./helpers/toPrimitive.js"
- ],
- "./helpers/esm/toPrimitive": "./helpers/esm/toPrimitive.js",
- "./helpers/toPropertyKey": [
- {
- "node": "./helpers/toPropertyKey.js",
- "import": "./helpers/esm/toPropertyKey.js",
- "default": "./helpers/toPropertyKey.js"
- },
- "./helpers/toPropertyKey.js"
- ],
- "./helpers/esm/toPropertyKey": "./helpers/esm/toPropertyKey.js",
- "./helpers/initializerWarningHelper": [
- {
- "node": "./helpers/initializerWarningHelper.js",
- "import": "./helpers/esm/initializerWarningHelper.js",
- "default": "./helpers/initializerWarningHelper.js"
- },
- "./helpers/initializerWarningHelper.js"
- ],
- "./helpers/esm/initializerWarningHelper": "./helpers/esm/initializerWarningHelper.js",
- "./helpers/initializerDefineProperty": [
- {
- "node": "./helpers/initializerDefineProperty.js",
- "import": "./helpers/esm/initializerDefineProperty.js",
- "default": "./helpers/initializerDefineProperty.js"
- },
- "./helpers/initializerDefineProperty.js"
- ],
- "./helpers/esm/initializerDefineProperty": "./helpers/esm/initializerDefineProperty.js",
- "./helpers/applyDecoratedDescriptor": [
- {
- "node": "./helpers/applyDecoratedDescriptor.js",
- "import": "./helpers/esm/applyDecoratedDescriptor.js",
- "default": "./helpers/applyDecoratedDescriptor.js"
- },
- "./helpers/applyDecoratedDescriptor.js"
- ],
- "./helpers/esm/applyDecoratedDescriptor": "./helpers/esm/applyDecoratedDescriptor.js",
- "./helpers/classPrivateFieldLooseKey": [
- {
- "node": "./helpers/classPrivateFieldLooseKey.js",
- "import": "./helpers/esm/classPrivateFieldLooseKey.js",
- "default": "./helpers/classPrivateFieldLooseKey.js"
- },
- "./helpers/classPrivateFieldLooseKey.js"
- ],
- "./helpers/esm/classPrivateFieldLooseKey": "./helpers/esm/classPrivateFieldLooseKey.js",
- "./helpers/classPrivateFieldLooseBase": [
- {
- "node": "./helpers/classPrivateFieldLooseBase.js",
- "import": "./helpers/esm/classPrivateFieldLooseBase.js",
- "default": "./helpers/classPrivateFieldLooseBase.js"
- },
- "./helpers/classPrivateFieldLooseBase.js"
- ],
- "./helpers/esm/classPrivateFieldLooseBase": "./helpers/esm/classPrivateFieldLooseBase.js",
- "./helpers/classPrivateFieldGet": [
- {
- "node": "./helpers/classPrivateFieldGet.js",
- "import": "./helpers/esm/classPrivateFieldGet.js",
- "default": "./helpers/classPrivateFieldGet.js"
- },
- "./helpers/classPrivateFieldGet.js"
- ],
- "./helpers/esm/classPrivateFieldGet": "./helpers/esm/classPrivateFieldGet.js",
- "./helpers/classPrivateFieldSet": [
- {
- "node": "./helpers/classPrivateFieldSet.js",
- "import": "./helpers/esm/classPrivateFieldSet.js",
- "default": "./helpers/classPrivateFieldSet.js"
- },
- "./helpers/classPrivateFieldSet.js"
- ],
- "./helpers/esm/classPrivateFieldSet": "./helpers/esm/classPrivateFieldSet.js",
- "./helpers/classPrivateFieldDestructureSet": [
- {
- "node": "./helpers/classPrivateFieldDestructureSet.js",
- "import": "./helpers/esm/classPrivateFieldDestructureSet.js",
- "default": "./helpers/classPrivateFieldDestructureSet.js"
- },
- "./helpers/classPrivateFieldDestructureSet.js"
- ],
- "./helpers/esm/classPrivateFieldDestructureSet": "./helpers/esm/classPrivateFieldDestructureSet.js",
- "./helpers/classExtractFieldDescriptor": [
- {
- "node": "./helpers/classExtractFieldDescriptor.js",
- "import": "./helpers/esm/classExtractFieldDescriptor.js",
- "default": "./helpers/classExtractFieldDescriptor.js"
- },
- "./helpers/classExtractFieldDescriptor.js"
- ],
- "./helpers/esm/classExtractFieldDescriptor": "./helpers/esm/classExtractFieldDescriptor.js",
- "./helpers/classStaticPrivateFieldSpecGet": [
- {
- "node": "./helpers/classStaticPrivateFieldSpecGet.js",
- "import": "./helpers/esm/classStaticPrivateFieldSpecGet.js",
- "default": "./helpers/classStaticPrivateFieldSpecGet.js"
- },
- "./helpers/classStaticPrivateFieldSpecGet.js"
- ],
- "./helpers/esm/classStaticPrivateFieldSpecGet": "./helpers/esm/classStaticPrivateFieldSpecGet.js",
- "./helpers/classStaticPrivateFieldSpecSet": [
- {
- "node": "./helpers/classStaticPrivateFieldSpecSet.js",
- "import": "./helpers/esm/classStaticPrivateFieldSpecSet.js",
- "default": "./helpers/classStaticPrivateFieldSpecSet.js"
- },
- "./helpers/classStaticPrivateFieldSpecSet.js"
- ],
- "./helpers/esm/classStaticPrivateFieldSpecSet": "./helpers/esm/classStaticPrivateFieldSpecSet.js",
- "./helpers/classStaticPrivateMethodGet": [
- {
- "node": "./helpers/classStaticPrivateMethodGet.js",
- "import": "./helpers/esm/classStaticPrivateMethodGet.js",
- "default": "./helpers/classStaticPrivateMethodGet.js"
- },
- "./helpers/classStaticPrivateMethodGet.js"
- ],
- "./helpers/esm/classStaticPrivateMethodGet": "./helpers/esm/classStaticPrivateMethodGet.js",
- "./helpers/classStaticPrivateMethodSet": [
- {
- "node": "./helpers/classStaticPrivateMethodSet.js",
- "import": "./helpers/esm/classStaticPrivateMethodSet.js",
- "default": "./helpers/classStaticPrivateMethodSet.js"
- },
- "./helpers/classStaticPrivateMethodSet.js"
- ],
- "./helpers/esm/classStaticPrivateMethodSet": "./helpers/esm/classStaticPrivateMethodSet.js",
- "./helpers/classApplyDescriptorGet": [
- {
- "node": "./helpers/classApplyDescriptorGet.js",
- "import": "./helpers/esm/classApplyDescriptorGet.js",
- "default": "./helpers/classApplyDescriptorGet.js"
- },
- "./helpers/classApplyDescriptorGet.js"
- ],
- "./helpers/esm/classApplyDescriptorGet": "./helpers/esm/classApplyDescriptorGet.js",
- "./helpers/classApplyDescriptorSet": [
- {
- "node": "./helpers/classApplyDescriptorSet.js",
- "import": "./helpers/esm/classApplyDescriptorSet.js",
- "default": "./helpers/classApplyDescriptorSet.js"
- },
- "./helpers/classApplyDescriptorSet.js"
- ],
- "./helpers/esm/classApplyDescriptorSet": "./helpers/esm/classApplyDescriptorSet.js",
- "./helpers/classApplyDescriptorDestructureSet": [
- {
- "node": "./helpers/classApplyDescriptorDestructureSet.js",
- "import": "./helpers/esm/classApplyDescriptorDestructureSet.js",
- "default": "./helpers/classApplyDescriptorDestructureSet.js"
- },
- "./helpers/classApplyDescriptorDestructureSet.js"
- ],
- "./helpers/esm/classApplyDescriptorDestructureSet": "./helpers/esm/classApplyDescriptorDestructureSet.js",
- "./helpers/classStaticPrivateFieldDestructureSet": [
- {
- "node": "./helpers/classStaticPrivateFieldDestructureSet.js",
- "import": "./helpers/esm/classStaticPrivateFieldDestructureSet.js",
- "default": "./helpers/classStaticPrivateFieldDestructureSet.js"
- },
- "./helpers/classStaticPrivateFieldDestructureSet.js"
- ],
- "./helpers/esm/classStaticPrivateFieldDestructureSet": "./helpers/esm/classStaticPrivateFieldDestructureSet.js",
- "./helpers/classCheckPrivateStaticAccess": [
- {
- "node": "./helpers/classCheckPrivateStaticAccess.js",
- "import": "./helpers/esm/classCheckPrivateStaticAccess.js",
- "default": "./helpers/classCheckPrivateStaticAccess.js"
- },
- "./helpers/classCheckPrivateStaticAccess.js"
- ],
- "./helpers/esm/classCheckPrivateStaticAccess": "./helpers/esm/classCheckPrivateStaticAccess.js",
- "./helpers/classCheckPrivateStaticFieldDescriptor": [
- {
- "node": "./helpers/classCheckPrivateStaticFieldDescriptor.js",
- "import": "./helpers/esm/classCheckPrivateStaticFieldDescriptor.js",
- "default": "./helpers/classCheckPrivateStaticFieldDescriptor.js"
- },
- "./helpers/classCheckPrivateStaticFieldDescriptor.js"
- ],
- "./helpers/esm/classCheckPrivateStaticFieldDescriptor": "./helpers/esm/classCheckPrivateStaticFieldDescriptor.js",
- "./helpers/decorate": [
- {
- "node": "./helpers/decorate.js",
- "import": "./helpers/esm/decorate.js",
- "default": "./helpers/decorate.js"
- },
- "./helpers/decorate.js"
- ],
- "./helpers/esm/decorate": "./helpers/esm/decorate.js",
- "./helpers/classPrivateMethodGet": [
- {
- "node": "./helpers/classPrivateMethodGet.js",
- "import": "./helpers/esm/classPrivateMethodGet.js",
- "default": "./helpers/classPrivateMethodGet.js"
- },
- "./helpers/classPrivateMethodGet.js"
- ],
- "./helpers/esm/classPrivateMethodGet": "./helpers/esm/classPrivateMethodGet.js",
- "./helpers/checkPrivateRedeclaration": [
- {
- "node": "./helpers/checkPrivateRedeclaration.js",
- "import": "./helpers/esm/checkPrivateRedeclaration.js",
- "default": "./helpers/checkPrivateRedeclaration.js"
- },
- "./helpers/checkPrivateRedeclaration.js"
- ],
- "./helpers/esm/checkPrivateRedeclaration": "./helpers/esm/checkPrivateRedeclaration.js",
- "./helpers/classPrivateFieldInitSpec": [
- {
- "node": "./helpers/classPrivateFieldInitSpec.js",
- "import": "./helpers/esm/classPrivateFieldInitSpec.js",
- "default": "./helpers/classPrivateFieldInitSpec.js"
- },
- "./helpers/classPrivateFieldInitSpec.js"
- ],
- "./helpers/esm/classPrivateFieldInitSpec": "./helpers/esm/classPrivateFieldInitSpec.js",
- "./helpers/classPrivateMethodInitSpec": [
- {
- "node": "./helpers/classPrivateMethodInitSpec.js",
- "import": "./helpers/esm/classPrivateMethodInitSpec.js",
- "default": "./helpers/classPrivateMethodInitSpec.js"
- },
- "./helpers/classPrivateMethodInitSpec.js"
- ],
- "./helpers/esm/classPrivateMethodInitSpec": "./helpers/esm/classPrivateMethodInitSpec.js",
- "./helpers/classPrivateMethodSet": [
- {
- "node": "./helpers/classPrivateMethodSet.js",
- "import": "./helpers/esm/classPrivateMethodSet.js",
- "default": "./helpers/classPrivateMethodSet.js"
- },
- "./helpers/classPrivateMethodSet.js"
- ],
- "./helpers/esm/classPrivateMethodSet": "./helpers/esm/classPrivateMethodSet.js",
- "./helpers/identity": [
- {
- "node": "./helpers/identity.js",
- "import": "./helpers/esm/identity.js",
- "default": "./helpers/identity.js"
- },
- "./helpers/identity.js"
- ],
- "./helpers/esm/identity": "./helpers/esm/identity.js",
- "./package": "./package.json",
- "./package.json": "./package.json",
- "./regenerator": "./regenerator/index.js",
- "./regenerator/*.js": "./regenerator/*.js",
- "./regenerator/": "./regenerator/"
- },
- "engines": {
- "node": ">=6.9.0"
- },
- "type": "commonjs"
-}
\ No newline at end of file
diff --git a/project starter code/node_modules/@babel/runtime/regenerator/index.js b/project starter code/node_modules/@babel/runtime/regenerator/index.js
deleted file mode 100644
index 58813573..00000000
--- a/project starter code/node_modules/@babel/runtime/regenerator/index.js
+++ /dev/null
@@ -1,15 +0,0 @@
-// TODO(Babel 8): Remove this file.
-
-var runtime = require("../helpers/regeneratorRuntime")();
-module.exports = runtime;
-
-// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
-try {
- regeneratorRuntime = runtime;
-} catch (accidentalStrictMode) {
- if (typeof globalThis === "object") {
- globalThis.regeneratorRuntime = runtime;
- } else {
- Function("r", "regeneratorRuntime = r")(runtime);
- }
-}
diff --git a/project starter code/node_modules/@jimp/bmp/CHANGELOG.md b/project starter code/node_modules/@jimp/bmp/CHANGELOG.md
index 26394e0f..3d839517 100644
--- a/project starter code/node_modules/@jimp/bmp/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/bmp/CHANGELOG.md
@@ -1,3 +1,65 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +74,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +82,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/bmp/dist/index.js b/project starter code/node_modules/@jimp/bmp/dist/index.js
index 977f85d0..e0ff7281 100644
--- a/project starter code/node_modules/@jimp/bmp/dist/index.js
+++ b/project starter code/node_modules/@jimp/bmp/dist/index.js
@@ -1,71 +1,60 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
+exports.default = void 0;
var _bmpJs = _interopRequireDefault(require("bmp-js"));
-
var _utils = require("@jimp/utils");
-
-var MIME_TYPE = 'image/bmp';
-var MIME_TYPE_SECOND = 'image/x-ms-bmp';
-
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+const MIME_TYPE = "image/bmp";
+const MIME_TYPE_SECOND = "image/x-ms-bmp";
function toAGBR(image) {
return (0, _utils.scan)(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) {
- var red = this.bitmap.data[index + 0];
- var green = this.bitmap.data[index + 1];
- var blue = this.bitmap.data[index + 2];
- var alpha = this.bitmap.data[index + 3];
+ const red = this.bitmap.data[index + 0];
+ const green = this.bitmap.data[index + 1];
+ const blue = this.bitmap.data[index + 2];
+ const alpha = this.bitmap.data[index + 3];
this.bitmap.data[index + 0] = alpha;
this.bitmap.data[index + 1] = blue;
this.bitmap.data[index + 2] = green;
this.bitmap.data[index + 3] = red;
}).bitmap;
}
-
function fromAGBR(bitmap) {
return (0, _utils.scan)({
- bitmap: bitmap
+ bitmap
}, 0, 0, bitmap.width, bitmap.height, function (x, y, index) {
- var alpha = this.bitmap.data[index + 0];
- var blue = this.bitmap.data[index + 1];
- var green = this.bitmap.data[index + 2];
- var red = this.bitmap.data[index + 3];
+ const alpha = this.bitmap.data[index + 0];
+ const blue = this.bitmap.data[index + 1];
+ const green = this.bitmap.data[index + 2];
+ const red = this.bitmap.data[index + 3];
this.bitmap.data[index + 0] = red;
this.bitmap.data[index + 1] = green;
this.bitmap.data[index + 2] = blue;
this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;
}).bitmap;
}
-
-var decode = function decode(data) {
- return fromAGBR(_bmpJs["default"].decode(data));
-};
-
-var encode = function encode(image) {
- return _bmpJs["default"].encode(toAGBR(image)).data;
-};
-
-var _default = function _default() {
- var _decoders, _encoders;
-
- return {
- mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['bmp']),
- constants: {
- MIME_BMP: MIME_TYPE,
- MIME_X_MS_BMP: MIME_TYPE_SECOND
- },
- decoders: (_decoders = {}, (0, _defineProperty2["default"])(_decoders, MIME_TYPE, decode), (0, _defineProperty2["default"])(_decoders, MIME_TYPE_SECOND, decode), _decoders),
- encoders: (_encoders = {}, (0, _defineProperty2["default"])(_encoders, MIME_TYPE, encode), (0, _defineProperty2["default"])(_encoders, MIME_TYPE_SECOND, encode), _encoders)
- };
-};
-
-exports["default"] = _default;
+const decode = data => fromAGBR(_bmpJs.default.decode(data));
+const encode = image => _bmpJs.default.encode(toAGBR(image)).data;
+var _default = () => ({
+ mime: {
+ [MIME_TYPE]: ["bmp"]
+ },
+ constants: {
+ MIME_BMP: MIME_TYPE,
+ MIME_X_MS_BMP: MIME_TYPE_SECOND
+ },
+ decoders: {
+ [MIME_TYPE]: decode,
+ [MIME_TYPE_SECOND]: decode
+ },
+ encoders: {
+ [MIME_TYPE]: encode,
+ [MIME_TYPE_SECOND]: encode
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/bmp/dist/index.js.map b/project starter code/node_modules/@jimp/bmp/dist/index.js.map
index ea487cba..b810a98b 100644
--- a/project starter code/node_modules/@jimp/bmp/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/bmp/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","BMP","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;AACA,IAAMC,gBAAgB,GAAG,gBAAzB;;AAEA,SAASC,MAAT,CAAgBC,KAAhB,EAAuB;AACrB,SAAO,iBAAKA,KAAL,EAAY,CAAZ,EAAe,CAAf,EAAkBA,KAAK,CAACC,MAAN,CAAaC,KAA/B,EAAsCF,KAAK,CAACC,MAAN,CAAaE,MAAnD,EAA2D,UAChEC,CADgE,EAEhEC,CAFgE,EAGhEC,KAHgE,EAIhE;AACA,QAAMC,GAAG,GAAG,KAAKN,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAZ;AACA,QAAMG,KAAK,GAAG,KAAKR,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAd;AACA,QAAMI,IAAI,GAAG,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAb;AACA,QAAMK,KAAK,GAAG,KAAKV,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAd;AAEA,SAAKL,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BK,KAA9B;AACA,SAAKV,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GA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AQ,CAACG,kBAAID,MAAJ,CAAWN,IAAX,CAAD,CAAZ;AAAA,CAAnB;;AACA,IAAMQ,MAAM,GAAG,SAATA,MAAS,CAAAhB,KAAK;AAAA,SAAIe,kBAAIC,MAAJ,CAAWjB,MAAM,CAACC,KAAD,CAAjB,EAA0BQ,IAA9B;AAAA,CAApB;;eAEe;AAAA;;AAAA,SAAO;AACpBS,IAAAA,IAAI,uCAAKpB,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBqB,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAEtB,SADD;AAETuB,MAAAA,aAAa,EAAEtB;AAFN,KAHS;AAQpBuB,IAAAA,QAAQ,+DACLxB,SADK,EACOiB,MADP,+CAELhB,gBAFK,EAEcgB,MAFd,aARY;AAapBQ,IAAAA,QAAQ,+DACLzB,SADK,EACOmB,MADP,+CAELlB,gBAFK,EAEckB,MAFd;AAbY,GAAP;AAAA,C","sourcesContent":["import BMP from 'bmp-js';\nimport { scan } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/bmp';\nconst MIME_TYPE_SECOND = 'image/x-ms-bmp';\n\nfunction toAGBR(image) {\n return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function(\n x,\n y,\n index\n ) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan({ bitmap }, 0, 0, bitmap.width, bitmap.height, function(\n x,\n y,\n index\n ) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }).bitmap;\n}\n\nconst decode = data => fromAGBR(BMP.decode(data));\nconst encode = image => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['bmp'] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","scan","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","BMP","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"sources":["../src/index.js"],"sourcesContent":["import BMP from \"bmp-js\";\nimport { scan } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/bmp\";\nconst MIME_TYPE_SECOND = \"image/x-ms-bmp\";\n\nfunction toAGBR(image) {\n return scan(\n image,\n 0,\n 0,\n image.bitmap.width,\n image.bitmap.height,\n function (x, y, index) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }\n ).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan(\n { bitmap },\n 0,\n 0,\n bitmap.width,\n bitmap.height,\n function (x, y, index) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }\n ).bitmap;\n}\n\nconst decode = (data) => fromAGBR(BMP.decode(data));\nconst encode = (image) => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"bmp\"] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND,\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode,\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode,\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAAmC;AAEnC,MAAMA,SAAS,GAAG,WAAW;AAC7B,MAAMC,gBAAgB,GAAG,gBAAgB;AAEzC,SAASC,MAAM,CAACC,KAAK,EAAE;EACrB,OAAO,IAAAC,WAAI,EACTD,KAAK,EACL,CAAC,EACD,CAAC,EACDA,KAAK,CAACE,MAAM,CAACC,KAAK,EAClBH,KAAK,CAACE,MAAM,CAACE,MAAM,EACnB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,KAAK,EAAE;IACrB,MAAMC,GAAG,GAAG,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC;IACvC,MAAMG,KAAK,GAAG,IAAI,CAACR,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC;IACzC,MAAMI,IAAI,GAAG,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC;IACxC,MAAMK,KAAK,GAAG,IAAI,CAACV,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC;IAEzC,IAAI,CAACL,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGK,KAAK;IACnC,IAAI,CAACV,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGI,IAAI;IAClC,IAAI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AM,GAAIjB,KAAK,IAAKgB,cAAG,CAACC,MAAM,CAAClB,MAAM,CAACC,KAAK,CAAC,CAAC,CAACS,IAAI;AAAC,eAE1C,OAAO;EACpBS,IAAI,EAAE;IAAE,CAACrB,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BsB,SAAS,EAAE;IACTC,QAAQ,EAAEvB,SAAS;IACnBwB,aAAa,EAAEvB;EACjB,CAAC;EAEDwB,QAAQ,EAAE;IACR,CAACzB,SAAS,GAAGkB,MAAM;IACnB,CAACjB,gBAAgB,GAAGiB;EACtB,CAAC;EAEDQ,QAAQ,EAAE;IACR,CAAC1B,SAAS,GAAGoB,MAAM;IACnB,CAACnB,gBAAgB,GAAGmB;EACtB;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/bmp/es/index.js b/project starter code/node_modules/@jimp/bmp/es/index.js
index ca54f0f3..f4dd9861 100644
--- a/project starter code/node_modules/@jimp/bmp/es/index.js
+++ b/project starter code/node_modules/@jimp/bmp/es/index.js
@@ -1,70 +1,50 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _bmpJs = _interopRequireDefault(require("bmp-js"));
-
-var _utils = require("@jimp/utils");
-
-var MIME_TYPE = 'image/bmp';
-var MIME_TYPE_SECOND = 'image/x-ms-bmp';
-
+import BMP from "bmp-js";
+import { scan } from "@jimp/utils";
+const MIME_TYPE = "image/bmp";
+const MIME_TYPE_SECOND = "image/x-ms-bmp";
function toAGBR(image) {
- return (0, _utils.scan)(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) {
- var red = this.bitmap.data[index + 0];
- var green = this.bitmap.data[index + 1];
- var blue = this.bitmap.data[index + 2];
- var alpha = this.bitmap.data[index + 3];
+ return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) {
+ const red = this.bitmap.data[index + 0];
+ const green = this.bitmap.data[index + 1];
+ const blue = this.bitmap.data[index + 2];
+ const alpha = this.bitmap.data[index + 3];
this.bitmap.data[index + 0] = alpha;
this.bitmap.data[index + 1] = blue;
this.bitmap.data[index + 2] = green;
this.bitmap.data[index + 3] = red;
}).bitmap;
}
-
function fromAGBR(bitmap) {
- return (0, _utils.scan)({
- bitmap: bitmap
+ return scan({
+ bitmap
}, 0, 0, bitmap.width, bitmap.height, function (x, y, index) {
- var alpha = this.bitmap.data[index + 0];
- var blue = this.bitmap.data[index + 1];
- var green = this.bitmap.data[index + 2];
- var red = this.bitmap.data[index + 3];
+ const alpha = this.bitmap.data[index + 0];
+ const blue = this.bitmap.data[index + 1];
+ const green = this.bitmap.data[index + 2];
+ const red = this.bitmap.data[index + 3];
this.bitmap.data[index + 0] = red;
this.bitmap.data[index + 1] = green;
this.bitmap.data[index + 2] = blue;
this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;
}).bitmap;
}
-
-var decode = function decode(data) {
- return fromAGBR(_bmpJs["default"].decode(data));
-};
-
-var encode = function encode(image) {
- return _bmpJs["default"].encode(toAGBR(image)).data;
-};
-
-var _default = function _default() {
- var _decoders, _encoders;
-
- return {
- mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['bmp']),
- constants: {
- MIME_BMP: MIME_TYPE,
- MIME_X_MS_BMP: MIME_TYPE_SECOND
- },
- decoders: (_decoders = {}, (0, _defineProperty2["default"])(_decoders, MIME_TYPE, decode), (0, _defineProperty2["default"])(_decoders, MIME_TYPE_SECOND, decode), _decoders),
- encoders: (_encoders = {}, (0, _defineProperty2["default"])(_encoders, MIME_TYPE, encode), (0, _defineProperty2["default"])(_encoders, MIME_TYPE_SECOND, encode), _encoders)
- };
-};
-
-exports["default"] = _default;
+const decode = data => fromAGBR(BMP.decode(data));
+const encode = image => BMP.encode(toAGBR(image)).data;
+export default (() => ({
+ mime: {
+ [MIME_TYPE]: ["bmp"]
+ },
+ constants: {
+ MIME_BMP: MIME_TYPE,
+ MIME_X_MS_BMP: MIME_TYPE_SECOND
+ },
+ decoders: {
+ [MIME_TYPE]: decode,
+ [MIME_TYPE_SECOND]: decode
+ },
+ encoders: {
+ [MIME_TYPE]: encode,
+ [MIME_TYPE_SECOND]: encode
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/bmp/es/index.js.map b/project starter code/node_modules/@jimp/bmp/es/index.js.map
index ea487cba..56d4859c 100644
--- a/project starter code/node_modules/@jimp/bmp/es/index.js.map
+++ b/project starter code/node_modules/@jimp/bmp/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","BMP","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;AACA,IAAMC,gBAAgB,GAAG,gBAAzB;;AAEA,SAASC,MAAT,CAAgBC,KAAhB,EAAuB;AACrB,SAAO,iBAAKA,KAAL,EAAY,CAAZ,EAAe,CAAf,EAAkBA,KAAK,CAACC,MAAN,CAAaC,KAA/B,EAAsCF,KAAK,CAACC,MAAN,CAAaE,MAAnD,EAA2D,UAChEC,CADgE,EAEhEC,CAFgE,EAGhEC,KAHgE,EAIhE;AACA,QAAMC,GAAG,GAAG,KAAKN,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAZ;AACA,QAAMG,KAAK,GAAG,KAAKR,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAd;AACA,QAAMI,IAAI,GAAG,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAb;A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ACA,SAAKT,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BL,MAAM,CAACY,aAAP,GAAuBF,KAAvB,GAA+B,IAA7D;AACD,GAdM,EAcJV,MAdH;AAeD;;AAED,IAAMa,MAAM,GAAG,SAATA,MAAS,CAAAN,IAAI;AAAA,SAAII,QAAQ,CAACG,kBAAID,MAAJ,CAAWN,IAAX,CAAD,CAAZ;AAAA,CAAnB;;AACA,IAAMQ,MAAM,GAAG,SAATA,MAAS,CAAAhB,KAAK;AAAA,SAAIe,kBAAIC,MAAJ,CAAWjB,MAAM,CAACC,KAAD,CAAjB,EAA0BQ,IAA9B;AAAA,CAApB;;eAEe;AAAA;;AAAA,SAAO;AACpBS,IAAAA,IAAI,uCAAKpB,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBqB,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAEtB,SADD;AAETuB,MAAAA,aAAa,EAAEtB;AAFN,KAHS;AAQpBuB,IAAAA,QAAQ,+DACLxB,SADK,EACOiB,MADP,+CAELhB,gBAFK,EAEcgB,MAFd,aARY;AAapBQ,IAAAA,QAAQ,+DACLzB,SADK,EACOmB,MADP,+CAELlB,gBAFK,EAEckB,MAFd;AAbY,GAAP;AAAA,C","sourcesContent":["import BMP from 'bmp-js';\nimport { scan } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/bmp';\nconst MIME_TYPE_SECOND = 'image/x-ms-bmp';\n\nfunction toAGBR(image) {\n return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function(\n x,\n y,\n index\n ) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan({ bitmap }, 0, 0, bitmap.width, bitmap.height, function(\n x,\n y,\n index\n ) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }).bitmap;\n}\n\nconst decode = data => fromAGBR(BMP.decode(data));\nconst encode = image => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['bmp'] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["BMP","scan","MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"sources":["../src/index.js"],"sourcesContent":["import BMP from \"bmp-js\";\nimport { scan } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/bmp\";\nconst MIME_TYPE_SECOND = \"image/x-ms-bmp\";\n\nfunction toAGBR(image) {\n return scan(\n image,\n 0,\n 0,\n image.bitmap.width,\n image.bitmap.height,\n function (x, y, index) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }\n ).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan(\n { bitmap },\n 0,\n 0,\n bitmap.width,\n bitmap.height,\n function (x, y, index) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }\n ).bitmap;\n}\n\nconst decode = (data) => fromAGBR(BMP.decode(data));\nconst encode = (image) => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"bmp\"] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND,\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode,\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode,\n },\n});\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,QAAQ;AACxB,SAASC,IAAI,QAAQ,aAAa;AAElC,MAAMC,SAAS,GAAG,WAAW;AAC7B,MAAMC,gBAAgB,GAAG,gBAAgB;AAEzC,SAASC,MAAM,CAACC,KAAK,EAAE;EACrB,OAAOJ,IAAI,CACTI,KAAK,EACL,CAAC,EACD,CAAC,EACDA,KAAK,CAACC,MAAM,CAACC,KAAK,EAClBF,KAAK,CAACC,MAAM,CAACE,MAAM,EACnB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,KAAK,EAAE;IACrB,MAAMC,GAAG,GAAG,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC;IACvC,MAAMG,KAAK,GAAG,IAAI,CAACR,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC;IACzC,MAAMI,IAAI,GAAG,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC;IACxC,MAAMK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CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGL,MAAM,CAACY,aAAa,GAAGF,KAAK,GAAG,IAAI;EACnE,CAAC,CACF,CAACV,MAAM;AACV;AAEA,MAAMa,MAAM,GAAIN,IAAI,IAAKI,QAAQ,CAACjB,GAAG,CAACmB,MAAM,CAACN,IAAI,CAAC,CAAC;AACnD,MAAMO,MAAM,GAAIf,KAAK,IAAKL,GAAG,CAACoB,MAAM,CAAChB,MAAM,CAACC,KAAK,CAAC,CAAC,CAACQ,IAAI;AAExD,gBAAe,OAAO;EACpBQ,IAAI,EAAE;IAAE,CAACnB,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BoB,SAAS,EAAE;IACTC,QAAQ,EAAErB,SAAS;IACnBsB,aAAa,EAAErB;EACjB,CAAC;EAEDsB,QAAQ,EAAE;IACR,CAACvB,SAAS,GAAGiB,MAAM;IACnB,CAAChB,gBAAgB,GAAGgB;EACtB,CAAC;EAEDO,QAAQ,EAAE;IACR,CAACxB,SAAS,GAAGkB,MAAM;IACnB,CAACjB,gBAAgB,GAAGiB;EACtB;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/bmp/index.d.ts b/project starter code/node_modules/@jimp/bmp/index.d.ts
index bbb9baec..0a9b9a51 100644
--- a/project starter code/node_modules/@jimp/bmp/index.d.ts
+++ b/project starter code/node_modules/@jimp/bmp/index.d.ts
@@ -1,24 +1,24 @@
-import { DecoderFn, EncoderFn } from '@jimp/core';
+import { DecoderFn, EncoderFn } from "@jimp/core";
interface Bmp {
constants: {
- MIME_BMP: 'image/bmp';
- MIME_X_MS_BMP: 'image/x-ms-bmp';
- }
+ MIME_BMP: "image/bmp";
+ MIME_X_MS_BMP: "image/x-ms-bmp";
+ };
mime: {
- 'image/bmp': string[]
- }
+ "image/bmp": string[];
+ };
decoders: {
- 'image/bmp': DecoderFn
- 'image/x-ms-bmp': DecoderFn
- }
+ "image/bmp": DecoderFn;
+ "image/x-ms-bmp": DecoderFn;
+ };
encoders: {
- 'image/bmp': EncoderFn
- 'image/x-ms-bmp': EncoderFn
- }
+ "image/bmp": EncoderFn;
+ "image/x-ms-bmp": EncoderFn;
+ };
}
-export default function(): Bmp;
+export default function (): Bmp;
diff --git a/project starter code/node_modules/@jimp/bmp/package.json b/project starter code/node_modules/@jimp/bmp/package.json
index 4d3bc24c..c3b6f766 100644
--- a/project starter code/node_modules/@jimp/bmp/package.json
+++ b/project starter code/node_modules/@jimp/bmp/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/bmp",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Default Jimp bmp encoder/decoder.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,19 +21,18 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
+ "@jimp/utils": "^0.22.12",
"bmp-js": "^0.1.0"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/bmp/src/index.js b/project starter code/node_modules/@jimp/bmp/src/index.js
index 897da77a..12fe2c79 100644
--- a/project starter code/node_modules/@jimp/bmp/src/index.js
+++ b/project starter code/node_modules/@jimp/bmp/src/index.js
@@ -1,63 +1,69 @@
-import BMP from 'bmp-js';
-import { scan } from '@jimp/utils';
+import BMP from "bmp-js";
+import { scan } from "@jimp/utils";
-const MIME_TYPE = 'image/bmp';
-const MIME_TYPE_SECOND = 'image/x-ms-bmp';
+const MIME_TYPE = "image/bmp";
+const MIME_TYPE_SECOND = "image/x-ms-bmp";
function toAGBR(image) {
- return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function(
- x,
- y,
- index
- ) {
- const red = this.bitmap.data[index + 0];
- const green = this.bitmap.data[index + 1];
- const blue = this.bitmap.data[index + 2];
- const alpha = this.bitmap.data[index + 3];
-
- this.bitmap.data[index + 0] = alpha;
- this.bitmap.data[index + 1] = blue;
- this.bitmap.data[index + 2] = green;
- this.bitmap.data[index + 3] = red;
- }).bitmap;
+ return scan(
+ image,
+ 0,
+ 0,
+ image.bitmap.width,
+ image.bitmap.height,
+ function (x, y, index) {
+ const red = this.bitmap.data[index + 0];
+ const green = this.bitmap.data[index + 1];
+ const blue = this.bitmap.data[index + 2];
+ const alpha = this.bitmap.data[index + 3];
+
+ this.bitmap.data[index + 0] = alpha;
+ this.bitmap.data[index + 1] = blue;
+ this.bitmap.data[index + 2] = green;
+ this.bitmap.data[index + 3] = red;
+ }
+ ).bitmap;
}
function fromAGBR(bitmap) {
- return scan({ bitmap }, 0, 0, bitmap.width, bitmap.height, function(
- x,
- y,
- index
- ) {
- const alpha = this.bitmap.data[index + 0];
- const blue = this.bitmap.data[index + 1];
- const green = this.bitmap.data[index + 2];
- const red = this.bitmap.data[index + 3];
-
- this.bitmap.data[index + 0] = red;
- this.bitmap.data[index + 1] = green;
- this.bitmap.data[index + 2] = blue;
- this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;
- }).bitmap;
+ return scan(
+ { bitmap },
+ 0,
+ 0,
+ bitmap.width,
+ bitmap.height,
+ function (x, y, index) {
+ const alpha = this.bitmap.data[index + 0];
+ const blue = this.bitmap.data[index + 1];
+ const green = this.bitmap.data[index + 2];
+ const red = this.bitmap.data[index + 3];
+
+ this.bitmap.data[index + 0] = red;
+ this.bitmap.data[index + 1] = green;
+ this.bitmap.data[index + 2] = blue;
+ this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;
+ }
+ ).bitmap;
}
-const decode = data => fromAGBR(BMP.decode(data));
-const encode = image => BMP.encode(toAGBR(image)).data;
+const decode = (data) => fromAGBR(BMP.decode(data));
+const encode = (image) => BMP.encode(toAGBR(image)).data;
export default () => ({
- mime: { [MIME_TYPE]: ['bmp'] },
+ mime: { [MIME_TYPE]: ["bmp"] },
constants: {
MIME_BMP: MIME_TYPE,
- MIME_X_MS_BMP: MIME_TYPE_SECOND
+ MIME_X_MS_BMP: MIME_TYPE_SECOND,
},
decoders: {
[MIME_TYPE]: decode,
- [MIME_TYPE_SECOND]: decode
+ [MIME_TYPE_SECOND]: decode,
},
encoders: {
[MIME_TYPE]: encode,
- [MIME_TYPE_SECOND]: encode
- }
+ [MIME_TYPE_SECOND]: encode,
+ },
});
diff --git a/project starter code/node_modules/@jimp/bmp/test/bmp.test.js b/project starter code/node_modules/@jimp/bmp/test/bmp.test.js
index 82b3bded..09587cec 100644
--- a/project starter code/node_modules/@jimp/bmp/test/bmp.test.js
+++ b/project starter code/node_modules/@jimp/bmp/test/bmp.test.js
@@ -1,54 +1,46 @@
-/* eslint-disable no-control-regex */
+import { Jimp, getTestDir } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import expect from "@storybook/expect";
-import { Jimp, getTestDir } from '@jimp/test-utils';
-import configure from '@jimp/custom';
-
-import bmp from '../src';
+import bmp from "../src";
const jimp = configure({ types: [bmp] }, Jimp);
-describe('BMP', () => {
- const imagesDir = getTestDir(__dirname) + '/images';
+describe("BMP", () => {
+ const imagesDir = getTestDir(__dirname) + "/images";
- it('load BMP', async () => {
- const image = await jimp.read(imagesDir + '/windows95.bmp');
+ it("load BMP", async () => {
+ const image = await jimp.read(imagesDir + "/windows95.bmp");
- image.getPixelColor(10, 10).should.be.equal(0xeff7f7ff);
- image.getPixelColor(150, 80).should.be.equal(0x73add6ff);
- image.getPixelColor(190, 200).should.be.equal(0xf7c300ff);
+ expect(image.getPixelColor(10, 10)).toBe(0xeff7f7ff);
+ expect(image.getPixelColor(150, 80)).toBe(0x73add6ff);
+ expect(image.getPixelColor(190, 200)).toBe(0xf7c300ff);
});
- it('export BMP', async () => {
+ it("export BMP", async () => {
const image = await jimp.read({
width: 3,
height: 3,
data: [
- 0xff0000ff,
- 0xff0080ff,
- 0xff00ffff,
- 0xff0080ff,
- 0xff00ffff,
- 0x8000ffff,
- 0xff00ffff,
- 0x8000ffff,
- 0x0000ffff
- ]
+ 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
+ 0xff00ffff, 0x8000ffff, 0x0000ffff,
+ ],
});
- const buffer = await image.getBufferAsync('image/bmp');
+ const buffer = await image.getBufferAsync("image/bmp");
- buffer.toString().should.match(/^BMZ\u0000/);
+ expect(buffer.toString()).toMatch(/^BMZ\u0000/);
});
- it('uses correct colors for BMP', async function() {
+ it("uses correct colors for BMP", async function () {
this.timeout(4000);
const expectedImg = await jimp.read(
- getTestDir(__dirname) + '/images/windows95.png'
+ getTestDir(__dirname) + "/images/windows95.png"
);
const image = await jimp.read(
- getTestDir(__dirname) + '/images/windows95.bmp'
+ getTestDir(__dirname) + "/images/windows95.bmp"
);
- image.bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(image.bitmap.data).toEqual(expectedImg.bitmap.data);
});
});
diff --git a/project starter code/node_modules/@jimp/core/CHANGELOG.md b/project starter code/node_modules/@jimp/core/CHANGELOG.md
deleted file mode 100644
index aee584b5..00000000
--- a/project starter code/node_modules/@jimp/core/CHANGELOG.md
+++ /dev/null
@@ -1,83 +0,0 @@
-# v0.14.0 (Mon Jun 29 2020)
-
-#### 🚀 Enhancement
-
-- include Addition (Add) blending mode + Officially drop support for Node 8 [#904](https://github.com/oliver-moran/jimp/pull/904) ([@GlitchyPSIX](https://github.com/GlitchyPSIX))
-
-#### Authors: 1
-
-- GlitchyPSI ([@GlitchyPSIX](https://github.com/GlitchyPSIX))
-
----
-
-# v0.11.0 (Fri May 15 2020)
-
-#### 🚀 Enhancement
-
-- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil))
-
-#### 🐛 Bug Fix
-
-- Make callback optional for Jimp.rgbaToInt [#889](https://github.com/oliver-moran/jimp/pull/889) ([@HanKruiger](https://github.com/HanKruiger))
-
-#### Authors: 2
-
-- Eric Rabil ([@EricRabil](https://github.com/EricRabil))
-- Han Kruiger ([@HanKruiger](https://github.com/HanKruiger))
-
----
-
-# v0.10.2 (Tue Apr 14 2020)
-
-#### 🐛 Bug Fix
-
-- Rewrite handling EXIF orientation — add tests, make it plugin-independent [#875](https://github.com/oliver-moran/jimp/pull/875) ([@skalee](https://github.com/skalee))
-
-#### Authors: 1
-
-- Sebastian Skałacki ([@skalee](https://github.com/skalee))
-
----
-
-# v0.10.0 (Mon Mar 30 2020)
-
-#### 🚀 Enhancement
-
-- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall))
-
-#### Authors: 1
-
-- Emily Marigold Klassen ([@forivall](https://github.com/forivall))
-
----
-
-# v0.9.6 (Wed Mar 18 2020)
-
-#### 🐛 Bug Fix
-
-- Relax mkdirp dependency to allow newer minimist [#857](https://github.com/oliver-moran/jimp/pull/857) ([@Den-dp](https://github.com/Den-dp))
-
-#### 🏠 Internal
-
-- Fix TypeScript error on 'next' [#858](https://github.com/oliver-moran/jimp/pull/858) ([@crutchcorn](https://github.com/crutchcorn))
-
-#### Authors: 2
-
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
-- Denis Bendrikov ([@Den-dp](https://github.com/Den-dp))
-
----
-
-# v0.9.3 (Tue Nov 26 2019)
-
-#### 🐛 Bug Fix
-
-- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
-- `@jimp/core`
- - Follow redirects [#789](https://github.com/oliver-moran/jimp/pull/789) ([@SaWey](https://github.com/SaWey) sander@solora.be)
-
-#### Authors: 2
-
-- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/README.md b/project starter code/node_modules/@jimp/core/README.md
index a85714fc..4ca355ff 100644
--- a/project starter code/node_modules/@jimp/core/README.md
+++ b/project starter code/node_modules/@jimp/core/README.md
@@ -18,7 +18,7 @@ Add constant or static methods to the Jimp constructor.
```js
addConstants({
- MIME_SPECIAL: 'image/special'
+ MIME_SPECIAL: "image/special",
});
```
@@ -48,5 +48,5 @@ await image.writeAsync('test.png');
Add a image mime type to Jimp constructor. First argument is a mime type and the second is an array of file extension for that type.
```js
-addType('image/special', ['spec', 'special']);
+addType("image/special", ["spec", "special"]);
```
diff --git a/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js b/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js
index eee30efd..d7efc3ee 100644
--- a/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js
+++ b/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js
@@ -3,234 +3,223 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.srcOver = srcOver;
-exports.dstOver = dstOver;
-exports.multiply = multiply;
exports.add = add;
-exports.screen = screen;
-exports.overlay = overlay;
exports.darken = darken;
-exports.lighten = lighten;
-exports.hardLight = hardLight;
exports.difference = difference;
+exports.dstOver = dstOver;
exports.exclusion = exclusion;
-
+exports.hardLight = hardLight;
+exports.lighten = lighten;
+exports.multiply = multiply;
+exports.overlay = overlay;
+exports.screen = screen;
+exports.srcOver = srcOver;
function srcOver(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;
- var g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;
- var b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;
+ const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;
+ const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
function dstOver(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;
- var g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;
- var b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;
+ const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;
+ const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
function multiply(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
- var g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
- var b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
+ const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
+ const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
function add(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (sra + dra) / a;
- var g = (sga + dga) / a;
- var b = (sba + dba) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (sra + dra) / a;
+ const g = (sga + dga) / a;
+ const b = (sba + dba) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
function screen(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
- var g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
- var b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
+ const g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
+ const b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
function overlay(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a;
- var g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a;
- var b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a;
+ const g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a;
+ const b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
function darken(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
- var g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
- var b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
+ const g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
+ const b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
function lighten(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
- var g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
- var b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
+ const g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
+ const b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
function hardLight(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a;
- var g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a;
- var b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a;
+ const g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a;
+ const b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
function difference(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;
- var g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;
- var b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;
+ const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;
+ const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
function exclusion(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
- var g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
- var b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
+ const g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
+ const b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
//# sourceMappingURL=composite-modes.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js.map b/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js.map
index 2d24ac88..ed813c3a 100644
--- a/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js.map
+++ b/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/composite/composite-modes.js"],"names":["srcOver","src","dst","ops","a","r","g","b","dstOver","multiply","sra","sga","sba","dra","dga","dba","add","screen","overlay","darken","Math","min","lighten","max","hardLight","difference","exclusion"],"mappings":";;;;;;;;;;;;;;;;;AAAO,SAASA,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IAAIV,GAAG,CAACE,CAAZ,CAHJ,GAICW,GAAG,IAAI,IAAId,GAAG,CAACG,CAAZ,CAJL,IAKAA,CANF;AAQA,SAAO;AAAEC,IAAAA,CAAC,EAADA,CAAF;AAAKC,IAAAA,CAAC,EAADA,CAAL;AAAQC,IAAAA,CAAC,EAADA,CAAR;AAAWH,IAAAA,CAAC,EAADA;AAAX,GAAP;AACD","sourcesContent":["export function srcOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;\n const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;\n const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function dstOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;\n const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;\n const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function multiply(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function add(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra) / a;\n const g = (sga + dga) / a;\n const b = (sba + dba) / a;\n\n return { r, g, b, a };\n}\n\nexport function screen(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function overlay(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * dra <= dst.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * dga <= dst.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * dba <= dst.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function darken(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.min(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.min(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.min(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function lighten(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.max(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.max(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.max(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function hardLight(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * sra <= src.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * sga <= src.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * sba <= src.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function difference(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;\n const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;\n const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function exclusion(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n 2 * sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n 2 * sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n 2 * sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n"],"file":"composite-modes.js"}
\ No newline at end of file
+{"version":3,"file":"composite-modes.js","names":["srcOver","src","dst","ops","a","r","g","b","dstOver","multiply","sra","sga","sba","dra","dga","dba","add","screen","overlay","darken","Math","min","lighten","max","hardLight","difference","exclusion"],"sources":["../../src/composite/composite-modes.js"],"sourcesContent":["export function srcOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;\n const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;\n const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function dstOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;\n const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;\n const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function multiply(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function add(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra) / a;\n const g = (sga + dga) / a;\n const b = (sba + dba) / a;\n\n return { r, g, b, a };\n}\n\nexport function screen(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function overlay(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * dra <= dst.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * dga <= dst.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * dba <= dst.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function darken(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.min(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.min(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.min(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function lighten(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.max(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.max(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.max(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function hardLight(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * sra <= src.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * sga <= src.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * sba <= src.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function difference(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;\n const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;\n const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function exclusion(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n 2 * sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n 2 * sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n 2 * sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAO,SAASA,OAAO,CAACC,GAAG,EAAEC,GAAG,EAAW;EAAA,IAATC,GAAG,uEAAG,CAAC;EACvCF,GAAG,CAACG,CAAC,IAAID,GAAG;EAEZ,MAAMC,CAAC,GAAGF,GAAG,CAACE,CAAC,GAAGH,GAAG,CAACG,CAAC,GAAGF,GAAG,CAACE,CAAC,GAAGH,GAAG,CAACG,CAAC;EAEvC,MAAMC,CAAC,GAAG,CAACJ,GAAG,CAACI,CAAC,GAAGJ,GAAG,CAACG,CAAC,GAAGF,GAAG,CAACG,CAAC,GAAGH,GAAG,CAACE,CAAC,IAAI,CAAC,GAAGH,GAAG,CAACG,CAAC,CAAC,IAAIA,CAAC;EAC3D,MAAME,CAAC,GAAG,CAACL,GAAG,CAACK,CAAC,GAAGL,GAAG,CAACG,CAAC,GAAGF,GAAG,CAACI,CAAC,GAAGJ,GAAG,CAACE,CAAC,IAAI,CAAC,GAAGH,GAAG,CAACG,CAAC,CAAC,IAAIA,CAAC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,CAAC;IAAEC,CAAC;IAAEH;EAAE,CAAC;AACvB"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/composite/index.js b/project starter code/node_modules/@jimp/core/dist/composite/index.js
index ec9595d9..c68cb72a 100644
--- a/project starter code/node_modules/@jimp/core/dist/composite/index.js
+++ b/project starter code/node_modules/@jimp/core/dist/composite/index.js
@@ -1,18 +1,14 @@
"use strict";
-var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = composite;
-
+exports.default = composite;
var _utils = require("@jimp/utils");
-
var constants = _interopRequireWildcard(require("../constants"));
-
var compositeModes = _interopRequireWildcard(require("./composite-modes"));
-
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/**
* Composites a source image over to this image respecting alpha channels
* @param {Jimp} src the source Jimp instance
@@ -23,52 +19,50 @@ var compositeModes = _interopRequireWildcard(require("./composite-modes"));
* @returns {Jimp} this for chaining of methods
*/
function composite(src, x, y) {
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- var cb = arguments.length > 4 ? arguments[4] : undefined;
-
- if (typeof options === 'function') {
+ let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+ let cb = arguments.length > 4 ? arguments[4] : undefined;
+ if (typeof options === "function") {
cb = options;
options = {};
}
-
if (!(src instanceof this.constructor)) {
- return _utils.throwError.call(this, 'The source must be a Jimp image', cb);
+ return _utils.throwError.call(this, "The source must be a Jimp image", cb);
}
-
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers', cb);
+ if (typeof x !== "number" || typeof y !== "number") {
+ return _utils.throwError.call(this, "x and y must be numbers", cb);
}
-
- var _options = options,
- mode = _options.mode,
- opacitySource = _options.opacitySource,
- opacityDest = _options.opacityDest;
-
+ let {
+ mode,
+ opacitySource,
+ opacityDest
+ } = options;
if (!mode) {
mode = constants.BLEND_SOURCE_OVER;
}
-
- if (typeof opacitySource !== 'number' || opacitySource < 0 || opacitySource > 1) {
+ if (typeof opacitySource !== "number" || opacitySource < 0 || opacitySource > 1) {
opacitySource = 1.0;
}
-
- if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) {
+ if (typeof opacityDest !== "number" || opacityDest < 0 || opacityDest > 1) {
opacityDest = 1.0;
}
- var blendmode = compositeModes[mode]; // round input
+ // eslint-disable-next-line import/namespace
+ const blendmode = compositeModes[mode];
+ // round input
x = Math.round(x);
y = Math.round(y);
- var baseImage = this;
-
+ const baseImage = this;
if (opacityDest !== 1.0) {
baseImage.opacity(opacityDest);
}
-
src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) {
- var dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);
- var blended = blendmode({
+ const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);
+ if (dstIdx === -1) {
+ // Skip target pixels outside of dst
+ return;
+ }
+ const blended = blendmode({
r: this.bitmap.data[idx + 0] / 255,
g: this.bitmap.data[idx + 1] / 255,
b: this.bitmap.data[idx + 2] / 255,
@@ -84,13 +78,11 @@ function composite(src, x, y) {
baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(blended.b * 255);
baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(blended.a * 255);
});
-
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}
-
return this;
}
-
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/composite/index.js.map b/project starter code/node_modules/@jimp/core/dist/composite/index.js.map
index 290d15ef..592eb24e 100644
--- a/project starter code/node_modules/@jimp/core/dist/composite/index.js.map
+++ b/project starter code/node_modules/@jimp/core/dist/composite/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/composite/index.js"],"names":["composite","src","x","y","options","cb","constructor","throwError","call","mode","opacitySource","opacityDest","constants","BLEND_SOURCE_OVER","blendmode","compositeModes","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;;;;;;;;;AASe,SAASA,SAAT,CAAmBC,GAAnB,EAAwBC,CAAxB,EAA2BC,CAA3B,EAAgD;AAAA,MAAlBC,OAAkB,uEAAR,EAAQ;AAAA,MAAJC,EAAI;;AAC7D,MAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,IAAAA,EAAE,GAAGD,OAAL;AACAA,IAAAA,OAAO,GAAG,EAAV;AACD;;AAED,MAAI,EAAEH,GAAG,YAAY,KAAKK,WAAtB,CAAJ,EAAwC;AACtC,WAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,MAAI,OAAOH,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD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SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACI,CAAR,GAAY,GADsB,CAApC;AAGAhB,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACK,CAAR,GAAY,GADsB,CAApC;AAGD,GAlCD;;AAoCA,MAAI,0BAAc9B,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\nimport * as constants from '../constants';\n\nimport * as compositeModes from './composite-modes';\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== 'number' ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["composite","src","x","y","options","cb","constructor","throwError","call","mode","opacitySource","opacityDest","constants","BLEND_SOURCE_OVER","blendmode","compositeModes","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255","isNodePattern"],"sources":["../../src/composite/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\nimport * as constants from \"../constants\";\n\nimport * as compositeModes from \"./composite-modes\";\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== \"number\" ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== \"number\" || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n // eslint-disable-next-line import/namespace\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(\n 0,\n 0,\n src.bitmap.width,\n src.bitmap.height,\n function (sx, sy, idx) {\n const dstIdx = baseImage.getPixelIndex(\n x + sx,\n y + sy,\n constants.EDGE_CROP\n );\n\n if (dstIdx === -1) {\n // Skip target pixels outside of dst\n return;\n }\n\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255,\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255,\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AAAoD;AAAA;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,SAAS,CAACC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAoB;EAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;EAAA,IAAEC,EAAE;EAC3D,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;IACjCC,EAAE,GAAGD,OAAO;IACZA,OAAO,GAAG,CAAC,CAAC;EACd;EAEA,IAAI,EAAEH,GAAG,YAAY,IAAI,CAACK,WAAW,CAAC,EAAE;IACtC,OAAOC,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEH,EAAE,CAAC;EACrE;EAEA,IAAI,OAAOH,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;IAClD,OAAOI,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEH,EAAE,CAAC;EAC7D;EAEA,IAAI;IAAEI,IAAI;IAAEC,aAAa;IAAEC;EAAY,CAAC,GAAGP,OAAO;EAElD,IAAI,CAACK,IAAI,EAAE;IACTA,IAAI,GAAGG,SAAS,CAACC,iBAAiB;EACpC;EAEA,IACE,OAAOH,aAAa,KAAK,QAAQ,IACjCA,aAAa,GAAG,CAAC,IACjBA,aAAa,GAAG,CAAC,EACjB;IACAA,aAAa,GAAG,GAAG;EACrB;EAEA,IAAI,OAAOC,WAAW,KAAK,QAAQ,IAAIA,WAAW,GAAG,CAAC,IAAIA,WAAW,GAAG,CAAC,EAAE;IACzEA,WAAW,GAAG,GAAG;EACnB;;EAEA;EACA,MAAMG,SAAS,GAAGC,cAAc,CAACN,IAAI,CAAC;;EAEtC;EACAP,CAAC,GAAGc,IAAI,CAACC,KAAK,CAACf,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CAAC,CAAC,GAAG,GAAG;MAC1CQ,CAAC,EAAEjB,SAAS,CAACG,MAAM,CAACW,IAAI,CAACL,MAAM,GAAG,CAAC,CAAC,GAAG;IACzC,CAAC,EACDjB,aAAa,CACd;IAEDQ,SAAS,CAACG,MAAM,CAACW,IAAI,CAACL,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAACrB,WAAW,CAAC8B,QAAQ,CAC3DN,OAAO,CAACC,CAAC,GAAG,GAAG,CAChB;IACDb,SAAS,CAACG,MAAM,CAACW,IAAI,CAACL,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAACrB,WAAW,CAAC8B,QAAQ,CAC3DN,OAAO,CAACG,CAAC,GAAG,GAAG,CAChB;IACDf,SAAS,CAACG,MAAM,CAACW,IAAI,CAACL,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAACrB,WAAW,CAAC8B,QAAQ,CAC3DN,OAAO,CAACI,CAAC,GAAG,GAAG,CAChB;IACDhB,SAAS,CAACG,MAAM,CAACW,IAAI,CAACL,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAACrB,WAAW,CAAC8B,QAAQ,CAC3DN,OAAO,CAACK,CAAC,GAAG,GAAG,CAChB;EACH,CAAC,CACF;EAED,IAAI,IAAAE,oBAAa,EAAChC,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb;AAAC;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/constants.js b/project starter code/node_modules/@jimp/core/dist/constants.js
index cc86acb3..1a5a65f1 100644
--- a/project starter code/node_modules/@jimp/core/dist/constants.js
+++ b/project starter code/node_modules/@jimp/core/dist/constants.js
@@ -3,51 +3,54 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.EDGE_CROP = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_HARDLIGHT = exports.BLEND_LIGHTEN = exports.BLEND_DARKEN = exports.BLEND_OVERLAY = exports.BLEND_SCREEN = exports.BLEND_ADD = exports.BLEND_MULTIPLY = exports.BLEND_DESTINATION_OVER = exports.BLEND_SOURCE_OVER = exports.VERTICAL_ALIGN_BOTTOM = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_TOP = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_CENTER = exports.HORIZONTAL_ALIGN_LEFT = exports.AUTO = void 0;
+exports.VERTICAL_ALIGN_TOP = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_BOTTOM = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_LEFT = exports.HORIZONTAL_ALIGN_CENTER = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.EDGE_CROP = exports.BLEND_SOURCE_OVER = exports.BLEND_SCREEN = exports.BLEND_OVERLAY = exports.BLEND_MULTIPLY = exports.BLEND_LIGHTEN = exports.BLEND_HARDLIGHT = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_DESTINATION_OVER = exports.BLEND_DARKEN = exports.BLEND_ADD = exports.AUTO = void 0;
// used to auto resizing etc.
-var AUTO = -1; // Align modes for cover, contain, bit masks
+const AUTO = -1;
+// Align modes for cover, contain, bit masks
exports.AUTO = AUTO;
-var HORIZONTAL_ALIGN_LEFT = 1;
+const HORIZONTAL_ALIGN_LEFT = 1;
exports.HORIZONTAL_ALIGN_LEFT = HORIZONTAL_ALIGN_LEFT;
-var HORIZONTAL_ALIGN_CENTER = 2;
+const HORIZONTAL_ALIGN_CENTER = 2;
exports.HORIZONTAL_ALIGN_CENTER = HORIZONTAL_ALIGN_CENTER;
-var HORIZONTAL_ALIGN_RIGHT = 4;
+const HORIZONTAL_ALIGN_RIGHT = 4;
exports.HORIZONTAL_ALIGN_RIGHT = HORIZONTAL_ALIGN_RIGHT;
-var VERTICAL_ALIGN_TOP = 8;
+const VERTICAL_ALIGN_TOP = 8;
exports.VERTICAL_ALIGN_TOP = VERTICAL_ALIGN_TOP;
-var VERTICAL_ALIGN_MIDDLE = 16;
+const VERTICAL_ALIGN_MIDDLE = 16;
exports.VERTICAL_ALIGN_MIDDLE = VERTICAL_ALIGN_MIDDLE;
-var VERTICAL_ALIGN_BOTTOM = 32; // blend modes
+const VERTICAL_ALIGN_BOTTOM = 32;
+// blend modes
exports.VERTICAL_ALIGN_BOTTOM = VERTICAL_ALIGN_BOTTOM;
-var BLEND_SOURCE_OVER = 'srcOver';
+const BLEND_SOURCE_OVER = "srcOver";
exports.BLEND_SOURCE_OVER = BLEND_SOURCE_OVER;
-var BLEND_DESTINATION_OVER = 'dstOver';
+const BLEND_DESTINATION_OVER = "dstOver";
exports.BLEND_DESTINATION_OVER = BLEND_DESTINATION_OVER;
-var BLEND_MULTIPLY = 'multiply';
+const BLEND_MULTIPLY = "multiply";
exports.BLEND_MULTIPLY = BLEND_MULTIPLY;
-var BLEND_ADD = 'add';
+const BLEND_ADD = "add";
exports.BLEND_ADD = BLEND_ADD;
-var BLEND_SCREEN = 'screen';
+const BLEND_SCREEN = "screen";
exports.BLEND_SCREEN = BLEND_SCREEN;
-var BLEND_OVERLAY = 'overlay';
+const BLEND_OVERLAY = "overlay";
exports.BLEND_OVERLAY = BLEND_OVERLAY;
-var BLEND_DARKEN = 'darken';
+const BLEND_DARKEN = "darken";
exports.BLEND_DARKEN = BLEND_DARKEN;
-var BLEND_LIGHTEN = 'lighten';
+const BLEND_LIGHTEN = "lighten";
exports.BLEND_LIGHTEN = BLEND_LIGHTEN;
-var BLEND_HARDLIGHT = 'hardLight';
+const BLEND_HARDLIGHT = "hardLight";
exports.BLEND_HARDLIGHT = BLEND_HARDLIGHT;
-var BLEND_DIFFERENCE = 'difference';
+const BLEND_DIFFERENCE = "difference";
exports.BLEND_DIFFERENCE = BLEND_DIFFERENCE;
-var BLEND_EXCLUSION = 'exclusion'; // Edge Handling
+const BLEND_EXCLUSION = "exclusion";
+// Edge Handling
exports.BLEND_EXCLUSION = BLEND_EXCLUSION;
-var EDGE_EXTEND = 1;
+const EDGE_EXTEND = 1;
exports.EDGE_EXTEND = EDGE_EXTEND;
-var EDGE_WRAP = 2;
+const EDGE_WRAP = 2;
exports.EDGE_WRAP = EDGE_WRAP;
-var EDGE_CROP = 3;
+const EDGE_CROP = 3;
exports.EDGE_CROP = EDGE_CROP;
//# sourceMappingURL=constants.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/constants.js.map b/project starter code/node_modules/@jimp/core/dist/constants.js.map
index 31fc25ea..2bf0d75d 100644
--- a/project starter code/node_modules/@jimp/core/dist/constants.js.map
+++ b/project starter code/node_modules/@jimp/core/dist/constants.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/constants.js"],"names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"mappings":";;;;;;AAAA;AACO,IAAMA,IAAI,GAAG,CAAC,CAAd,C,CAEP;;;AACO,IAAMC,qBAAqB,GAAG,CAA9B;;AACA,IAAMC,uBAAuB,GAAG,CAAhC;;AACA,IAAMC,sBAAsB,GAAG,CAA/B;;AAEA,IAAMC,kBAAkB,GAAG,CAA3B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B,C,CAEP;;;AACO,IAAMC,iBAAiB,GAAG,SAA1B;;AACA,IAAMC,sBAAsB,GAAG,SAA/B;;AACA,IAAMC,cAAc,GAAG,UAAvB;;AACA,IAAMC,SAAS,GAAG,KAAlB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,eAAe,GAAG,WAAxB;;AACA,IAAMC,gBAAgB,GAAG,YAAzB;;AACA,IAAMC,eAAe,GAAG,WAAxB,C,CAEP;;;AACO,IAAMC,WAAW,GAAG,CAApB;;AACA,IAAMC,SAAS,GAAG,CAAlB;;AACA,IAAMC,SAAS,GAAG,CAAlB","sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = 'srcOver';\nexport const BLEND_DESTINATION_OVER = 'dstOver';\nexport const BLEND_MULTIPLY = 'multiply';\nexport const BLEND_ADD = 'add';\nexport const BLEND_SCREEN = 'screen';\nexport const BLEND_OVERLAY = 'overlay';\nexport const BLEND_DARKEN = 'darken';\nexport const BLEND_LIGHTEN = 'lighten';\nexport const BLEND_HARDLIGHT = 'hardLight';\nexport const BLEND_DIFFERENCE = 'difference';\nexport const BLEND_EXCLUSION = 'exclusion';\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"file":"constants.js"}
\ No newline at end of file
+{"version":3,"file":"constants.js","names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"sources":["../src/constants.js"],"sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = \"srcOver\";\nexport const BLEND_DESTINATION_OVER = \"dstOver\";\nexport const BLEND_MULTIPLY = \"multiply\";\nexport const BLEND_ADD = \"add\";\nexport const BLEND_SCREEN = \"screen\";\nexport const BLEND_OVERLAY = \"overlay\";\nexport const BLEND_DARKEN = \"darken\";\nexport const BLEND_LIGHTEN = \"lighten\";\nexport const BLEND_HARDLIGHT = \"hardLight\";\nexport const BLEND_DIFFERENCE = \"difference\";\nexport const BLEND_EXCLUSION = \"exclusion\";\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,IAAI,GAAG,CAAC,CAAC;;AAEtB;AAAA;AACO,MAAMC,qBAAqB,GAAG,CAAC;AAAC;AAChC,MAAMC,uBAAuB,GAAG,CAAC;AAAC;AAClC,MAAMC,sBAAsB,GAAG,CAAC;AAAC;AAEjC,MAAMC,kBAAkB,GAAG,CAAC;AAAC;AAC7B,MAAMC,qBAAqB,GAAG,EAAE;AAAC;AACjC,MAAMC,qBAAqB,GAAG,EAAE;;AAEvC;AAAA;AACO,MAAMC,iBAAiB,GAAG,SAAS;AAAC;AACpC,MAAMC,sBAAsB,GAAG,SAAS;AAAC;AACzC,MAAMC,cAAc,GAAG,UAAU;AAAC;AAClC,MAAMC,SAAS,GAAG,KAAK;AAAC;AACxB,MAAMC,YAAY,GAAG,QAAQ;AAAC;AAC9B,MAAMC,aAAa,GAAG,SAAS;AAAC;AAChC,MAAMC,YAAY,GAAG,QAAQ;AAAC;AAC9B,MAAMC,aAAa,GAAG,SAAS;AAAC;AAChC,MAAMC,eAAe,GAAG,WAAW;AAAC;AACpC,MAAMC,gBAAgB,GAAG,YAAY;AAAC;AACtC,MAAMC,eAAe,GAAG,WAAW;;AAE1C;AAAA;AACO,MAAMC,WAAW,GAAG,CAAC;AAAC;AACtB,MAAMC,SAAS,GAAG,CAAC;AAAC;AACpB,MAAMC,SAAS,GAAG,CAAC;AAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/index.js b/project starter code/node_modules/@jimp/core/dist/index.js
index a656d756..0d466bf6 100644
--- a/project starter code/node_modules/@jimp/core/dist/index.js
+++ b/project starter code/node_modules/@jimp/core/dist/index.js
@@ -1,165 +1,115 @@
"use strict";
-var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addConstants = addConstants;
exports.addJimpMethods = addJimpMethods;
-exports.jimpEvMethod = jimpEvMethod;
-exports.jimpEvChange = jimpEvChange;
Object.defineProperty(exports, "addType", {
enumerable: true,
- get: function get() {
+ get: function () {
return MIME.addType;
}
});
-exports["default"] = void 0;
-
-var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
-
-var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
-
-var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
-
-var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
-
-var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
-
-var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
-
-var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
-
-var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
-
+exports.default = void 0;
+exports.jimpEvChange = jimpEvChange;
+exports.jimpEvMethod = jimpEvMethod;
var _fs = _interopRequireDefault(require("fs"));
-
var _path = _interopRequireDefault(require("path"));
-
var _events = _interopRequireDefault(require("events"));
-
var _utils = require("@jimp/utils");
-
var _anyBase = _interopRequireDefault(require("any-base"));
-
-var _mkdirp = _interopRequireDefault(require("mkdirp"));
-
var _pixelmatch = _interopRequireDefault(require("pixelmatch"));
-
var _tinycolor = _interopRequireDefault(require("tinycolor2"));
-
var _phash = _interopRequireDefault(require("./modules/phash"));
-
var _request = _interopRequireDefault(require("./request"));
-
var _composite = _interopRequireDefault(require("./composite"));
-
var _promisify = _interopRequireDefault(require("./utils/promisify"));
-
var MIME = _interopRequireWildcard(require("./utils/mime"));
-
var _imageBitmap = require("./utils/image-bitmap");
-
var constants = _interopRequireWildcard(require("./constants"));
-
-var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'; // an array storing the maximum string length of hashes at various bases
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
+function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
+const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_";
+
+// an array storing the maximum string length of hashes at various bases
// 0 and 1 do not exist as possible hash lengths
-
-var maxHashLength = [NaN, NaN];
-
-for (var i = 2; i < 65; i++) {
- var maxHash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, i))(new Array(64 + 1).join('1'));
+const maxHashLength = [NaN, NaN];
+for (let i = 2; i < 65; i++) {
+ const maxHash = (0, _anyBase.default)(_anyBase.default.BIN, alphabet.slice(0, i))(new Array(64 + 1).join("1"));
maxHashLength.push(maxHash.length);
-} // no operation
-
+}
-function noop() {} // error checking methods
+// no operation
+function noop() {}
+// error checking methods
function isArrayBuffer(test) {
- return Object.prototype.toString.call(test).toLowerCase().indexOf('arraybuffer') > -1;
-} // Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,
-// But this function is not useful when running in node directly
-
+ return Object.prototype.toString.call(test).toLowerCase().indexOf("arraybuffer") > -1;
+}
+// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,
+// But this function is not useful when running in node directly
function bufferFromArrayBuffer(arrayBuffer) {
- var buffer = Buffer.alloc(arrayBuffer.byteLength);
- var view = new Uint8Array(arrayBuffer);
-
- for (var _i = 0; _i < buffer.length; ++_i) {
- buffer[_i] = view[_i];
+ const buffer = Buffer.alloc(arrayBuffer.byteLength);
+ const view = new Uint8Array(arrayBuffer);
+ for (let i = 0; i < buffer.length; ++i) {
+ buffer[i] = view[i];
}
-
return buffer;
}
-
function loadFromURL(options, cb) {
- (0, _request["default"])(options, function (err, response, data) {
+ (0, _request.default)(options, (err, data) => {
if (err) {
return cb(err);
}
-
- if ('headers' in response && 'location' in response.headers) {
- options.url = response.headers.location;
- return loadFromURL(options, cb);
- }
-
- if ((0, _typeof2["default"])(data) === 'object' && Buffer.isBuffer(data)) {
+ if (typeof data === "object" && Buffer.isBuffer(data)) {
return cb(null, data);
}
-
- var msg = 'Could not load Buffer from <' + options.url + '> ' + '(HTTP: ' + response.statusCode + ')';
- return new Error(msg);
+ if (typeof data === "object" && isArrayBuffer(data)) {
+ return cb(null, bufferFromArrayBuffer(data));
+ }
+ return new Error(`Could not load Buffer from <${options.url}>`);
});
}
-
function loadBufferFromPath(src, cb) {
- if (_fs["default"] && typeof _fs["default"].readFile === 'function' && !src.match(/^(http|ftp)s?:\/\/./)) {
- _fs["default"].readFile(src, cb);
+ if (_fs.default && typeof _fs.default.readFile === "function" && !src.match(/^(http|ftp)s?:\/\/./)) {
+ _fs.default.readFile(src, cb);
} else {
loadFromURL({
url: src
}, cb);
}
}
-
function isRawRGBAData(obj) {
- return obj && (0, _typeof2["default"])(obj) === 'object' && typeof obj.width === 'number' && typeof obj.height === 'number' && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === 'function' && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3);
+ return obj && typeof obj === "object" && typeof obj.width === "number" && typeof obj.height === "number" && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === "function" && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3);
}
-
function makeRGBABufferFromRGB(buffer) {
if (buffer.length % 3 !== 0) {
- throw new Error('Buffer length is incorrect');
+ throw new Error("Buffer length is incorrect");
}
-
- var rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4);
- var j = 0;
-
- for (var _i2 = 0; _i2 < buffer.length; _i2++) {
- rgbaBuffer[j] = buffer[_i2];
-
- if ((_i2 + 1) % 3 === 0) {
+ const rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4);
+ let j = 0;
+ for (let i = 0; i < buffer.length; i++) {
+ rgbaBuffer[j] = buffer[i];
+ if ((i + 1) % 3 === 0) {
rgbaBuffer[++j] = 255;
}
-
j++;
}
-
return rgbaBuffer;
}
-
-var emptyBitmap = {
+const emptyBitmap = {
data: null,
width: null,
height: null
};
+
/**
* Jimp constructor (from a file)
* @param path a path to the image
@@ -199,222 +149,181 @@ var emptyBitmap = {
* @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap
*/
-var Jimp =
-/*#__PURE__*/
-function (_EventEmitter) {
- (0, _inherits2["default"])(Jimp, _EventEmitter);
-
+class Jimp extends _events.default {
// An object representing a bitmap in memory, comprising:
// - data: a buffer of the bitmap data
// - width: the width of the image in pixels
// - height: the height of the image in pixels
+
// Default colour to use for new pixels
+
// Default MIME is PNG
+
// Exif data for the image
+
// Whether Transparency supporting formats will be exported as RGB or RGBA
- function Jimp() {
- var _this;
+ constructor() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
-
- (0, _classCallCheck2["default"])(this, Jimp);
- _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Jimp).call(this));
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bitmap", emptyBitmap);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_background", 0x00000000);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_originalMime", Jimp.MIME_PNG);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_exif", null);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_rgba", true);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function (path) {
- return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path);
- });
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBase64Async", function (mime) {
- return (0, _promisify["default"])(_this.getBase64, (0, _assertThisInitialized2["default"])(_this), mime);
- });
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBuffer", _imageBitmap.getBuffer);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBufferAsync", _imageBitmap.getBufferAsync);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPixelColour", _this.getPixelColor);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setPixelColour", _this.setPixelColor);
- var jimpInstance = (0, _assertThisInitialized2["default"])(_this);
- var cb = noop;
-
+ super();
+ _defineProperty(this, "bitmap", emptyBitmap);
+ _defineProperty(this, "_background", 0x00000000);
+ _defineProperty(this, "_originalMime", Jimp.MIME_PNG);
+ _defineProperty(this, "_exif", null);
+ _defineProperty(this, "_rgba", true);
+ _defineProperty(this, "writeAsync", path => (0, _promisify.default)(this.write, this, path));
+ _defineProperty(this, "getBase64Async", mime => (0, _promisify.default)(this.getBase64, this, mime));
+ _defineProperty(this, "getBuffer", _imageBitmap.getBuffer);
+ _defineProperty(this, "getBufferAsync", _imageBitmap.getBufferAsync);
+ _defineProperty(this, "getPixelColour", this.getPixelColor);
+ _defineProperty(this, "setPixelColour", this.setPixelColor);
+ const jimpInstance = this;
+ let cb = noop;
if (isArrayBuffer(args[0])) {
args[0] = bufferFromArrayBuffer(args[0]);
}
-
function finish() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
-
- var err = args[0];
- var evData = err || {};
- evData.methodName = 'constructor';
- setTimeout(function () {
- var _cb;
-
+ const [err] = args;
+ const evData = err || {};
+ evData.methodName = "constructor";
+ setTimeout(() => {
// run on next tick.
if (err && cb === noop) {
- jimpInstance.emitError('constructor', err);
+ jimpInstance.emitError("constructor", err);
} else if (!err) {
- jimpInstance.emitMulti('constructor', 'initialized');
+ jimpInstance.emitMulti("constructor", "initialized");
}
-
- (_cb = cb).call.apply(_cb, [jimpInstance].concat(args));
+ cb.call(jimpInstance, ...args);
}, 1);
}
-
- if (typeof args[0] === 'number' && typeof args[1] === 'number' || parseInt(args[0], 10) && parseInt(args[1], 10)) {
+ if (typeof args[0] === "number" && typeof args[1] === "number" || parseInt(args[0], 10) && parseInt(args[1], 10)) {
// create a new image
- var w = parseInt(args[0], 10);
- var h = parseInt(args[1], 10);
- cb = args[2]; // with a hex color
+ const w = parseInt(args[0], 10);
+ const h = parseInt(args[1], 10);
+ cb = args[2];
- if (typeof args[2] === 'number') {
- _this._background = args[2];
+ // with a hex color
+ if (typeof args[2] === "number") {
+ this._background = args[2];
cb = args[3];
- } // with a css color
-
+ }
- if (typeof args[2] === 'string') {
- _this._background = Jimp.cssColorToHex(args[2]);
+ // with a css color
+ if (typeof args[2] === "string") {
+ this._background = Jimp.cssColorToHex(args[2]);
cb = args[3];
}
-
- if (typeof cb === 'undefined') {
+ if (typeof cb === "undefined") {
cb = noop;
}
-
- if (typeof cb !== 'function') {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish));
+ if (typeof cb !== "function") {
+ return _utils.throwError.call(this, "cb must be a function", finish);
}
-
- _this.bitmap = {
+ this.bitmap = {
data: Buffer.alloc(w * h * 4),
width: w,
height: h
};
-
- for (var _i3 = 0; _i3 < _this.bitmap.data.length; _i3 += 4) {
- _this.bitmap.data.writeUInt32BE(_this._background, _i3);
+ for (let i = 0; i < this.bitmap.data.length; i += 4) {
+ this.bitmap.data.writeUInt32BE(this._background, i);
}
-
- finish(null, (0, _assertThisInitialized2["default"])(_this));
- } else if ((0, _typeof2["default"])(args[0]) === 'object' && args[0].url) {
+ finish(null, this);
+ } else if (typeof args[0] === "object" && args[0].url) {
cb = args[1] || noop;
-
- if (typeof cb !== 'function') {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish));
+ if (typeof cb !== "function") {
+ return _utils.throwError.call(this, "cb must be a function", finish);
}
-
- loadFromURL(args[0], function (err, data) {
+ loadFromURL(args[0], (err, data) => {
if (err) {
- return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish);
+ return _utils.throwError.call(this, err, finish);
}
-
- _this.parseBitmap(data, args[0].url, finish);
+ this.parseBitmap(data, args[0].url, finish);
});
} else if (args[0] instanceof Jimp) {
// clone an existing Jimp
- var original = args[0];
+ const [original] = args;
cb = args[1];
-
- if (typeof cb === 'undefined') {
+ if (typeof cb === "undefined") {
cb = noop;
}
-
- if (typeof cb !== 'function') {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish));
+ if (typeof cb !== "function") {
+ return _utils.throwError.call(this, "cb must be a function", finish);
}
-
- _this.bitmap = {
+ this.bitmap = {
data: Buffer.from(original.bitmap.data),
width: original.bitmap.width,
height: original.bitmap.height
};
- _this._quality = original._quality;
- _this._deflateLevel = original._deflateLevel;
- _this._deflateStrategy = original._deflateStrategy;
- _this._filterType = original._filterType;
- _this._rgba = original._rgba;
- _this._background = original._background;
- _this._originalMime = original._originalMime;
- finish(null, (0, _assertThisInitialized2["default"])(_this));
+ this._quality = original._quality;
+ this._deflateLevel = original._deflateLevel;
+ this._deflateStrategy = original._deflateStrategy;
+ this._filterType = original._filterType;
+ this._rgba = original._rgba;
+ this._background = original._background;
+ this._originalMime = original._originalMime;
+ finish(null, this);
} else if (isRawRGBAData(args[0])) {
- var imageData = args[0];
+ const [imageData] = args;
cb = args[1] || noop;
- var isRGBA = imageData.width * imageData.height * 4 === imageData.data.length;
- var buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data);
- _this.bitmap = {
+ const isRGBA = imageData.width * imageData.height * 4 === imageData.data.length;
+ const buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data);
+ this.bitmap = {
data: buffer,
width: imageData.width,
height: imageData.height
};
- finish(null, (0, _assertThisInitialized2["default"])(_this));
- } else if (typeof args[0] === 'string') {
+ finish(null, this);
+ } else if (typeof args[0] === "string") {
// read from a path
- var path = args[0];
+ const path = args[0];
cb = args[1];
-
- if (typeof cb === 'undefined') {
+ if (typeof cb === "undefined") {
cb = noop;
}
-
- if (typeof cb !== 'function') {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish));
+ if (typeof cb !== "function") {
+ return _utils.throwError.call(this, "cb must be a function", finish);
}
-
- loadBufferFromPath(path, function (err, data) {
+ loadBufferFromPath(path, (err, data) => {
if (err) {
- return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish);
+ return _utils.throwError.call(this, err, finish);
}
-
- _this.parseBitmap(data, path, finish);
+ this.parseBitmap(data, path, finish);
});
- } else if ((0, _typeof2["default"])(args[0]) === 'object' && Buffer.isBuffer(args[0])) {
+ } else if (typeof args[0] === "object" && Buffer.isBuffer(args[0])) {
// read from a buffer
- var data = args[0];
+ const data = args[0];
cb = args[1];
-
- if (typeof cb !== 'function') {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish));
+ if (typeof cb !== "function") {
+ return _utils.throwError.call(this, "cb must be a function", finish);
}
-
- _this.parseBitmap(data, null, finish);
+ this.parseBitmap(data, null, finish);
} else {
// Allow client libs to add new ways to build a Jimp object.
// Extra constructors must be added by `Jimp.appendConstructorOption()`
cb = args[args.length - 1];
-
- if (typeof cb !== 'function') {
+ if (typeof cb !== "function") {
// TODO: try to solve the args after cb problem.
cb = args[args.length - 2];
-
- if (typeof cb !== 'function') {
+ if (typeof cb !== "function") {
cb = noop;
}
}
-
- var extraConstructor = Jimp.__extraConstructors.find(function (c) {
- return c.test.apply(c, args);
- });
-
+ const extraConstructor = Jimp.__extraConstructors.find(c => c.test(...args));
if (extraConstructor) {
- new Promise(function (resolve, reject) {
- var _extraConstructor$run;
-
- return (_extraConstructor$run = extraConstructor.run).call.apply(_extraConstructor$run, [(0, _assertThisInitialized2["default"])(_this), resolve, reject].concat(args));
- }).then(function () {
- return finish(null, (0, _assertThisInitialized2["default"])(_this));
- })["catch"](finish);
+ new Promise((resolve, reject) => {
+ extraConstructor.run.call(this, resolve, reject, ...args);
+ }).then(() => finish(null, this)).catch(finish);
} else {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'No matching constructor overloading was found. ' + 'Please see the docs for how to call the Jimp constructor.', finish));
+ return _utils.throwError.call(this, "No matching constructor overloading was found. " + "Please see the docs for how to call the Jimp constructor.", finish);
}
}
-
- return _this;
}
+
/**
* Parse a bitmap with the loaded image types.
*
@@ -423,513 +332,408 @@ function (_EventEmitter) {
* @param {function(Error, Jimp)} finish (optional) a callback for when complete
* @memberof Jimp
*/
+ parseBitmap(data, path, finish) {
+ _imageBitmap.parseBitmap.call(this, data, null, finish);
+ }
+ /**
+ * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)
+ * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ rgba(bool, cb) {
+ if (typeof bool !== "boolean") {
+ return _utils.throwError.call(this, "bool must be a boolean, true for RGBA or false for RGB", cb);
+ }
+ this._rgba = bool;
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
- (0, _createClass2["default"])(Jimp, [{
- key: "parseBitmap",
- value: function parseBitmap(data, path, finish) {
- _imageBitmap.parseBitmap.call(this, data, null, finish);
+ /**
+ * Emit for multiple listeners
+ * @param {string} methodName name of the method to emit an error for
+ * @param {string} eventName name of the eventName to emit an error for
+ * @param {object} data to emit
+ */
+ emitMulti(methodName, eventName) {
+ let data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
+ data = Object.assign(data, {
+ methodName,
+ eventName
+ });
+ this.emit("any", data);
+ if (methodName) {
+ this.emit(methodName, data);
}
- /**
- * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)
- * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
+ this.emit(eventName, data);
+ }
+ emitError(methodName, err) {
+ this.emitMulti(methodName, "error", err);
+ }
- }, {
- key: "rgba",
- value: function rgba(bool, cb) {
- if (typeof bool !== 'boolean') {
- return _utils.throwError.call(this, 'bool must be a boolean, true for RGBA or false for RGB', cb);
- }
+ /**
+ * Get the current height of the image
+ * @return {number} height of the image
+ */
+ getHeight() {
+ return this.bitmap.height;
+ }
- this._rgba = bool;
+ /**
+ * Get the current width of the image
+ * @return {number} width of the image
+ */
+ getWidth() {
+ return this.bitmap.width;
+ }
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
+ /**
+ * Nicely format Jimp object when sent to the console e.g. console.log(image)
+ * @returns {string} pretty printed
+ */
+ inspect() {
+ return "";
+ }
- return this;
- }
- /**
- * Emit for multiple listeners
- * @param {string} methodName name of the method to emit an error for
- * @param {string} eventName name of the eventName to emit an error for
- * @param {object} data to emit
- */
+ /**
+ * Nicely format Jimp object when converted to a string
+ * @returns {string} pretty printed
+ */
+ toString() {
+ return "[object Jimp]";
+ }
- }, {
- key: "emitMulti",
- value: function emitMulti(methodName, eventName) {
- var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- data = Object.assign(data, {
- methodName: methodName,
- eventName: eventName
- });
- this.emit('any', data);
+ /**
+ * Returns the original MIME of the image (default: "image/png")
+ * @returns {string} the MIME
+ */
+ getMIME() {
+ const mime = this._originalMime || Jimp.MIME_PNG;
+ return mime;
+ }
- if (methodName) {
- this.emit(methodName, data);
- }
+ /**
+ * Returns the appropriate file extension for the original MIME of the image (default: "png")
+ * @returns {string} the file extension
+ */
+ getExtension() {
+ const mime = this.getMIME();
+ return MIME.getExtension(mime);
+ }
- this.emit(eventName, data);
+ /**
+ * Writes the image to a file
+ * @param {string} path a path to the destination file
+ * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk
+ * @returns {Jimp} this for chaining of methods
+ */
+ write(path, cb) {
+ if (!_fs.default || !_fs.default.createWriteStream) {
+ throw new Error("Cant access the filesystem. You can use the getBase64 method.");
}
- }, {
- key: "emitError",
- value: function emitError(methodName, err) {
- this.emitMulti(methodName, 'error', err);
+ if (typeof path !== "string") {
+ return _utils.throwError.call(this, "path must be a string", cb);
}
- /**
- * Get the current height of the image
- * @return {number} height of the image
- */
-
- }, {
- key: "getHeight",
- value: function getHeight() {
- return this.bitmap.height;
+ if (typeof cb === "undefined") {
+ cb = noop;
}
- /**
- * Get the current width of the image
- * @return {number} width of the image
- */
-
- }, {
- key: "getWidth",
- value: function getWidth() {
- return this.bitmap.width;
+ if (typeof cb !== "function") {
+ return _utils.throwError.call(this, "cb must be a function", cb);
}
- /**
- * Nicely format Jimp object when sent to the console e.g. console.log(image)
- * @returns {string} pretty printed
- */
-
- }, {
- key: "inspect",
- value: function inspect() {
- return '';
+ const mime = MIME.getType(path) || this.getMIME();
+ const pathObj = _path.default.parse(path);
+ if (pathObj.dir) {
+ _fs.default.mkdirSync(pathObj.dir, {
+ recursive: true
+ });
}
- /**
- * Nicely format Jimp object when converted to a string
- * @returns {string} pretty printed
- */
-
- }, {
- key: "toString",
- value: function toString() {
- return '[object Jimp]';
+ this.getBuffer(mime, (err, buffer) => {
+ if (err) {
+ return _utils.throwError.call(this, err, cb);
+ }
+ const stream = _fs.default.createWriteStream(path);
+ stream.on("open", () => {
+ stream.write(buffer);
+ stream.end();
+ }).on("error", err => {
+ return _utils.throwError.call(this, err, cb);
+ });
+ stream.on("finish", () => {
+ cb.call(this, null, this);
+ });
+ });
+ return this;
+ }
+ /**
+ * Converts the image to a base 64 string
+ * @param {string} mime the mime type of the image data to be created
+ * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument
+ * @returns {Jimp} this for chaining of methods
+ */
+ getBase64(mime, cb) {
+ if (mime === Jimp.AUTO) {
+ // allow auto MIME detection
+ mime = this.getMIME();
}
- /**
- * Returns the original MIME of the image (default: "image/png")
- * @returns {string} the MIME
- */
-
- }, {
- key: "getMIME",
- value: function getMIME() {
- var mime = this._originalMime || Jimp.MIME_PNG;
- return mime;
+ if (typeof mime !== "string") {
+ return _utils.throwError.call(this, "mime must be a string", cb);
}
- /**
- * Returns the appropriate file extension for the original MIME of the image (default: "png")
- * @returns {string} the file extension
- */
-
- }, {
- key: "getExtension",
- value: function getExtension() {
- var mime = this.getMIME();
- return MIME.getExtension(mime);
+ if (typeof cb !== "function") {
+ return _utils.throwError.call(this, "cb must be a function", cb);
}
- /**
- * Writes the image to a file
- * @param {string} path a path to the destination file
- * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk
- * @returns {Jimp} this for chaining of methods
- */
-
- }, {
- key: "write",
- value: function write(path, cb) {
- var _this2 = this;
-
- if (!_fs["default"] || !_fs["default"].createWriteStream) {
- throw new Error('Cant access the filesystem. You can use the getBase64 method.');
- }
-
- if (typeof path !== 'string') {
- return _utils.throwError.call(this, 'path must be a string', cb);
- }
-
- if (typeof cb === 'undefined') {
- cb = noop;
- }
-
- if (typeof cb !== 'function') {
- return _utils.throwError.call(this, 'cb must be a function', cb);
- }
-
- var mime = MIME.getType(path) || this.getMIME();
-
- var pathObj = _path["default"].parse(path);
-
- if (pathObj.dir) {
- _mkdirp["default"].sync(pathObj.dir);
+ this.getBuffer(mime, function (err, data) {
+ if (err) {
+ return _utils.throwError.call(this, err, cb);
}
-
- this.getBuffer(mime, function (err, buffer) {
- if (err) {
- return _utils.throwError.call(_this2, err, cb);
- }
-
- var stream = _fs["default"].createWriteStream(path);
-
- stream.on('open', function () {
- stream.write(buffer);
- stream.end();
- }).on('error', function (err) {
- return _utils.throwError.call(_this2, err, cb);
- });
- stream.on('finish', function () {
- cb.call(_this2, null, _this2);
- });
- });
- return this;
+ const src = "data:" + mime + ";base64," + data.toString("base64");
+ cb.call(this, null, src);
+ });
+ return this;
+ }
+ /**
+ * Generates a perceptual hash of the image . And pads the string. Can configure base.
+ * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {string} a string representing the hash
+ */
+ hash(base, cb) {
+ base = base || 64;
+ if (typeof base === "function") {
+ cb = base;
+ base = 64;
}
- }, {
- key: "getBase64",
-
- /**
- * Converts the image to a base 64 string
- * @param {string} mime the mime type of the image data to be created
- * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument
- * @returns {Jimp} this for chaining of methods
- */
- value: function getBase64(mime, cb) {
- if (mime === Jimp.AUTO) {
- // allow auto MIME detection
- mime = this.getMIME();
- }
-
- if (typeof mime !== 'string') {
- return _utils.throwError.call(this, 'mime must be a string', cb);
- }
-
- if (typeof cb !== 'function') {
- return _utils.throwError.call(this, 'cb must be a function', cb);
- }
-
- this.getBuffer(mime, function (err, data) {
- if (err) {
- return _utils.throwError.call(this, err, cb);
- }
-
- var src = 'data:' + mime + ';base64,' + data.toString('base64');
- cb.call(this, null, src);
- });
- return this;
+ if (typeof base !== "number") {
+ return _utils.throwError.call(this, "base must be a number", cb);
}
- }, {
- key: "hash",
-
- /**
- * Generates a perceptual hash of the image . And pads the string. Can configure base.
- * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {string} a string representing the hash
- */
- value: function hash(base, cb) {
- base = base || 64;
-
- if (typeof base === 'function') {
- cb = base;
- base = 64;
- }
-
- if (typeof base !== 'number') {
- return _utils.throwError.call(this, 'base must be a number', cb);
- }
-
- if (base < 2 || base > 64) {
- return _utils.throwError.call(this, 'base must be a number between 2 and 64', cb);
- }
-
- var hash = this.pHash();
- hash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, base))(hash);
-
- while (hash.length < maxHashLength[base]) {
- hash = '0' + hash; // pad out with leading zeros
- }
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, hash);
- }
-
- return hash;
+ if (base < 2 || base > 64) {
+ return _utils.throwError.call(this, "base must be a number between 2 and 64", cb);
}
- /**
- * Calculates the perceptual hash
- * @returns {number} the perceptual hash
- */
-
- }, {
- key: "pHash",
- value: function pHash() {
- var pHash = new _phash["default"]();
- return pHash.getHash(this);
+ let hash = this.pHash();
+ hash = (0, _anyBase.default)(_anyBase.default.BIN, alphabet.slice(0, base))(hash);
+ while (hash.length < maxHashLength[base]) {
+ hash = "0" + hash; // pad out with leading zeros
}
- /**
- * Calculates the hamming distance of the current image and a hash based on their perceptual hash
- * @param {hash} compareHash hash to compare to
- * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical
- */
- }, {
- key: "distanceFromHash",
- value: function distanceFromHash(compareHash) {
- var pHash = new _phash["default"]();
- var currentHash = pHash.getHash(this);
- return pHash.distance(currentHash, compareHash);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, hash);
}
- /**
- * Converts the image to a buffer
- * @param {string} mime the mime type of the image buffer to be created
- * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument
- * @returns {Jimp} this for chaining of methods
- */
-
- }, {
- key: "getPixelIndex",
-
- /**
- * Returns the offset of a pixel in the bitmap buffer
- * @param {number} x the x coordinate
- * @param {number} y the y coordinate
- * @param {string} edgeHandling (optional) define how to sum pixels from outside the border
- * @param {number} cb (optional) a callback for when complete
- * @returns {number} the index of the pixel or -1 if not found
- */
- value: function getPixelIndex(x, y, edgeHandling, cb) {
- var xi;
- var yi;
-
- if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {
- cb = edgeHandling;
- edgeHandling = null;
- }
-
- if (!edgeHandling) {
- edgeHandling = Jimp.EDGE_EXTEND;
- }
-
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers', cb);
- } // round input
-
-
- x = Math.round(x);
- y = Math.round(y);
- xi = x;
- yi = y;
+ return hash;
+ }
- if (edgeHandling === Jimp.EDGE_EXTEND) {
- if (x < 0) xi = 0;
- if (x >= this.bitmap.width) xi = this.bitmap.width - 1;
- if (y < 0) yi = 0;
- if (y >= this.bitmap.height) yi = this.bitmap.height - 1;
- }
+ /**
+ * Calculates the perceptual hash
+ * @returns {number} the perceptual hash
+ */
+ pHash() {
+ const pHash = new _phash.default();
+ return pHash.getHash(this);
+ }
- if (edgeHandling === Jimp.EDGE_WRAP) {
- if (x < 0) {
- xi = this.bitmap.width + x;
- }
+ /**
+ * Calculates the hamming distance of the current image and a hash based on their perceptual hash
+ * @param {hash} compareHash hash to compare to
+ * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical
+ */
+ distanceFromHash(compareHash) {
+ const pHash = new _phash.default();
+ const currentHash = pHash.getHash(this);
+ return pHash.distance(currentHash, compareHash);
+ }
- if (x >= this.bitmap.width) {
- xi = x % this.bitmap.width;
- }
+ /**
+ * Converts the image to a buffer
+ * @param {string} mime the mime type of the image buffer to be created
+ * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument
+ * @returns {Jimp} this for chaining of methods
+ */
- if (y < 0) {
- xi = this.bitmap.height + y;
- }
+ /**
+ * Returns the offset of a pixel in the bitmap buffer
+ * @param {number} x the x coordinate
+ * @param {number} y the y coordinate
+ * @param {number} edgeHandling (optional) define how to sum pixels from outside the border
+ * @param {number} cb (optional) a callback for when complete
+ * @returns {number} the index of the pixel or -1 if not found
+ */
+ getPixelIndex(x, y, edgeHandling, cb) {
+ let xi;
+ let yi;
+ if (typeof edgeHandling === "function" && typeof cb === "undefined") {
+ cb = edgeHandling;
+ edgeHandling = null;
+ }
+ if (!edgeHandling) {
+ edgeHandling = Jimp.EDGE_EXTEND;
+ }
+ if (typeof x !== "number" || typeof y !== "number") {
+ return _utils.throwError.call(this, "x and y must be numbers", cb);
+ }
- if (y >= this.bitmap.height) {
- yi = y % this.bitmap.height;
- }
+ // round input
+ x = Math.round(x);
+ y = Math.round(y);
+ xi = x;
+ yi = y;
+ if (edgeHandling === Jimp.EDGE_EXTEND) {
+ if (x < 0) xi = 0;
+ if (x >= this.bitmap.width) xi = this.bitmap.width - 1;
+ if (y < 0) yi = 0;
+ if (y >= this.bitmap.height) yi = this.bitmap.height - 1;
+ }
+ if (edgeHandling === Jimp.EDGE_WRAP) {
+ if (x < 0) {
+ xi = this.bitmap.width + x;
}
-
- var i = this.bitmap.width * yi + xi << 2; // if out of bounds index is -1
-
- if (xi < 0 || xi >= this.bitmap.width) {
- i = -1;
+ if (x >= this.bitmap.width) {
+ xi = x % this.bitmap.width;
}
-
- if (yi < 0 || yi >= this.bitmap.height) {
- i = -1;
+ if (y < 0) {
+ yi = this.bitmap.height + y;
}
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, i);
+ if (y >= this.bitmap.height) {
+ yi = y % this.bitmap.height;
}
-
- return i;
}
- /**
- * Returns the hex colour value of a pixel
- * @param {number} x the x coordinate
- * @param {number} y the y coordinate
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {number} the color of the pixel
- */
-
- }, {
- key: "getPixelColor",
- value: function getPixelColor(x, y, cb) {
- if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); // round input
+ let i = this.bitmap.width * yi + xi << 2;
- x = Math.round(x);
- y = Math.round(y);
- var idx = this.getPixelIndex(x, y);
- var hex = this.bitmap.data.readUInt32BE(idx);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, hex);
- }
-
- return hex;
+ // if out of bounds index is -1
+ if (xi < 0 || xi >= this.bitmap.width) {
+ i = -1;
}
- }, {
- key: "setPixelColor",
-
- /**
- * Returns the hex colour value of a pixel
- * @param {number} hex color to set
- * @param {number} x the x coordinate
- * @param {number} y the y coordinate
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {number} the index of the pixel or -1 if not found
- */
- value: function setPixelColor(hex, x, y, cb) {
- if (typeof hex !== 'number' || typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'hex, x and y must be numbers', cb); // round input
-
- x = Math.round(x);
- y = Math.round(y);
- var idx = this.getPixelIndex(x, y);
- this.bitmap.data.writeUInt32BE(hex, idx);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+ if (yi < 0 || yi >= this.bitmap.height) {
+ i = -1;
}
- }, {
- key: "hasAlpha",
-
- /**
- * Determine if the image contains opaque pixels.
- * @return {boolean} hasAlpha whether the image contains opaque pixels
- */
- value: function hasAlpha() {
- for (var yIndex = 0; yIndex < this.bitmap.height; yIndex++) {
- for (var xIndex = 0; xIndex < this.bitmap.width; xIndex++) {
- var idx = this.bitmap.width * yIndex + xIndex << 2;
- var alpha = this.bitmap.data[idx + 3];
-
- if (alpha !== 0xff) {
- return true;
- }
- }
- }
-
- return false;
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, i);
}
- /**
- * Iterate scan through a region of the bitmap
- * @param {number} x the x coordinate to begin the scan at
- * @param {number} y the y coordinate to begin the scan at
- * @param w the width of the scan region
- * @param h the height of the scan region
- * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}
- */
-
- }, {
- key: "scanIterator",
- value: function scanIterator(x, y, w, h) {
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers');
- }
+ return i;
+ }
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers');
+ /**
+ * Returns the hex colour value of a pixel
+ * @param {number} x the x coordinate
+ * @param {number} y the y coordinate
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {number} the color of the pixel
+ */
+ getPixelColor(x, y, cb) {
+ if (typeof x !== "number" || typeof y !== "number") return _utils.throwError.call(this, "x and y must be numbers", cb);
+ const idx = this.getPixelIndex(x, y);
+ const hex = this.bitmap.data.readUInt32BE(idx);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, hex);
+ }
+ return hex;
+ }
+ /**
+ * Returns the hex colour value of a pixel
+ * @param {number} hex color to set
+ * @param {number} x the x coordinate
+ * @param {number} y the y coordinate
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {number} the index of the pixel or -1 if not found
+ */
+ setPixelColor(hex, x, y, cb) {
+ if (typeof hex !== "number" || typeof x !== "number" || typeof y !== "number") return _utils.throwError.call(this, "hex, x and y must be numbers", cb);
+ const idx = this.getPixelIndex(x, y);
+ this.bitmap.data.writeUInt32BE(hex, idx);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+ /**
+ * Determine if the image contains opaque pixels.
+ * @return {boolean} hasAlpha whether the image contains opaque pixels
+ */
+ hasAlpha() {
+ const {
+ width,
+ height,
+ data
+ } = this.bitmap;
+ const byteLen = width * height << 2;
+ for (let idx = 3; idx < byteLen; idx += 4) {
+ if (data[idx] !== 0xff) {
+ return true;
}
-
- return (0, _utils.scanIterator)(this, x, y, w, h);
}
- }]);
- return Jimp;
-}(_events["default"]);
+ return false;
+ }
+ /**
+ * Iterate scan through a region of the bitmap
+ * @param {number} x the x coordinate to begin the scan at
+ * @param {number} y the y coordinate to begin the scan at
+ * @param w the width of the scan region
+ * @param h the height of the scan region
+ * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}
+ */
+ scanIterator(x, y, w, h) {
+ if (typeof x !== "number" || typeof y !== "number") {
+ return _utils.throwError.call(this, "x and y must be numbers");
+ }
+ if (typeof w !== "number" || typeof h !== "number") {
+ return _utils.throwError.call(this, "w and h must be numbers");
+ }
+ return (0, _utils.scanIterator)(this, x, y, w, h);
+ }
+}
function addConstants(constants) {
- var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;
- Object.entries(constants).forEach(function (_ref) {
- var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
- name = _ref2[0],
- value = _ref2[1];
-
+ let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;
+ Object.entries(constants).forEach(_ref => {
+ let [name, value] = _ref;
jimpInstance[name] = value;
});
}
-
function addJimpMethods(methods) {
- var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;
- Object.entries(methods).forEach(function (_ref3) {
- var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
- name = _ref4[0],
- value = _ref4[1];
-
+ let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;
+ Object.entries(methods).forEach(_ref2 => {
+ let [name, value] = _ref2;
jimpInstance.prototype[name] = value;
});
}
-
addConstants(constants);
addJimpMethods({
- composite: _composite["default"]
+ composite: _composite.default
});
Jimp.__extraConstructors = [];
+
/**
* Allow client libs to add new ways to build a Jimp object.
* @param {string} name identify the extra constructor.
* @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.
* @param {function} run where the magic happens.
*/
-
Jimp.appendConstructorOption = function (name, test, run) {
Jimp.__extraConstructors.push({
- name: name,
- test: test,
- run: run
+ name,
+ test,
+ run
});
};
+
/**
* Read an image from a file or a Buffer. Takes the same args as the constructor
* @returns {Promise} a promise
*/
-
-
Jimp.read = function () {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
-
- return new Promise(function (resolve, reject) {
- (0, _construct2["default"])(Jimp, args.concat([function (err, image) {
+ return new Promise((resolve, reject) => {
+ // eslint-disable-next-line no-new
+ new Jimp(...args, (err, image) => {
if (err) reject(err);else resolve(image);
- }]));
+ });
});
};
-
Jimp.create = Jimp.read;
+
/**
* A static helper method that converts RGBA values to a single integer value
* @param {number} r the red value (0-255)
@@ -939,90 +743,82 @@ Jimp.create = Jimp.read;
* @param {function(Error, Jimp)} cb (optional) A callback for when complete
* @returns {number} an single integer colour value
*/
-
Jimp.rgbaToInt = function (r, g, b, a, cb) {
- if (typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' || typeof a !== 'number') {
- return _utils.throwError.call(this, 'r, g, b and a must be numbers', cb);
+ if (typeof r !== "number" || typeof g !== "number" || typeof b !== "number" || typeof a !== "number") {
+ return _utils.throwError.call(this, "r, g, b and a must be numbers", cb);
}
-
if (r < 0 || r > 255) {
- return _utils.throwError.call(this, 'r must be between 0 and 255', cb);
+ return _utils.throwError.call(this, "r must be between 0 and 255", cb);
}
-
if (g < 0 || g > 255) {
- _utils.throwError.call(this, 'g must be between 0 and 255', cb);
+ _utils.throwError.call(this, "g must be between 0 and 255", cb);
}
-
if (b < 0 || b > 255) {
- return _utils.throwError.call(this, 'b must be between 0 and 255', cb);
+ return _utils.throwError.call(this, "b must be between 0 and 255", cb);
}
-
if (a < 0 || a > 255) {
- return _utils.throwError.call(this, 'a must be between 0 and 255', cb);
+ return _utils.throwError.call(this, "a must be between 0 and 255", cb);
}
-
- r = Math.round(r);
- b = Math.round(b);
- g = Math.round(g);
- a = Math.round(a);
- var i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0);
-
+ let i = r & 0xff;
+ i <<= 8;
+ i |= g & 0xff;
+ i <<= 8;
+ i |= b & 0xff;
+ i <<= 8;
+ i |= a & 0xff;
+
+ // Ensure sign is correct
+ i >>>= 0;
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, i);
}
-
return i;
};
+
/**
* A static helper method that converts RGBA values to a single integer value
* @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)
* @param {function(Error, Jimp)} cb (optional) A callback for when complete
* @returns {object} an object with the properties r, g, b and a representing RGBA values
*/
-
-
Jimp.intToRGBA = function (i, cb) {
- if (typeof i !== 'number') {
- return _utils.throwError.call(this, 'i must be a number', cb);
+ if (typeof i !== "number") {
+ return _utils.throwError.call(this, "i must be a number", cb);
}
-
- var rgba = {};
+ const rgba = {};
rgba.r = Math.floor(i / Math.pow(256, 3));
rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));
rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1));
rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0));
-
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, rgba);
}
-
return rgba;
};
+
/**
* Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number
* @param {string} cssColor a number
* @returns {number} a hex number representing a color
*/
-
-
Jimp.cssColorToHex = function (cssColor) {
cssColor = cssColor || 0; // 0, null, undefined, NaN
- if (typeof cssColor === 'number') return Number(cssColor);
- return parseInt((0, _tinycolor["default"])(cssColor).toHex8(), 16);
+ if (typeof cssColor === "number") return Number(cssColor);
+ return parseInt((0, _tinycolor.default)(cssColor).toHex8(), 16);
};
+
/**
* Limits a number to between 0 or 255
* @param {number} n a number
* @returns {number} the number limited to between 0 or 255
*/
-
-
Jimp.limit255 = function (n) {
n = Math.max(n, 0);
n = Math.min(n, 255);
return n;
};
+
/**
* Diffs two images and returns
* @param {Jimp} img1 a Jimp image to compare
@@ -1030,14 +826,11 @@ Jimp.limit255 = function (n) {
* @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)
* @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }
*/
-
-
Jimp.diff = function (img1, img2) {
- var threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1;
- if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, 'img1 and img2 must be an Jimp images');
- var bmp1 = img1.bitmap;
- var bmp2 = img2.bitmap;
-
+ let threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1;
+ if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, "img1 and img2 must be an Jimp images");
+ const bmp1 = img1.bitmap;
+ const bmp2 = img2.bitmap;
if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {
if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {
// img1 is bigger
@@ -1047,46 +840,43 @@ Jimp.diff = function (img1, img2) {
img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);
}
}
-
- if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) {
- return _utils.throwError.call(this, 'threshold must be a number between 0 and 1');
+ if (typeof threshold !== "number" || threshold < 0 || threshold > 1) {
+ return _utils.throwError.call(this, "threshold must be a number between 0 and 1");
}
-
- var diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);
- var numDiffPixels = (0, _pixelmatch["default"])(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, {
- threshold: threshold
+ const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);
+ const numDiffPixels = (0, _pixelmatch.default)(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, {
+ threshold
});
return {
percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),
image: diff
};
};
+
/**
* Calculates the hamming distance of two images based on their perceptual hash
* @param {Jimp} img1 a Jimp image to compare
* @param {Jimp} img2 a Jimp image to compare
* @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical
*/
-
-
Jimp.distance = function (img1, img2) {
- var phash = new _phash["default"]();
- var hash1 = phash.getHash(img1);
- var hash2 = phash.getHash(img2);
+ const phash = new _phash.default();
+ const hash1 = phash.getHash(img1);
+ const hash2 = phash.getHash(img2);
return phash.distance(hash1, hash2);
};
+
/**
* Calculates the hamming distance of two images based on their perceptual hash
* @param {hash} hash1 a pHash
* @param {hash} hash2 a pHash
* @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical
*/
-
-
Jimp.compareHashes = function (hash1, hash2) {
- var phash = new _phash["default"]();
+ const phash = new _phash.default();
return phash.distance(hash1, hash2);
};
+
/**
* Compute color difference
* 0 means no difference, 1 means maximum difference.
@@ -1096,26 +886,21 @@ Jimp.compareHashes = function (hash1, hash2) {
* Where `a` is optional and `val` is an integer between 0 and 255.
* @returns {number} float between 0 and 1.
*/
-
-
Jimp.colorDiff = function (rgba1, rgba2) {
- var pow = function pow(n) {
- return Math.pow(n, 2);
- };
-
- var max = Math.max;
- var maxVal = 255 * 255 * 3;
-
+ const pow = n => Math.pow(n, 2);
+ const {
+ max
+ } = Math;
+ const maxVal = 255 * 255 * 3;
if (rgba1.a !== 0 && !rgba1.a) {
rgba1.a = 255;
}
-
if (rgba2.a !== 0 && !rgba2.a) {
rgba2.a = 255;
}
-
return (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) + max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) + max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) / maxVal;
};
+
/**
* Helper to create Jimp methods that emit events before and after its execution.
* @param {string} methodName The name to be appended to Jimp prototype.
@@ -1130,110 +915,92 @@ Jimp.colorDiff = function (rgba1, rgba2) {
* The emitted event comes with a object parameter to the listener with the
* `methodName` as one attribute.
*/
-
-
function jimpEvMethod(methodName, evName, method) {
- var evNameBefore = 'before-' + evName;
- var evNameAfter = evName.replace(/e$/, '') + 'ed';
-
+ const evNameBefore = "before-" + evName;
+ const evNameAfter = evName.replace(/e$/, "") + "ed";
Jimp.prototype[methodName] = function () {
- var wrappedCb;
-
+ let wrappedCb;
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
-
- var cb = args[method.length - 1];
- var jimpInstance = this;
-
- if (typeof cb === 'function') {
- wrappedCb = function wrappedCb() {
+ const cb = args[method.length - 1];
+ const jimpInstance = this;
+ if (typeof cb === "function") {
+ wrappedCb = function () {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
-
- var err = args[0],
- data = args[1];
-
+ const [err, data] = args;
if (err) {
jimpInstance.emitError(methodName, err);
} else {
- jimpInstance.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, data));
+ jimpInstance.emitMulti(methodName, evNameAfter, {
+ [methodName]: data
+ });
}
-
cb.apply(this, args);
};
-
args[args.length - 1] = wrappedCb;
} else {
wrappedCb = false;
}
-
this.emitMulti(methodName, evNameBefore);
- var result;
-
+ let result;
try {
result = method.apply(this, args);
-
if (!wrappedCb) {
- this.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, result));
+ this.emitMulti(methodName, evNameAfter, {
+ [methodName]: result
+ });
}
} catch (error) {
error.methodName = methodName;
this.emitError(methodName, error);
}
-
return result;
};
-
- Jimp.prototype[methodName + 'Quiet'] = method;
+ Jimp.prototype[methodName + "Quiet"] = method;
}
+
/**
* Creates a new image that is a clone of this one.
* @param {function(Error, Jimp)} cb (optional) A callback for when complete
* @returns the new image
*/
-
-
-jimpEvMethod('clone', 'clone', function (cb) {
- var clone = new Jimp(this);
-
+jimpEvMethod("clone", "clone", function (cb) {
+ const clone = new Jimp(this);
if ((0, _utils.isNodePattern)(cb)) {
cb.call(clone, null, clone);
}
-
return clone;
});
+
/**
* Simplify jimpEvMethod call for the common `change` evName.
* @param {string} methodName name of the method
* @param {function} method to watch changes for
*/
-
function jimpEvChange(methodName, method) {
- jimpEvMethod(methodName, 'change', method);
+ jimpEvMethod(methodName, "change", method);
}
+
/**
* Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)
* @param b A Boolean, true to use RGBA or false to use RGB
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-
-
-jimpEvChange('background', function (hex, cb) {
- if (typeof hex !== 'number') {
- return _utils.throwError.call(this, 'hex must be a hexadecimal rgba value', cb);
+jimpEvChange("background", function (hex, cb) {
+ if (typeof hex !== "number") {
+ return _utils.throwError.call(this, "hex must be a hexadecimal rgba value", cb);
}
-
this._background = hex;
-
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}
-
return this;
});
+
/**
* Scans through a region of the bitmap, calling a function for each pixel.
* @param {number} x the x coordinate to begin the scan at
@@ -1245,47 +1012,35 @@ jimpEvChange('background', function (hex, cb) {
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-
-jimpEvChange('scan', function (x, y, w, h, f, cb) {
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers', cb);
+jimpEvChange("scan", function (x, y, w, h, f, cb) {
+ if (typeof x !== "number" || typeof y !== "number") {
+ return _utils.throwError.call(this, "x and y must be numbers", cb);
}
-
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers', cb);
+ if (typeof w !== "number" || typeof h !== "number") {
+ return _utils.throwError.call(this, "w and h must be numbers", cb);
}
-
- if (typeof f !== 'function') {
- return _utils.throwError.call(this, 'f must be a function', cb);
+ if (typeof f !== "function") {
+ return _utils.throwError.call(this, "f must be a function", cb);
}
-
- var result = (0, _utils.scan)(this, x, y, w, h, f);
-
+ const result = (0, _utils.scan)(this, x, y, w, h, f);
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, result);
}
-
return result;
});
-
-if (process.env.ENVIRONMENT === 'BROWSER') {
+if (process.env.ENVIRONMENT === "BROWSER") {
// For use in a web browser or web worker
-
/* global self */
- var gl;
-
- if (typeof window !== 'undefined' && (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) === 'object') {
+ let gl;
+ if (typeof window !== "undefined" && typeof window === "object") {
gl = window;
}
-
- if (typeof self !== 'undefined' && (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object') {
+ if (typeof self !== "undefined" && typeof self === "object") {
gl = self;
}
-
gl.Jimp = Jimp;
gl.Buffer = Buffer;
}
-
var _default = Jimp;
-exports["default"] = _default;
+exports.default = _default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/index.js.map b/project starter code/node_modules/@jimp/core/dist/index.js.map
index 8e69060a..428d1080 100644
--- a/project starter code/node_modules/@jimp/core/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/core/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["alphabet","maxHashLength","NaN","i","maxHash","anyBase","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","err","response","data","headers","url","location","isBuffer","msg","statusCode","Error","loadBufferFromPath","src","fs","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","args","MIME_PNG","path","write","mime","getBase64","getBuffer","getBufferAsync","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","throwError","bitmap","writeUInt32BE","parseBitmap","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","bool","eventName","assign","emit","getMIME","MIME","getExtension","createWriteStream","getType","pathObj","Path","parse","dir","mkdirp","sync","stream","on","end","AUTO","base","hash","pHash","ImagePHash","getHash","compareHash","currentHash","distance","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","getPixelIndex","hex","readUInt32BE","yIndex","xIndex","alpha","EventEmitter","addConstants","constants","entries","forEach","name","value","addJimpMethods","methods","composite","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","pow","intToRGBA","rgba","floor","cssColor","Number","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","process","env","ENVIRONMENT","gl","window","self"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,QAAQ,G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J,EAAAA,EAAE,CAAC1L,MAAH,GAAYA,MAAZ;AACD;;eAIciC,I","sourcesContent":["import fs from 'fs';\nimport Path from 'path';\nimport EventEmitter from 'events';\n\nimport { isNodePattern, throwError, scan, scanIterator } from '@jimp/utils';\nimport anyBase from 'any-base';\nimport mkdirp from 'mkdirp';\nimport pixelMatch from 'pixelmatch';\nimport tinyColor from 'tinycolor2';\n\nimport ImagePHash from './modules/phash';\nimport request from './request';\n\nimport composite from './composite';\nimport promisify from './utils/promisify';\nimport * as MIME from './utils/mime';\nimport { parseBitmap, getBuffer, getBufferAsync } from './utils/image-bitmap';\nimport * as constants from './constants';\n\nconst alphabet =\n '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_';\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(anyBase.BIN, alphabet.slice(0, i))(\n new Array(64 + 1).join('1')\n );\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString\n .call(test)\n .toLowerCase()\n .indexOf('arraybuffer') > -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, response, data) => {\n if (err) {\n return cb(err);\n }\n\n if ('headers' in response && 'location' in response.headers) {\n options.url = response.headers.location;\n return loadFromURL(options, cb);\n }\n\n if (typeof data === 'object' && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n const msg =\n 'Could not load Buffer from <' +\n options.url +\n '> ' +\n '(HTTP: ' +\n response.statusCode +\n ')';\n\n return new Error(msg);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === 'function' &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.width === 'number' &&\n typeof obj.height === 'number' &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === 'function' &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error('Buffer length is incorrect');\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = 'constructor';\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError('constructor', err);\n } else if (!err) {\n jimpInstance.emitMulti('constructor', 'initialized');\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === 'number' && typeof args[1] === 'number') ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === 'number') {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === 'string') {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === 'object' && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height\n };\n\n finish(null, this);\n } else if (typeof args[0] === 'string') {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === 'object' && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== 'function') {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== 'function') {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find(c =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) =>\n extraConstructor.run.call(this, resolve, reject, ...args)\n )\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n 'No matching constructor overloading was found. ' +\n 'Please see the docs for how to call the Jimp constructor.',\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== 'boolean') {\n return throwError.call(\n this,\n 'bool must be a boolean, true for RGBA or false for RGB',\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit('any', data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, 'error', err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n ''\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return '[object Jimp]';\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n 'Cant access the filesystem. You can use the getBase64 method.'\n );\n }\n\n if (typeof path !== 'string') {\n return throwError.call(this, 'path must be a string', cb);\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n mkdirp.sync(pathObj.dir);\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on('open', () => {\n stream.write(buffer);\n stream.end();\n })\n .on('error', err => {\n return throwError.call(this, err, cb);\n });\n stream.on('finish', () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = path => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n this.getBuffer(mime, function(err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = 'data:' + mime + ';base64,' + data.toString('base64');\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = mime => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === 'function') {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== 'number') {\n return throwError.call(this, 'base must be a number', cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n 'base must be a number between 2 and 64',\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = '0' + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n xi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== 'number' ||\n typeof x !== 'number' ||\n typeof y !== 'number'\n )\n return throwError.call(this, 'hex, x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n for (let yIndex = 0; yIndex < this.bitmap.height; yIndex++) {\n for (let xIndex = 0; xIndex < this.bitmap.width; xIndex++) {\n const idx = (this.bitmap.width * yIndex + xIndex) << 2;\n const alpha = this.bitmap.data[idx + 3];\n\n if (alpha !== 0xff) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers');\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers');\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function(name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function(...args) {\n return new Promise((resolve, reject) => {\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function(r, g, b, a, cb) {\n if (\n typeof r !== 'number' ||\n typeof g !== 'number' ||\n typeof b !== 'number' ||\n typeof a !== 'number'\n ) {\n return throwError.call(this, 'r, g, b and a must be numbers', cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, 'r must be between 0 and 255', cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, 'g must be between 0 and 255', cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, 'b must be between 0 and 255', cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, 'a must be between 0 and 255', cb);\n }\n\n r = Math.round(r);\n b = Math.round(b);\n g = Math.round(g);\n a = Math.round(a);\n\n const i =\n r * Math.pow(256, 3) +\n g * Math.pow(256, 2) +\n b * Math.pow(256, 1) +\n a * Math.pow(256, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function(i, cb) {\n if (typeof i !== 'number') {\n return throwError.call(this, 'i must be a number', cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function(cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === 'number') return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function(n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function(img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, 'img1 and img2 must be an Jimp images');\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) {\n return throwError.call(this, 'threshold must be a number between 0 and 1');\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function(img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function(hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function(rgba1, rgba2) {\n const pow = n => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = 'before-' + evName;\n const evNameAfter = evName.replace(/e$/, '') + 'ed';\n\n Jimp.prototype[methodName] = function(...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === 'function') {\n wrappedCb = function(...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + 'Quiet'] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod('clone', 'clone', function(cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, 'change', method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('background', function(hex, cb) {\n if (typeof hex !== 'number') {\n return throwError.call(this, 'hex must be a hexadecimal rgba value', cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('scan', function(x, y, w, h, f, cb) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof f !== 'function') {\n return throwError.call(this, 'f must be a function', cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === 'BROWSER') {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== 'undefined' && typeof window === 'object') {\n gl = window;\n }\n\n if (typeof self !== 'undefined' && typeof self === 'object') {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from './utils/mime';\n\nexport default Jimp;\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["alphabet","maxHashLength","NaN","i","maxHash","anyBase","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","request","err","data","isBuffer","Error","url","loadBufferFromPath","src","fs","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","EventEmitter","constructor","args","MIME_PNG","path","promisify","write","mime","getBase64","getBuffer","getBufferAsync","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","throwError","bitmap","writeUInt32BE","parseBitmap","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","catch","rgba","bool","isNodePattern","eventName","assign","emit","getHeight","getWidth","inspect","getMIME","getExtension","MIME","createWriteStream","getType","pathObj","Path","parse","dir","mkdirSync","recursive","stream","on","end","AUTO","hash","base","pHash","ImagePHash","getHash","distanceFromHash","compareHash","currentHash","distance","getPixelIndex","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","hex","readUInt32BE","hasAlpha","byteLen","scanIterator","addConstants","constants","entries","forEach","name","value","addJimpMethods","methods","composite","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","intToRGBA","floor","pow","cssColor","Number","tinyColor","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","pixelMatch","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","scan","process","env","ENVIRONMENT","gl","window","self"],"sources":["../src/index.js"],"sourcesContent":["import fs from \"fs\";\nimport Path from \"path\";\nimport EventEmitter from \"events\";\n\nimport { isNodePattern, throwError, scan, scanIterator } from \"@jimp/utils\";\nimport anyBase from \"any-base\";\nimport pixelMatch from \"pixelmatch\";\nimport tinyColor from \"tinycolor2\";\n\nimport ImagePHash from \"./modules/phash\";\nimport request from \"./request\";\n\nimport composite from \"./composite\";\nimport promisify from \"./utils/promisify\";\nimport * as MIME from \"./utils/mime\";\nimport { parseBitmap, getBuffer, getBufferAsync } from \"./utils/image-bitmap\";\nimport * as constants from \"./constants\";\n\nconst alphabet =\n \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_\";\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(\n anyBase.BIN,\n alphabet.slice(0, i)\n )(new Array(64 + 1).join(\"1\"));\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString.call(test).toLowerCase().indexOf(\"arraybuffer\") >\n -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, data) => {\n if (err) {\n return cb(err);\n }\n\n if (typeof data === \"object\" && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n if (typeof data === \"object\" && isArrayBuffer(data)) {\n return cb(null, bufferFromArrayBuffer(data));\n }\n\n return new Error(`Could not load Buffer from <${options.url}>`);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === \"function\" &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === \"object\" &&\n typeof obj.width === \"number\" &&\n typeof obj.height === \"number\" &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === \"function\" &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error(\"Buffer length is incorrect\");\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null,\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = \"constructor\";\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError(\"constructor\", err);\n } else if (!err) {\n jimpInstance.emitMulti(\"constructor\", \"initialized\");\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === \"number\" && typeof args[1] === \"number\") ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === \"number\") {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === \"string\") {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h,\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === \"object\" && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height,\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height,\n };\n\n finish(null, this);\n } else if (typeof args[0] === \"string\") {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === \"object\" && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== \"function\") {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== \"function\") {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find((c) =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) => {\n extraConstructor.run.call(this, resolve, reject, ...args);\n })\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n \"No matching constructor overloading was found. \" +\n \"Please see the docs for how to call the Jimp constructor.\",\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== \"boolean\") {\n return throwError.call(\n this,\n \"bool must be a boolean, true for RGBA or false for RGB\",\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit(\"any\", data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, \"error\", err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n \"\"\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return \"[object Jimp]\";\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n \"Cant access the filesystem. You can use the getBase64 method.\"\n );\n }\n\n if (typeof path !== \"string\") {\n return throwError.call(this, \"path must be a string\", cb);\n }\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n fs.mkdirSync(pathObj.dir, { recursive: true });\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on(\"open\", () => {\n stream.write(buffer);\n stream.end();\n })\n .on(\"error\", (err) => {\n return throwError.call(this, err, cb);\n });\n stream.on(\"finish\", () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = (path) => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n this.getBuffer(mime, function (err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = \"data:\" + mime + \";base64,\" + data.toString(\"base64\");\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = (mime) => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === \"function\") {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== \"number\") {\n return throwError.call(this, \"base must be a number\", cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n \"base must be a number between 2 and 64\",\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = \"0\" + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n yi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\")\n return throwError.call(this, \"x and y must be numbers\", cb);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== \"number\" ||\n typeof x !== \"number\" ||\n typeof y !== \"number\"\n )\n return throwError.call(this, \"hex, x and y must be numbers\", cb);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n const {width, height, data} = this.bitmap;\n const byteLen = (width * height) << 2;\n\n for (let idx = 3; idx < byteLen; idx += 4) {\n if (data[idx] !== 0xff) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\");\n }\n\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\");\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function (name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function (...args) {\n return new Promise((resolve, reject) => {\n // eslint-disable-next-line no-new\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function (r, g, b, a, cb) {\n if (\n typeof r !== \"number\" ||\n typeof g !== \"number\" ||\n typeof b !== \"number\" ||\n typeof a !== \"number\"\n ) {\n return throwError.call(this, \"r, g, b and a must be numbers\", cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, \"r must be between 0 and 255\", cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, \"g must be between 0 and 255\", cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, \"b must be between 0 and 255\", cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, \"a must be between 0 and 255\", cb);\n }\n\n let i = (r & 0xff);\n i <<= 8;\n i |= (g & 0xff)\n i <<= 8;\n i |= (b & 0xff)\n i <<= 8;\n i |= (a & 0xff);\n\n // Ensure sign is correct\n i >>>= 0;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function (i, cb) {\n if (typeof i !== \"number\") {\n return throwError.call(this, \"i must be a number\", cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function (cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === \"number\") return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function (n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function (img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, \"img1 and img2 must be an Jimp images\");\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== \"number\" || threshold < 0 || threshold > 1) {\n return throwError.call(this, \"threshold must be a number between 0 and 1\");\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff,\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function (img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function (hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function (rgba1, rgba2) {\n const pow = (n) => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = \"before-\" + evName;\n const evNameAfter = evName.replace(/e$/, \"\") + \"ed\";\n\n Jimp.prototype[methodName] = function (...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === \"function\") {\n wrappedCb = function (...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data,\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result,\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + \"Quiet\"] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod(\"clone\", \"clone\", function (cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, \"change\", method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"background\", function (hex, cb) {\n if (typeof hex !== \"number\") {\n return throwError.call(this, \"hex must be a hexadecimal rgba value\", cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"scan\", function (x, y, w, h, f, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof f !== \"function\") {\n return throwError.call(this, \"f must be a function\", cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === \"BROWSER\") {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== \"undefined\" && typeof window === \"object\") {\n gl = window;\n }\n\n if (typeof self !== \"undefined\" && typeof self === \"object\") {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from \"./utils/mime\";\n\nexport default Jimp;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAyC;AAAA;AAAA;AAAA;AAAA;AAAA;AAEzC,MAAMA,QAAQ,GACZ,kEAAkE;;AAEpE;AACA;AACA,MAAMC,aAAa,GAAG,CAACC,GAAG,EAAEA,GAAG,CAAC;AAEhC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,EAAE,EAAEA,CAAC,EAAE,EAAE;EAC3B,MAAMC,OAAO,GAAG,IAAAC,gBAAO,EACrBA,gBAAO,CAACC,GAAG,EACXN,QAAQ,CAACO,KAAK,CAAC,CAAC,EAAEJ,CAAC,CAAC,CACrB,CAAC,IAAIK,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC;EAC9BR,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a,EAAC1E,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACb,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE8L,MAAM,CAAC;EAC7B;EAEA,OAAOA,MAAM;AACf,CAAC,CAAC;AAEF,IAAIM,OAAO,CAACC,GAAG,CAACC,WAAW,KAAK,SAAS,EAAE;EACzC;EACA;EACA,IAAIC,EAAE;EAEN,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC/DD,EAAE,GAAGC,MAAM;EACb;EAEA,IAAI,OAAOC,IAAI,KAAK,WAAW,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC3DF,EAAE,GAAGE,IAAI;EACX;EAEAF,EAAE,CAACpK,IAAI,GAAGA,IAAI;EACdoK,EAAE,CAACjM,MAAM,GAAGA,MAAM;AACpB;AAAC,eAIc6B,IAAI;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/modules/phash.js b/project starter code/node_modules/@jimp/core/dist/modules/phash.js
index dac128a5..0ec68644 100644
--- a/project starter code/node_modules/@jimp/core/dist/modules/phash.js
+++ b/project starter code/node_modules/@jimp/core/dist/modules/phash.js
@@ -1,5 +1,9 @@
"use strict";
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
/*
Copyright (c) 2011 Elliot Shepherd
@@ -21,6 +25,7 @@ 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.
*/
+
// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java
/*
@@ -28,28 +33,25 @@ THE SOFTWARE.
* Author: Elliot Shepherd (elliot@jarofworms.com
* Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html
*/
+
function ImagePHash(size, smallerSize) {
this.size = this.size || size;
this.smallerSize = this.smallerSize || smallerSize;
initCoefficients(this.size);
}
-
ImagePHash.prototype.size = 32;
ImagePHash.prototype.smallerSize = 8;
-
ImagePHash.prototype.distance = function (s1, s2) {
- var counter = 0;
-
- for (var k = 0; k < s1.length; k++) {
+ let counter = 0;
+ for (let k = 0; k < s1.length; k++) {
if (s1[k] !== s2[k]) {
counter++;
}
}
-
return counter / s1.length;
-}; // Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.
-
+};
+// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.
ImagePHash.prototype.getHash = function (img) {
/* 1. Reduce size.
* Like Average Hash, pHash starts with a small image.
@@ -58,51 +60,46 @@ ImagePHash.prototype.getHash = function (img) {
* because it is needed to reduce the high frequencies.
*/
img = img.clone().resize(this.size, this.size);
+
/* 2. Reduce color.
* The image is reduced to a grayscale just to further simplify
* the number of computations.
*/
-
img.grayscale();
- var vals = [];
-
- for (var x = 0; x < img.bitmap.width; x++) {
+ const vals = [];
+ for (let x = 0; x < img.bitmap.width; x++) {
vals[x] = [];
-
- for (var y = 0; y < img.bitmap.height; y++) {
+ for (let y = 0; y < img.bitmap.height; y++) {
vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;
}
}
+
/* 3. Compute the DCT.
* The DCT separates the image into a collection of frequencies
* and scalars. While JPEG uses an 8x8 DCT, this algorithm uses
* a 32x32 DCT.
*/
+ const dctVals = applyDCT(vals, this.size);
-
- var dctVals = applyDCT(vals, this.size);
/* 4. Reduce the DCT.
* This is the magic step. While the DCT is 32x32, just keep the
* top-left 8x8. Those represent the lowest frequencies in the
* picture.
*/
-
/* 5. Compute the average value.
* Like the Average Hash, compute the mean DCT value (using only
* the 8x8 DCT low-frequency values and excluding the first term
* since the DC coefficient can be significantly different from
* the other values and will throw off the average).
*/
-
- var total = 0;
-
- for (var _x = 0; _x < this.smallerSize; _x++) {
- for (var _y = 0; _y < this.smallerSize; _y++) {
- total += dctVals[_x][_y];
+ let total = 0;
+ for (let x = 0; x < this.smallerSize; x++) {
+ for (let y = 0; y < this.smallerSize; y++) {
+ total += dctVals[x][y];
}
}
+ const avg = total / (this.smallerSize * this.smallerSize);
- var avg = total / (this.smallerSize * this.smallerSize);
/* 6. Further reduce the DCT.
* This is the magic step. Set the 64 hash bits to 0 or 1
* depending on whether each of the 64 DCT values is above or
@@ -113,61 +110,62 @@ ImagePHash.prototype.getHash = function (img) {
* remains the same; this can survive gamma and color histogram
* adjustments without a problem.
*/
-
- var hash = '';
-
- for (var _x2 = 0; _x2 < this.smallerSize; _x2++) {
- for (var _y2 = 0; _y2 < this.smallerSize; _y2++) {
- hash += dctVals[_x2][_y2] > avg ? '1' : '0';
+ let hash = "";
+ for (let x = 0; x < this.smallerSize; x++) {
+ for (let y = 0; y < this.smallerSize; y++) {
+ hash += dctVals[x][y] > avg ? "1" : "0";
}
}
-
return hash;
-}; // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java
+};
+// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java
+/**
+ Convert a 32-bit integer color value to an RGBA object.
+ */
function intToRGBA(i) {
- var rgba = {};
- rgba.r = Math.floor(i / Math.pow(256, 3));
- rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));
- rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1));
- rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0));
- return rgba;
+ const a = i & 0xff;
+ i >>>= 8;
+ const b = i & 0xff;
+ i >>>= 8;
+ const g = i & 0xff;
+ i >>>= 8;
+ const r = i & 0xff;
+ return {
+ r,
+ g,
+ b,
+ a
+ };
}
-
-var c = [];
-
+const c = [];
function initCoefficients(size) {
- for (var i = 1; i < size; i++) {
+ for (let i = 1; i < size; i++) {
c[i] = 1;
}
-
c[0] = 1 / Math.sqrt(2.0);
}
-
function applyDCT(f, size) {
- var N = size;
- var F = [];
-
- for (var u = 0; u < N; u++) {
+ const N = size;
+ const F = [];
+ for (let u = 0; u < N; u++) {
F[u] = [];
-
- for (var v = 0; v < N; v++) {
- var sum = 0;
-
- for (var i = 0; i < N; i++) {
- for (var j = 0; j < N; j++) {
+ for (let v = 0; v < N; v++) {
+ let sum = 0;
+ for (let i = 0; i < N; i++) {
+ for (let j = 0; j < N; j++) {
sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j];
}
}
-
sum *= c[u] * c[v] / 4;
F[u][v] = sum;
}
}
-
return F;
}
-
-module.exports = ImagePHash;
+var _default = ImagePHash;
+exports.default = _default;
+module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=phash.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map b/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map
index 5556e315..d32e5443 100644
--- a/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map
+++ b/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/modules/phash.js"],"names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","rgba","r","Math","floor","pow","g","a","c","sqrt","f","N","F","u","v","sum","j","cos","PI","module","exports"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBA;;AAEA;;;;;AAMA,SAASA,UAAT,CAAoBC,IAApB,EAA0BC,WAA1B,EAAuC;AACrC,OAAKD,IAAL,GAAY,KAAKA,IAAL,IAAaA,IAAzB;AACA,OAAKC,WAAL,GAAmB,KAAKA,WAAL,IAAoBA,WAAvC;AACAC,EAAAA,gBAAgB,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B,MAAMwC,CAAC,GAAGxC,IAAV;AACA,MAAMyC,CAAC,GAAG,EAAV;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,CAApB,EAAuBE,CAAC,EAAxB,EAA4B;AAC1BD,IAAAA,CAAC,CAACC,CAAD,CAAD,GAAO,EAAP;;AACA,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,CAApB,EAAuBG,CAAC,EAAxB,EAA4B;AAC1B,UAAIC,GAAG,GAAG,CAAV;;AACA,WAAK,IAAIf,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGW,CAApB,EAAuBX,CAAC,EAAxB,EAA4B;AAC1B,aAAK,IAAIgB,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,CAApB,EAAuBK,CAAC,EAAxB,EAA4B;AAC1BD,UAAAA,GAAG,IACDZ,IAAI,CAACc,GAAL,CAAU,CAAC,IAAIjB,CAAJ,GAAQ,CAAT,KAAe,MAAMW,CAArB,CAAD,GAA4BE,CAA5B,GAAgCV,IAAI,CAACe,EAA9C,IACAf,IAAI,CAACc,GAAL,CAAU,CAAC,IAAID,CAAJ,GAAQ,CAAT,KAAe,MAAML,CAArB,CAAD,GAA4BG,CAA5B,GAAgCX,IAAI,CAACe,EAA9C,CADA,GAEAR,CAAC,CAACV,CAAD,CAAD,CAAKgB,CAAL,CAHF;AAID;AACF;;AAEDD,MAAAA,GAAG,IAAKP,CAAC,CAACK,CAAD,CAAD,GAAOL,CAAC,CAACM,CAAD,CAAT,GAAgB,CAAvB;AACAF,MAAAA,CAAC,CAACC,CAAD,CAAD,CAAKC,CAAL,IAAUC,GAAV;AACD;AACF;;AAED,SAAOH,CAAP;AACD;;AAEDO,MAAM,CAACC,OAAP,GAAiBlD,UAAjB","sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function(s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function(img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = '';\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? '1' : '0';\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\nfunction intToRGBA(i) {\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n return rgba;\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n }\n }\n\n return F;\n}\n\nmodule.exports = ImagePHash;\n"],"file":"phash.js"}
\ No newline at end of file
+{"version":3,"file":"phash.js","names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","a","g","r","c","Math","sqrt","f","N","F","u","v","sum","j","cos","PI"],"sources":["../../src/modules/phash.js"],"sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function (s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function (img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = \"\";\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? \"1\" : \"0\";\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\n/**\n Convert a 32-bit integer color value to an RGBA object.\n */\nfunction intToRGBA(i) {\n const a = i & 0xff;\n i >>>= 8;\n const b = i & 0xff;\n i >>>= 8;\n const g = i & 0xff;\n i >>>= 8;\n const r = i & 0xff;\n\n return {r, g, b, a};\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n }\n }\n\n return F;\n}\n\nexport default ImagePHash;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,CAACC,IAAI,EAAEC,WAAW,EAAE;EACrC,IAAI,CAACD,IAAI,GAAG,IAAI,CAACA,IAAI,IAAIA,IAAI;EAC7B,IAAI,CAACC,WAAW,GAAG,IAAI,CAACA,WAAW,IAAIA,WAAW;EAClDC,gBAAgB,CAAC,IAAI,CAACF,IAAI,CAAC;AAC7B;AAEAD,UAAU,CAACI,SAAS,CAACH,IAAI,GAAG,EAAE;AAC9BD,UAAU,CAACI,SAAS,CAACF,WAAW,GAAG,CAAC;AAEpCF,UAAU,CAACI,SAAS,CAACC,QAAQ,GAAG,UAAUC,EAAE,EAAEC,EAAE,EAAE;EAChD,IAAIC,OAAO,GAAG,CAAC;EAEf,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,EAAE,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;IAClC,IAAIH,EAAE,CAACG,CAAC,CAAC,KAAKF,EAAE,CAACE,CAAC,CAAC,EAAE;MACnBD,OAAO,EAAE;IACX;EACF;EAEA,OAAOA,OAAO,GAAGF,EAAE,CAACI,MAAM;AAC5B,CAAC;;AAED;AACAV,UAAU,CAACI,SAAS,CAACO,OAAO,GAAG,UAAUC,GAAG,EAAE;EAC5C;AACF;AACA;AACA;AACA;AACA;EACEA,GAAG,GAAGA,GAAG,CAACC,KAAK,EAAE,CAACC,MAAM,CAAC,IAAI,CAACb,IAAI,EAAE,IAAI,CAACA,IAAI,CAAC;;EAE9C;AACF;AACA;AACA;EACEW,GAAG,CAAC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C,EAAE,EAAE;MAC1B,IAAIC,GAAG,GAAG,CAAC;MACX,KAAK,IAAIZ,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGQ,CAAC,EAAER,CAAC,EAAE,EAAE;QAC1B,KAAK,IAAIa,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,CAAC,EAAEK,CAAC,EAAE,EAAE;UAC1BD,GAAG,IACDP,IAAI,CAACS,GAAG,CAAE,CAAC,CAAC,GAAGd,CAAC,GAAG,CAAC,KAAK,GAAG,GAAGQ,CAAC,CAAC,GAAIE,CAAC,GAAGL,IAAI,CAACU,EAAE,CAAC,GACjDV,IAAI,CAACS,GAAG,CAAE,CAAC,CAAC,GAAGD,CAAC,GAAG,CAAC,KAAK,GAAG,GAAGL,CAAC,CAAC,GAAIG,CAAC,GAAGN,IAAI,CAACU,EAAE,CAAC,GACjDR,CAAC,CAACP,CAAC,CAAC,CAACa,CAAC,CAAC;QACX;MACF;MAEAD,GAAG,IAAKR,CAAC,CAACM,CAAC,CAAC,GAAGN,CAAC,CAACO,CAAC,CAAC,GAAI,CAAC;MACxBF,CAAC,CAACC,CAAC,CAAC,CAACC,CAAC,CAAC,GAAGC,GAAG;IACf;EACF;EAEA,OAAOH,CAAC;AACV;AAAC,eAEcvC,UAAU;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/request.js b/project starter code/node_modules/@jimp/core/dist/request.js
index 4b211f73..ac1430eb 100644
--- a/project starter code/node_modules/@jimp/core/dist/request.js
+++ b/project starter code/node_modules/@jimp/core/dist/request.js
@@ -1,55 +1,25 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
-
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
-
-function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
-
-/* global XMLHttpRequest */
-if (process.browser || process.env.ENVIRONMENT === 'BROWSER' || typeof process.versions.electron !== 'undefined' && process.type === 'renderer' && typeof XMLHttpRequest === 'function') {
- // If we run into a browser or the electron renderer process,
- // use XHR method instead of Request node module.
- module.exports = function (options, cb) {
- var xhr = new XMLHttpRequest();
- xhr.open('GET', options.url, true);
- xhr.responseType = 'arraybuffer';
- xhr.addEventListener('load', function () {
- if (xhr.status < 400) {
- try {
- var data = Buffer.from(this.response);
- cb(null, xhr, data);
- } catch (error) {
- return cb(new Error('Response is not a buffer for url ' + options.url + '. Error: ' + error.message));
- }
- } else {
- cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url));
- }
- });
- xhr.addEventListener('error', function (e) {
- cb(e);
- });
- xhr.send();
- };
-} else {
- module.exports = function (_ref, cb) {
- var options = (0, _extends2["default"])({}, _ref);
-
- var p = require('phin');
-
- p(_objectSpread({
- compression: true
- }, options), function (err, res) {
- if (err === null) {
- cb(null, res, res.body);
- } else {
- cb(err);
- }
- });
- };
-}
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+require("isomorphic-fetch");
+var _default = (_ref, cb) => {
+ let {
+ url,
+ ...options
+ } = _ref;
+ fetch(url, options).then(response => {
+ if (response.ok) {
+ return response.arrayBuffer().catch(error => {
+ throw new Error(`Response is not a buffer for url ${url}. Error: ${error.message}`);
+ });
+ }
+ throw new Error(`HTTP Status ${response.status} for url ${url}`);
+ }).then(data => cb(null, data)).catch(error => cb(error));
+};
+exports.default = _default;
+module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=request.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/request.js.map b/project starter code/node_modules/@jimp/core/dist/request.js.map
index 04a1d461..9f6a16f9 100644
--- a/project starter code/node_modules/@jimp/core/dist/request.js.map
+++ b/project starter code/node_modules/@jimp/core/dist/request.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/request.js"],"names":["process","browser","env","ENVIRONMENT","versions","electron","type","XMLHttpRequest","module","exports","options","cb","xhr","open","url","responseType","addEventListener","status","data","Buffer","from","response","error","Error","message","e","send","p","require","compression","err","res","body"],"mappings":";;;;;;;;;;;;AAAA;AAEA,IACEA,OAAO,CAACC,OAAR,IACAD,OAAO,CAACE,GAAR,CAAYC,WAAZ,KAA4B,SAD5B,IAEC,OAAOH,OAAO,CAACI,QAAR,CAAiBC,QAAxB,KAAqC,WAArC,IACCL,OAAO,CAACM,IAAR,KAAiB,UADlB,IAEC,OAAOC,cAAP,KAA0B,UAL9B,EAME;AACA;AACA;AAEAC,EAAAA,MAAM,CAACC,OAAP,GAAiB,UAASC,OAAT,EAAkBC,EAAlB,EAAsB;AACrC,QAAMC,GAAG,GAAG,IAAIL,cAAJ,EAAZ;AACAK,IAAAA,GAAG,CAACC,IAAJ,CAAS,KAAT,EAAgBH,OAAO,CAACI,GAAxB,EAA6B,IAA7B;AACAF,IAAAA,GAAG,CAACG,YAAJ,GAAmB,aAAnB;AACAH,IAAAA,GAAG,CAACI,gBAAJ,CAAqB,MAArB,EAA6B,YAAW;AACtC,UAAIJ,GAAG,CAACK,MAAJ,GAAa,GAAjB,EAAsB;AACpB,YAAI;AACF,cAAMC,IAAI,GAAGC,MAAM,CAACC,IAAP,CAAY,KAAKC,QAAjB,CAAb;AACAV,UAAAA,EAAE,CAAC,IAAD,EAAOC,GAAP,EAAYM,IAAZ,CAAF;AACD,SAHD,CAGE,OAAOI,KAAP,EAAc;AACd,iBAAOX,EAAE,CACP,IAAIY,KAAJ,CACE,sCACEb,OAAO,CAACI,GADV,GAEE,WAFF,GAGEQ,KAAK,CAACE,OAJV,CADO,CAAT;AAQD;AACF,OAdD,MAcO;AACLb,QAAAA,EAAE,CAAC,IAAIY,KAAJ,CAAU,iBAAiBX,GAAG,CAACK,MAArB,GAA8B,WAA9B,GAA4CP,OAAO,CAACI,GAA9D,CAAD,CAAF;AACD;AACF,KAlBD;AAmBAF,IAAAA,GAAG,CAACI,gBAAJ,CAAqB,OAArB,EAA8B,UAAAS,CAAC,EAAI;AACjCd,MAAAA,EAAE,CAACc,CAAD,CAAF;AACD,KAFD;AAGAb,IAAAA,GAAG,CAACc,IAAJ;AACD,GA3BD;AA4BD,CAtCD,MAsCO;AACLlB,EAAAA,MAAM,CAACC,OAAP,GAAiB,gBAAyBE,EAAzB,EAA6B;AAAA,QAAfD,OAAe;;AAC5C,QAAMiB,CAAC,GAAGC,OAAO,CAAC,MAAD,CAAjB;;AAEAD,IAAAA,CAAC;AAAGE,MAAAA,WAAW,EAAE;AAAhB,OAAyBnB,OAAzB,GAAoC,UAACoB,GAAD,EAAMC,GAAN,EAAc;AACjD,UAAID,GAAG,KAAK,IAAZ,EAAkB;AAChBnB,QAAAA,EAAE,CAAC,IAAD,EAAOoB,GAAP,EAAYA,GAAG,CAACC,IAAhB,CAAF;AACD,OAFD,MAEO;AACLrB,QAAAA,EAAE,CAACmB,GAAD,CAAF;AACD;AACF,KANA,CAAD;AAOD,GAVD;AAWD","sourcesContent":["/* global XMLHttpRequest */\n\nif (\n process.browser ||\n process.env.ENVIRONMENT === 'BROWSER' ||\n (typeof process.versions.electron !== 'undefined' &&\n process.type === 'renderer' &&\n typeof XMLHttpRequest === 'function')\n) {\n // If we run into a browser or the electron renderer process,\n // use XHR method instead of Request node module.\n\n module.exports = function(options, cb) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', options.url, true);\n xhr.responseType = 'arraybuffer';\n xhr.addEventListener('load', function() {\n if (xhr.status < 400) {\n try {\n const data = Buffer.from(this.response);\n cb(null, xhr, data);\n } catch (error) {\n return cb(\n new Error(\n 'Response is not a buffer for url ' +\n options.url +\n '. Error: ' +\n error.message\n )\n );\n }\n } else {\n cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url));\n }\n });\n xhr.addEventListener('error', e => {\n cb(e);\n });\n xhr.send();\n };\n} else {\n module.exports = function({ ...options }, cb) {\n const p = require('phin');\n\n p({ compression: true, ...options }, (err, res) => {\n if (err === null) {\n cb(null, res, res.body);\n } else {\n cb(err);\n }\n });\n };\n}\n"],"file":"request.js"}
\ No newline at end of file
+{"version":3,"file":"request.js","names":["cb","url","options","fetch","then","response","ok","arrayBuffer","catch","error","Error","message","status","data"],"sources":["../src/request.js"],"sourcesContent":["import \"isomorphic-fetch\";\n\nexport default ({ url, ...options }, cb) => {\n fetch(url, options)\n .then((response) => {\n if (response.ok) {\n return response.arrayBuffer().catch((error) => {\n throw new Error(\n `Response is not a buffer for url ${url}. Error: ${error.message}`\n );\n });\n }\n\n throw new Error(`HTTP Status ${response.status} for url ${url}`);\n })\n .then((data) => cb(null, data))\n .catch((error) => cb(error));\n};\n"],"mappings":";;;;;;AAAA;AAA0B,eAEX,OAAsBA,EAAE,KAAK;EAAA,IAA5B;IAAEC,GAAG;IAAE,GAAGC;EAAQ,CAAC;EACjCC,KAAK,CAACF,GAAG,EAAEC,OAAO,CAAC,CAChBE,IAAI,CAAEC,QAAQ,IAAK;IAClB,IAAIA,QAAQ,CAACC,EAAE,EAAE;MACf,OAAOD,QAAQ,CAACE,WAAW,EAAE,CAACC,KAAK,CAAEC,KAAK,IAAK;QAC7C,MAAM,IAAIC,KAAK,CACZ,oCAAmCT,GAAI,YAAWQ,KAAK,CAACE,OAAQ,EAAC,CACnE;MACH,CAAC,CAAC;IACJ;IAEA,MAAM,IAAID,KAAK,CAAE,eAAcL,QAAQ,CAACO,MAAO,YAAWX,GAAI,EAAC,CAAC;EAClE,CAAC,CAAC,CACDG,IAAI,CAAES,IAAI,IAAKb,EAAE,CAAC,IAAI,EAAEa,IAAI,CAAC,CAAC,CAC9BL,KAAK,CAAEC,KAAK,IAAKT,EAAE,CAACS,KAAK,CAAC,CAAC;AAChC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js b/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js
index 4beabbe0..98ddf8c6 100644
--- a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js
+++ b/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js
@@ -1,46 +1,34 @@
"use strict";
-var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.parseBitmap = parseBitmap;
exports.getBuffer = getBuffer;
exports.getBufferAsync = getBufferAsync;
-
-var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
-
+exports.parseBitmap = parseBitmap;
var _fileType = _interopRequireDefault(require("file-type"));
-
var _exifParser = _interopRequireDefault(require("exif-parser"));
-
var _utils = require("@jimp/utils");
-
var constants = _interopRequireWildcard(require("../constants"));
-
var MIME = _interopRequireWildcard(require("./mime"));
-
var _promisify = _interopRequireDefault(require("./promisify"));
-
-function getMIMEFromBuffer(buffer, path) {
- var fileTypeFromBuffer = (0, _fileType["default"])(buffer);
-
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+async function getMIMEFromBuffer(buffer, path) {
+ const fileTypeFromBuffer = await _fileType.default.fromBuffer(buffer);
if (fileTypeFromBuffer) {
// If fileType returns something for buffer, then return the mime given
return fileTypeFromBuffer.mime;
}
-
if (path) {
// If a path is supplied, and fileType yields no results, then retry with MIME
// Path can be either a file path or a url
return MIME.getType(path);
}
-
return null;
}
+
/*
* Obtains image orientation from EXIF metadata.
*
@@ -48,11 +36,10 @@ function getMIMEFromBuffer(buffer, path) {
* @returns {number} a number 1-8 representing EXIF orientation,
* in particular 1 if orientation tag is missing
*/
-
-
function getExifOrientation(img) {
return img._exif && img._exif.tags && img._exif.tags.Orientation || 1;
}
+
/**
* Returns a function which translates EXIF-rotated coordinates into
* non-rotated ones.
@@ -62,64 +49,54 @@ function getExifOrientation(img) {
* @param img {Jimp} a Jimp image object
* @returns {function} transformation function for transformBitmap().
*/
-
-
function getExifOrientationTransformation(img) {
- var w = img.getWidth();
- var h = img.getHeight();
-
+ const w = img.getWidth();
+ const h = img.getHeight();
switch (getExifOrientation(img)) {
case 1:
// Horizontal (normal)
// does not need to be supported here
return null;
-
case 2:
// Mirror horizontal
return function (x, y) {
return [w - x - 1, y];
};
-
case 3:
// Rotate 180
return function (x, y) {
return [w - x - 1, h - y - 1];
};
-
case 4:
// Mirror vertical
return function (x, y) {
return [x, h - y - 1];
};
-
case 5:
// Mirror horizontal and rotate 270 CW
return function (x, y) {
return [y, x];
};
-
case 6:
// Rotate 90 CW
return function (x, y) {
return [y, h - x - 1];
};
-
case 7:
// Mirror horizontal and rotate 90 CW
return function (x, y) {
return [w - y - 1, h - x - 1];
};
-
case 8:
// Rotate 270 CW
return function (x, y) {
return [w - y - 1, x];
};
-
default:
return null;
}
}
+
/*
* Transforms bitmap in place (moves pixels around) according to given
* transformation function.
@@ -134,111 +111,87 @@ function getExifOrientationTransformation(img) {
* the source bitmap, i.e. has following form:
* `function(new_x, new_y) { return [src_x, src_y] }`.
*/
-
-
function transformBitmap(img, width, height, transformation) {
// Underscore-prefixed values are related to the source bitmap
// Their counterparts with no prefix are related to the target bitmap
- var _data = img.bitmap.data;
- var _width = img.bitmap.width;
- var data = Buffer.alloc(_data.length);
-
- for (var x = 0; x < width; x++) {
- for (var y = 0; y < height; y++) {
- var _transformation = transformation(x, y),
- _transformation2 = (0, _slicedToArray2["default"])(_transformation, 2),
- _x = _transformation2[0],
- _y = _transformation2[1];
-
- var idx = width * y + x << 2;
-
- var _idx = _width * _y + _x << 2;
-
- var pixel = _data.readUInt32BE(_idx);
-
+ const _data = img.bitmap.data;
+ const _width = img.bitmap.width;
+ const data = Buffer.alloc(_data.length);
+ for (let x = 0; x < width; x++) {
+ for (let y = 0; y < height; y++) {
+ const [_x, _y] = transformation(x, y);
+ const idx = width * y + x << 2;
+ const _idx = _width * _y + _x << 2;
+ const pixel = _data.readUInt32BE(_idx);
data.writeUInt32BE(pixel, idx);
}
}
-
img.bitmap.data = data;
img.bitmap.width = width;
img.bitmap.height = height;
}
+
/*
* Automagically rotates an image based on its EXIF data (if present).
* @param img {Jimp} a Jimp image object
*/
-
-
function exifRotate(img) {
if (getExifOrientation(img) < 2) return;
- var transformation = getExifOrientationTransformation(img);
- var swapDimensions = getExifOrientation(img) > 4;
- var newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;
- var newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;
+ const transformation = getExifOrientationTransformation(img);
+ const swapDimensions = getExifOrientation(img) > 4;
+ const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;
+ const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;
transformBitmap(img, newWidth, newHeight, transformation);
-} // parses a bitmap from the constructor to the JIMP bitmap property
-
-
-function parseBitmap(data, path, cb) {
- var mime = getMIMEFromBuffer(data, path);
+}
- if (typeof mime !== 'string') {
- return cb(new Error('Could not find MIME for Buffer <' + path + '>'));
+// parses a bitmap from the constructor to the JIMP bitmap property
+async function parseBitmap(data, path, cb) {
+ const mime = await getMIMEFromBuffer(data, path);
+ if (typeof mime !== "string") {
+ return cb(new Error("Could not find MIME for Buffer <" + path + ">"));
}
-
this._originalMime = mime.toLowerCase();
-
try {
- var _mime = this.getMIME();
-
- if (this.constructor.decoders[_mime]) {
- this.bitmap = this.constructor.decoders[_mime](data);
+ const mime = this.getMIME();
+ if (this.constructor.decoders[mime]) {
+ this.bitmap = this.constructor.decoders[mime](data);
} else {
- return _utils.throwError.call(this, 'Unsupported MIME type: ' + _mime, cb);
+ return _utils.throwError.call(this, "Unsupported MIME type: " + mime, cb);
}
} catch (error) {
return cb.call(this, error, this);
}
-
try {
- this._exif = _exifParser["default"].create(data).parse();
+ this._exif = _exifParser.default.create(data).parse();
exifRotate(this); // EXIF data
} catch (error) {
/* meh */
}
-
cb.call(this, null, this);
return this;
}
-
function compositeBitmapOverBackground(Jimp, image) {
return new Jimp(image.bitmap.width, image.bitmap.height, image._background).composite(image, 0, 0).bitmap;
}
+
/**
* Converts the image to a buffer
- * @param {string} mime the mime type of the image buffer to be created
+ * @param {(string|number)} mime the mime type of the image buffer to be created
* @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument
* @returns {Jimp} this for chaining of methods
*/
-
-
function getBuffer(mime, cb) {
if (mime === constants.AUTO) {
// allow auto MIME detection
mime = this.getMIME();
}
-
- if (typeof mime !== 'string') {
- return _utils.throwError.call(this, 'mime must be a string', cb);
+ if (typeof mime !== "string") {
+ return _utils.throwError.call(this, "mime must be a string", cb);
}
-
- if (typeof cb !== 'function') {
- return _utils.throwError.call(this, 'cb must be a function', cb);
+ if (typeof cb !== "function") {
+ return _utils.throwError.call(this, "cb must be a function", cb);
}
-
mime = mime.toLowerCase();
-
if (this._rgba && this.constructor.hasAlpha[mime]) {
this.bitmap.data = Buffer.from(this.bitmap.data);
} else {
@@ -246,18 +199,23 @@ function getBuffer(mime, cb) {
// composite onto a new image so that the background shows through alpha channels
this.bitmap.data = compositeBitmapOverBackground(this.constructor, this).data;
}
-
if (this.constructor.encoders[mime]) {
- var buffer = this.constructor.encoders[mime](this);
- cb.call(this, null, buffer);
+ const buffer = this.constructor.encoders[mime](this);
+ // Typically, buffers return a string or map. However, the gif library "gifwrap" seemingly returns promises.
+ if (buffer instanceof Promise) {
+ // trigger the callback when the promise has been resolved
+ buffer.then(buff => {
+ cb.call(this, null, buff);
+ });
+ } else {
+ cb.call(this, null, buffer);
+ }
} else {
- cb.call(this, 'Unsupported MIME type: ' + mime);
+ return _utils.throwError.call(this, "Unsupported MIME type: " + mime, cb);
}
-
return this;
}
-
function getBufferAsync(mime) {
- return (0, _promisify["default"])(getBuffer, this, mime);
+ return (0, _promisify.default)(getBuffer, this, mime);
}
//# sourceMappingURL=image-bitmap.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map b/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map
index dc78d9d8..bc894229 100644
--- a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map
+++ b/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/utils/image-bitmap.js"],"names":["getMIMEFromBuffer","buffer","path","fileTypeFromBuffer","mime","MIME","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","throwError","call","error","EXIFParser","create","parse","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","constants","AUTO","_rgba","hasAlpha","from","encoders","getBufferAsync"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAEA,SAASA,iBAAT,CAA2BC,MAA3B,EAAmCC,IAAnC,EAAyC;AACvC,MAAMC,kBAAkB,GAAG,0BAASF,MAAT,CAA3B;;AAEA,MAAIE,kBAAJ,EAAwB;AACtB;AACA,WAAOA,kBAAkB,CAACC,IAA1B;AACD;;AAED,MAAIF,IAAJ,EAAU;AACR;AACA;AACA,WAAOG,IAAI,CAACC,OAAL,CAAaJ,IAAb,CAAP;AACD;;AAED,SAAO,IAAP;AACD;AAED;;;;;;;;;AAOA,SAASK,kBAAT,CAA4BC,GAA5B,EAAiC;AAC/B,SAAQA,GAAG,CAACC,KAAJ,IAAaD,GAAG,CAACC,KAAJ,CAAUC,IAAvB,IAA+BF,GAAG,CAACC,KAAJ,CAAUC,IAAV,CAAeC,WAA/C,IAA+D,CAAtE;AACD;AAED;;;;;;;;;;;AASA,SAASC,gCAAT,CAA0CJ,GAA1C,EAA+C;AAC7C,MAAMK,CAAC,GAAGL,GAAG,CAACM,QAAJ,EAAV;AACA,MAAMC,CAAC,GAAGP,GAAG,CAACQ,SAAJ,EAAV;;AAEA,UAAQT,kBAAkB,CAACC,GAAD,CAA1B;AACE,SAAK,CAAL;AAAQ;AACN;AACA,aAAO,IAAP;;AAEF,SAAK,CAAL;AAAQ;AACN,aAAO,UAASS,CAAT,EAAYC,CAAZ,EAAe;AACpB,eAAO,CAACL,CAAC,GAAGI,CAAJ,GAAQ,CAAT,EAAYC,CAAZ,CAAP;AACD,OAFD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,EAAqC;AACnC,QAAMH,MAAM,GAAG,KAAK8C,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,EAAgC,IAAhC,CAAf;AACAsC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoBjD,MAApB;AACD,GAHD,MAGO;AACLyC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,4BAA4B9C,IAA1C;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAAS+D,cAAT,CAAwB/D,IAAxB,EAA8B;AACnC,SAAO,2BAAUwD,SAAV,EAAqB,IAArB,EAA2BxD,IAA3B,CAAP;AACD","sourcesContent":["import fileType from 'file-type';\n\nimport EXIFParser from 'exif-parser';\nimport { throwError } from '@jimp/utils';\n\nimport * as constants from '../constants';\nimport * as MIME from './mime';\nimport promisify from './promisify';\n\nfunction getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = fileType(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function(x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function(x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function(x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function(x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function(x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function(x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function(x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport function parseBitmap(data, path, cb) {\n const mime = getMIMEFromBuffer(data, path);\n\n if (typeof mime !== 'string') {\n return cb(new Error('Could not find MIME for Buffer <' + path + '>'));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, 'Unsupported MIME type: ' + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n cb.call(this, null, buffer);\n } else {\n cb.call(this, 'Unsupported MIME type: ' + mime);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"file":"image-bitmap.js"}
\ No newline at end of file
+{"version":3,"file":"image-bitmap.js","names":["getMIMEFromBuffer","buffer","path","fileTypeFromBuffer","FileType","fromBuffer","mime","MIME","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","throwError","call","error","EXIFParser","create","parse","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","constants","AUTO","_rgba","hasAlpha","from","encoders","Promise","then","buff","getBufferAsync","promisify"],"sources":["../../src/utils/image-bitmap.js"],"sourcesContent":["import FileType from \"file-type\";\n\nimport EXIFParser from \"exif-parser\";\nimport { throwError } from \"@jimp/utils\";\n\nimport * as constants from \"../constants\";\nimport * as MIME from \"./mime\";\nimport promisify from \"./promisify\";\n\nasync function getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = await FileType.fromBuffer(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function (x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function (x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function (x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function (x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function (x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function (x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function (x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport async function parseBitmap(data, path, cb) {\n const mime = await getMIMEFromBuffer(data, path);\n\n if (typeof mime !== \"string\") {\n return cb(new Error(\"Could not find MIME for Buffer <\" + path + \">\"));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {(string|number)} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n // Typically, buffers return a string or map. However, the gif library \"gifwrap\" seemingly returns promises.\n if (buffer instanceof Promise) {\n // trigger the callback when the promise has been resolved\n buffer.then((buff) => {\n cb.call(this, null, buff);\n });\n } else {\n cb.call(this, null, buffer);\n }\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"mappings":";;;;;;;;AAAA;AAEA;AACA;AAEA;AACA;AACA;AAAoC;AAAA;AAAA;AAEpC,eAAeA,iBAAiB,CAACC,MAAM,EAAEC,IAAI,EAAE;EAC7C,MAAMC,kBAAkB,GAAG,MAAMC,iBAAQ,CAACC,UAAU,CAACJ,MAAM,CAAC;EAE5D,IAAIE,kBAAkB,EAAE;IACtB;IACA,OAAOA,kBAAkB,CAACG,IAAI;EAChC;EAEA,IAAIJ,IAAI,EAAE;IACR;IACA;IACA,OAAOK,IAAI,CAACC,OAAO,CAACN,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASO,kBAAkB,CAACC,GAAG,EAAE;EAC/B,OAAQA,GAAG,CAACC,KAAK,IAAID,GAAG,CAACC,KAAK,CAACC,IAAI,IAAIF,GAAG,CAACC,KAAK,CAACC,IAAI,CAACC,WAAW,IAAK,CAAC;AACzE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gCAAgC,CAACJ,GAAG,EAAE;EAC7C,MAAMK,CAAC,GAAGL,GAAG,CAACM,QAAQ,EAAE;EACxB,MAAMC,CAAC,GAAGP,GAAG,CAACQ,SAAS,EAAE;EAEzB,QAAQT,kBAAkB,CAACC,GAAG,CAAC;IAC7B,KAAK,CAAC;MAAE;MACN;MACA,OAAO,I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ACtB,IAAI;EACR;EAEA,IAAI,IAAI,CAACsB,WAAW,CAACmB,QAAQ,CAAC9D,IAAI,CAAC,EAAE;IACnC,MAAML,MAAM,GAAG,IAAI,CAACgD,WAAW,CAACmB,QAAQ,CAAC9D,IAAI,CAAC,CAAC,IAAI,CAAC;IACpD;IACA,IAAIL,MAAM,YAAYoE,OAAO,EAAE;MAC7B;MACApE,MAAM,CAACqE,IAAI,CAAEC,IAAI,IAAK;QACpB3B,EAAE,CAACQ,IAAI,CAAC,IAAI,EAAE,IAAI,EAAEmB,IAAI,CAAC;MAC3B,CAAC,CAAC;IACJ,CAAC,MAAM;MACL3B,EAAE,CAACQ,IAAI,CAAC,IAAI,EAAE,IAAI,EAAEnD,MAAM,CAAC;IAC7B;EACF,CAAC,MAAM;IACL,OAAOkD,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,GAAG9C,IAAI,EAAEsC,EAAE,CAAC;EACpE;EAEA,OAAO,IAAI;AACb;AAEO,SAAS4B,cAAc,CAAClE,IAAI,EAAE;EACnC,OAAO,IAAAmE,kBAAS,EAACX,SAAS,EAAE,IAAI,EAAExD,IAAI,CAAC;AACzC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/utils/mime.js b/project starter code/node_modules/@jimp/core/dist/utils/mime.js
index 9e48085a..9df2f14f 100644
--- a/project starter code/node_modules/@jimp/core/dist/utils/mime.js
+++ b/project starter code/node_modules/@jimp/core/dist/utils/mime.js
@@ -3,45 +3,32 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.getExtension = exports.getType = exports.addType = void 0;
-var mimeTypes = {};
-
-var findType = function findType(extension) {
- return Object.entries(mimeTypes).find(function (type) {
- return type[1].includes(extension);
- }) || [];
-};
-
-var addType = function addType(mime, extensions) {
+exports.getType = exports.getExtension = exports.addType = void 0;
+const mimeTypes = {};
+const findType = extension => Object.entries(mimeTypes).find(type => type[1].includes(extension)) || [];
+const addType = (mime, extensions) => {
mimeTypes[mime] = extensions;
};
+
/**
* Lookup a mime type based on extension
* @param {string} path path to find extension for
* @returns {string} mime found mime type
*/
-
-
exports.addType = addType;
-
-var getType = function getType(path) {
- var pathParts = path.split('/').slice(-1);
- var extension = pathParts[pathParts.length - 1].split('.').pop();
- var type = findType(extension);
+const getType = path => {
+ const pathParts = path.split("/").slice(-1);
+ const extension = pathParts[pathParts.length - 1].split(".").pop();
+ const type = findType(extension);
return type[0];
};
+
/**
* Return file extension associated with a mime type
* @param {string} type mime type to look up
* @returns {string} extension file extension
*/
-
-
exports.getType = getType;
-
-var getExtension = function getExtension(type) {
- return (mimeTypes[type.toLowerCase()] || [])[0];
-};
-
+const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0];
exports.getExtension = getExtension;
//# sourceMappingURL=mime.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map b/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map
index 5a3501b1..3fcbc136 100644
--- a/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map
+++ b/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/utils/mime.js"],"names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"mappings":";;;;;;AAAA,IAAMA,SAAS,GAAG,EAAlB;;AAEA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAAAC,SAAS;AAAA,SACxBC,MAAM,CAACC,OAAP,CAAeJ,SAAf,EAA0BK,IAA1B,CAA+B,UAAAC,IAAI;AAAA,WAAIA,IAAI,CAAC,CAAD,CAAJ,CAAQC,QAAR,CAAiBL,SAAjB,CAAJ;AAAA,GAAnC,KAAuE,EAD/C;AAAA,CAA1B;;AAGO,IAAMM,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,UAAP,EAAsB;AAC3CV,EAAAA,SAAS,CAACS,IAAD,CAAT,GAAkBC,UAAlB;AACD,CAFM;AAIP;;;;;;;;;AAKO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAAC,IAAI,EAAI;AAC7B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAL,CAAW,GAAX,EAAgBC,KAAhB,CAAsB,CAAC,CAAvB,CAAlB;AACA,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAV,GAAmB,CAApB,CAAT,CAAgCF,KAAhC,CAAsC,GAAtC,EAA2CG,GAA3C,EAAlB;AACA,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAD,CAArB;AAEA,SAAOI,IAAI,CAAC,CAAD,CAAX;AACD,CANM;AAQP;;;;;;;;;AAKO,IAAMY,YAAY,GAAG,SAAfA,YAAe,CAAAZ,IAAI;AAAA,SAAI,CAACN,SAAS,CAACM,IAAI,CAACa,WAAL,EAAD,CAAT,IAAiC,EAAlC,EAAsC,CAAtC,CAAJ;AAAA,CAAzB","sourcesContent":["const mimeTypes = {};\n\nconst findType = extension =>\n Object.entries(mimeTypes).find(type => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = path => {\n const pathParts = path.split('/').slice(-1);\n const extension = pathParts[pathParts.length - 1].split('.').pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"file":"mime.js"}
\ No newline at end of file
+{"version":3,"file":"mime.js","names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"sources":["../../src/utils/mime.js"],"sourcesContent":["const mimeTypes = {};\n\nconst findType = (extension) =>\n Object.entries(mimeTypes).find((type) => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = (path) => {\n const pathParts = path.split(\"/\").slice(-1);\n const extension = pathParts[pathParts.length - 1].split(\".\").pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = (type) => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"mappings":";;;;;;AAAA,MAAMA,SAAS,GAAG,CAAC,CAAC;AAEpB,MAAMC,QAAQ,GAAIC,SAAS,IACzBC,MAAM,CAACC,OAAO,CAACJ,SAAS,CAAC,CAACK,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAAC,CAAC,CAAC,CAACC,QAAQ,CAACL,SAAS,CAAC,CAAC,IAAI,EAAE;AAEtE,MAAMM,OAAO,GAAG,CAACC,IAAI,EAAEC,UAAU,KAAK;EAC3CV,SAAS,CAACS,IAAI,CAAC,GAAGC,UAAU;AAC9B,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMC,OAAO,GAAIC,IAAI,IAAK;EAC/B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;EAC3C,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAM,GAAG,CAAC,CAAC,CAACF,KAAK,CAAC,GAAG,CAAC,CAACG,GAAG,EAAE;EAClE,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAS,CAAC;EAEhC,OAAOI,IAAI,CAAC,CAAC,CAAC;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMY,YAAY,GAAIZ,IAAI,IAAK,CAACN,SAAS,CAACM,IAAI,CAACa,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/utils/promisify.js b/project starter code/node_modules/@jimp/core/dist/utils/promisify.js
index 35223d34..580845d5 100644
--- a/project starter code/node_modules/@jimp/core/dist/utils/promisify.js
+++ b/project starter code/node_modules/@jimp/core/dist/utils/promisify.js
@@ -3,26 +3,23 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var promisify = function promisify(fun, ctx) {
+exports.default = void 0;
+const promisify = function (fun, ctx) {
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
-
- return new Promise(function (resolve, reject) {
- args.push(function (err, data) {
+ return new Promise((resolve, reject) => {
+ args.push((err, data) => {
if (err) {
reject(err);
}
-
resolve(data);
});
- fun.bind(ctx).apply(void 0, args);
+ fun.bind(ctx)(...args);
});
};
-
var _default = promisify;
-exports["default"] = _default;
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=promisify.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/dist/utils/promisify.js.map b/project starter code/node_modules/@jimp/core/dist/utils/promisify.js.map
index c72c0c48..ebd7f849 100644
--- a/project starter code/node_modules/@jimp/core/dist/utils/promisify.js.map
+++ b/project starter code/node_modules/@jimp/core/dist/utils/promisify.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/utils/promisify.js"],"names":["promisify","fun","ctx","args","Promise","resolve","reject","push","err","data","bind"],"mappings":";;;;;;;AAAA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,GAAD,EAAMC,GAAN;AAAA,oCAAcC,IAAd;AAAcA,IAAAA,IAAd;AAAA;;AAAA,SAChB,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAUC,MAAV,EAAqB;AAC/BH,IAAAA,IAAI,CAACI,IAAL,CAAU,UAACC,GAAD,EAAMC,IAAN,EAAe;AACvB,UAAID,GAAJ,EAAS;AACPF,QAAAA,MAAM,CAACE,GAAD,CAAN;AACD;;AAEDH,MAAAA,OAAO,CAACI,IAAD,CAAP;AACD,KAND;AAOAR,IAAAA,GAAG,CAACS,IAAJ,CAASR,GAAT,gBAAiBC,IAAjB;AACD,GATD,CADgB;AAAA,CAAlB;;eAYeH,S","sourcesContent":["const promisify = (fun, ctx, ...args) =>\n new Promise((resolve, reject) => {\n args.push((err, data) => {\n if (err) {\n reject(err);\n }\n\n resolve(data);\n });\n fun.bind(ctx)(...args);\n });\n\nexport default promisify;\n"],"file":"promisify.js"}
\ No newline at end of file
+{"version":3,"file":"promisify.js","names":["promisify","fun","ctx","args","Promise","resolve","reject","push","err","data","bind"],"sources":["../../src/utils/promisify.js"],"sourcesContent":["const promisify = (fun, ctx, ...args) =>\n new Promise((resolve, reject) => {\n args.push((err, data) => {\n if (err) {\n reject(err);\n }\n\n resolve(data);\n });\n fun.bind(ctx)(...args);\n });\n\nexport default promisify;\n"],"mappings":";;;;;;AAAA,MAAMA,SAAS,GAAG,UAACC,GAAG,EAAEC,GAAG;EAAA,kCAAKC,IAAI;IAAJA,IAAI;EAAA;EAAA,OAClC,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IAC/BH,IAAI,CAACI,IAAI,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAK;MACvB,IAAID,GAAG,EAAE;QACPF,MAAM,CAACE,GAAG,CAAC;MACb;MAEAH,OAAO,CAACI,IAAI,CAAC;IACf,CAAC,CAAC;IACFR,GAAG,CAACS,IAAI,CAACR,GAAG,CAAC,CAAC,GAAGC,IAAI,CAAC;EACxB,CAAC,CAAC;AAAA;AAAC,eAEUH,SAAS;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js b/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js
index eee30efd..8ab468eb 100644
--- a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js
+++ b/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js
@@ -1,236 +1,209 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.srcOver = srcOver;
-exports.dstOver = dstOver;
-exports.multiply = multiply;
-exports.add = add;
-exports.screen = screen;
-exports.overlay = overlay;
-exports.darken = darken;
-exports.lighten = lighten;
-exports.hardLight = hardLight;
-exports.difference = difference;
-exports.exclusion = exclusion;
-
-function srcOver(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function srcOver(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;
- var g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;
- var b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;
+ const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;
+ const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
-function dstOver(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function dstOver(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;
- var g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;
- var b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;
+ const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;
+ const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
-function multiply(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function multiply(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
- var g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
- var b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
+ const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
+ const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
-function add(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function add(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (sra + dra) / a;
- var g = (sga + dga) / a;
- var b = (sba + dba) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (sra + dra) / a;
+ const g = (sga + dga) / a;
+ const b = (sba + dba) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
-function screen(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function screen(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
- var g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
- var b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
+ const g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
+ const b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
-function overlay(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function overlay(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a;
- var g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a;
- var b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a;
+ const g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a;
+ const b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
-function darken(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function darken(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
- var g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
- var b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
+ const g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
+ const b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
-function lighten(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function lighten(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
- var g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
- var b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
+ const g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
+ const b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
-function hardLight(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function hardLight(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a;
- var g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a;
- var b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a;
+ const g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a;
+ const b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
-function difference(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function difference(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;
- var g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;
- var b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;
+ const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;
+ const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
-
-function exclusion(src, dst) {
- var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+export function exclusion(src, dst) {
+ let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
src.a *= ops;
- var a = dst.a + src.a - dst.a * src.a;
- var sra = src.r * src.a;
- var sga = src.g * src.a;
- var sba = src.b * src.a;
- var dra = dst.r * dst.a;
- var dga = dst.g * dst.a;
- var dba = dst.b * dst.a;
- var r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
- var g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
- var b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
+ const a = dst.a + src.a - dst.a * src.a;
+ const sra = src.r * src.a;
+ const sga = src.g * src.a;
+ const sba = src.b * src.a;
+ const dra = dst.r * dst.a;
+ const dga = dst.g * dst.a;
+ const dba = dst.b * dst.a;
+ const r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;
+ const g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;
+ const b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;
return {
- r: r,
- g: g,
- b: b,
- a: a
+ r,
+ g,
+ b,
+ a
};
}
//# sourceMappingURL=composite-modes.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map b/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map
index 2d24ac88..89d703c6 100644
--- a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map
+++ b/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/composite/composite-modes.js"],"names":["srcOver","src","dst","ops","a","r","g","b","dstOver","multiply","sra","sga","sba","dra","dga","dba","add","screen","overlay","darken","Math","min","lighten","max","hardLight","difference","exclusion"],"mappings":";;;;;;;;;;;;;;;;;AAAO,SAASA,O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AAIV,GAAG,CAACE,CAAZ,CAHJ,GAICW,GAAG,IAAI,IAAId,GAAG,CAACG,CAAZ,CAJL,IAKAA,CANF;AAQA,SAAO;AAAEC,IAAAA,CAAC,EAADA,CAAF;AAAKC,IAAAA,CAAC,EAADA,CAAL;AAAQC,IAAAA,CAAC,EAADA,CAAR;AAAWH,IAAAA,CAAC,EAADA;AAAX,GAAP;AACD","sourcesContent":["export function srcOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;\n const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;\n const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function dstOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;\n const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;\n const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function multiply(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function add(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra) / a;\n const g = (sga + dga) / a;\n const b = (sba + dba) / a;\n\n return { r, g, b, a };\n}\n\nexport function screen(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function overlay(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * dra <= dst.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * dga <= dst.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * dba <= dst.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function darken(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.min(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.min(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.min(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function lighten(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.max(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.max(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.max(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function hardLight(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * sra <= src.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * sga <= src.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * sba <= src.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function difference(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;\n const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;\n const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function exclusion(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n 2 * sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n 2 * sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n 2 * sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n"],"file":"composite-modes.js"}
\ No newline at end of file
+{"version":3,"file":"composite-modes.js","names":["srcOver","src","dst","ops","a","r","g","b","dstOver","multiply","sra","sga","sba","dra","dga","dba","add","screen","overlay","darken","Math","min","lighten","max","hardLight","difference","exclusion"],"sources":["../../src/composite/composite-modes.js"],"sourcesContent":["export function srcOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;\n const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;\n const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function dstOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;\n const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;\n const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function multiply(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function add(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra) / a;\n const g = (sga + dga) / a;\n const b = (sba + dba) / a;\n\n return { r, g, b, a };\n}\n\nexport function screen(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function overlay(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * dra <= dst.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * dga <= dst.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * dba <= dst.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function darken(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.min(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.min(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.min(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function lighten(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.max(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.max(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.max(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function hardLight(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * sra <= src.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * sga <= src.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * sba <= src.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function difference(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;\n const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;\n const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function exclusion(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n 2 * sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n 2 * sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n 2 * sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n"],"mappings":"AAAA,OAAO,SAASA,OAAO,CAACC,GAAG,EAAEC,GAAG,EAAW;EAAA,IAATC,GAAG,uEAAG,CAAC;EACvCF,GAAG,CAACG,CAAC,IAAID,GAAG;EAEZ,MAAMC,CAAC,GAAGF,GAAG,CAACE,CAAC,GAAGH,GAAG,CAACG,CAAC,GAAGF,GAAG,CAACE,CAAC,GAAGH,GAAG,CAACG,CAAC;EAEvC,MAAMC,CAAC,GAAG,CAACJ,GAAG,CAACI,CAAC,GAAGJ,GAAG,CAACG,CAAC,GAAGF,GAAG,CAACG,CAAC,GAAGH,GAAG,CAACE,CAAC,IAAI,CAAC,GAAGH,GAAG,CAACG,CAAC,CAAC,IAAIA,CAAC;EAC3D,MAAME,CAAC,GAAG,CAACL,GAAG,CAACK,CAAC,GAAGL,GAAG,CAACG,CAAC,GAAGF,GAAG,CAACI,CAAC,GAAGJ,GAAG,CAACE,CAAC,IAAI,CAAC,GAAGH,GAAG,CAACG,CAAC,CAAC,IAAIA,CAAC;EAC3D,MAAM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C,IACnBA,CAAC;EAEH,OAAO;IAAEC,CAAC;IAAEC,CAAC;IAAEC,CAAC;IAAEH;EAAE,CAAC;AACvB"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/composite/index.js b/project starter code/node_modules/@jimp/core/es/composite/index.js
index cd3165d7..2b4748e0 100644
--- a/project starter code/node_modules/@jimp/core/es/composite/index.js
+++ b/project starter code/node_modules/@jimp/core/es/composite/index.js
@@ -1,17 +1,6 @@
-"use strict";
-
-var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = composite;
-
-var _utils = require("@jimp/utils");
-
-var constants = _interopRequireWildcard(require("../constants"));
-
-var compositeModes = _interopRequireWildcard(require("./composite-modes"));
+import { isNodePattern, throwError } from "@jimp/utils";
+import * as constants from "../constants";
+import * as compositeModes from "./composite-modes";
/**
* Composites a source image over to this image respecting alpha channels
@@ -22,53 +11,51 @@ var compositeModes = _interopRequireWildcard(require("./composite-modes"));
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-function composite(src, x, y) {
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- var cb = arguments.length > 4 ? arguments[4] : undefined;
-
- if (typeof options === 'function') {
+export default function composite(src, x, y) {
+ let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+ let cb = arguments.length > 4 ? arguments[4] : undefined;
+ if (typeof options === "function") {
cb = options;
options = {};
}
-
if (!(src instanceof this.constructor)) {
- return _utils.throwError.call(this, 'The source must be a Jimp image', cb);
+ return throwError.call(this, "The source must be a Jimp image", cb);
}
-
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers', cb);
+ if (typeof x !== "number" || typeof y !== "number") {
+ return throwError.call(this, "x and y must be numbers", cb);
}
-
- var _options = options,
- mode = _options.mode,
- opacitySource = _options.opacitySource,
- opacityDest = _options.opacityDest;
-
+ let {
+ mode,
+ opacitySource,
+ opacityDest
+ } = options;
if (!mode) {
mode = constants.BLEND_SOURCE_OVER;
}
-
- if (typeof opacitySource !== 'number' || opacitySource < 0 || opacitySource > 1) {
+ if (typeof opacitySource !== "number" || opacitySource < 0 || opacitySource > 1) {
opacitySource = 1.0;
}
-
- if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) {
+ if (typeof opacityDest !== "number" || opacityDest < 0 || opacityDest > 1) {
opacityDest = 1.0;
}
- var blendmode = compositeModes[mode]; // round input
+ // eslint-disable-next-line import/namespace
+ const blendmode = compositeModes[mode];
+ // round input
x = Math.round(x);
y = Math.round(y);
- var baseImage = this;
-
+ const baseImage = this;
if (opacityDest !== 1.0) {
baseImage.opacity(opacityDest);
}
-
src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) {
- var dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);
- var blended = blendmode({
+ const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);
+ if (dstIdx === -1) {
+ // Skip target pixels outside of dst
+ return;
+ }
+ const blended = blendmode({
r: this.bitmap.data[idx + 0] / 255,
g: this.bitmap.data[idx + 1] / 255,
b: this.bitmap.data[idx + 2] / 255,
@@ -84,11 +71,9 @@ function composite(src, x, y) {
baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(blended.b * 255);
baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(blended.a * 255);
});
-
- if ((0, _utils.isNodePattern)(cb)) {
+ if (isNodePattern(cb)) {
cb.call(this, null, this);
}
-
return this;
}
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/composite/index.js.map b/project starter code/node_modules/@jimp/core/es/composite/index.js.map
index 290d15ef..3629f6f1 100644
--- a/project starter code/node_modules/@jimp/core/es/composite/index.js.map
+++ b/project starter code/node_modules/@jimp/core/es/composite/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/composite/index.js"],"names":["composite","src","x","y","options","cb","constructor","throwError","call","mode","opacitySource","opacityDest","constants","BLEND_SOURCE_OVER","blendmode","compositeModes","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;;;;;;;;;AASe,SAASA,SAAT,CAAmBC,GAAnB,EAAwBC,CAAxB,EAA2BC,CAA3B,EAAgD;AAAA,MAAlBC,OAAkB,uEAAR,EAAQ;AAAA,MAAJC,EAAI;;AAC7D,MAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,IAAAA,EAAE,GAAGD,OAAL;AACAA,IAAAA,OAAO,GAAG,EAAV;AACD;;AAED,MAAI,EAAEH,GAAG,YAAY,KAAKK,WAAtB,CAAJ,EAAwC;AACtC,WAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,MAAI,OAAOH,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,WAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAZ4D,iBAclBD,OAdkB;AAAA,MAcvDK,IAduD,YAcvDA,IAduD;AAAA,MAcjDC,aAdiD,YAcjDA,aAdiD;AAAA,MAclCC,WAdkC,YAclCA,WAdkC;;AAgB7D,MAAI,CAACF,IAAL,EAAW;AACTA,IAAAA,IAAI,GAAGG,SAAS,CAACC,iBAAjB;AACD;;AAED,MACE,OAAOH,aAAP,KAAyB,QAAzB,IACAA,aAAa,GAAG,CADhB,IAEAA,aAAa,GAAG,CAHlB,EAIE;AACAA,IAAAA,aAAa,GAAG,GAAhB;AACD;;AAED,MAAI,OAAOC,WAAP,KAAuB,QAAvB,IAAmCA,WAAW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imp/utils';\nimport * as constants from '../constants';\n\nimport * as compositeModes from './composite-modes';\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== 'number' ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","throwError","constants","compositeModes","composite","src","x","y","options","cb","constructor","call","mode","opacitySource","opacityDest","BLEND_SOURCE_OVER","blendmode","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255"],"sources":["../../src/composite/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\nimport * as constants from \"../constants\";\n\nimport * as compositeModes from \"./composite-modes\";\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== \"number\" ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== \"number\" || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n // eslint-disable-next-line import/namespace\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(\n 0,\n 0,\n src.bitmap.width,\n src.bitmap.height,\n function (sx, sy, idx) {\n const dstIdx = baseImage.getPixelIndex(\n x + sx,\n y + sy,\n constants.EDGE_CROP\n );\n\n if (dstIdx === -1) {\n // Skip target pixels outside of dst\n return;\n }\n\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255,\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255,\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;AACvD,OAAO,KAAKC,SAAS,MAAM,cAAc;AAEzC,OAAO,KAAKC,cAAc,MAAM,mBAAmB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,SAAS,CAACC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAoB;EAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;EAAA,IAAEC,EAAE;EAC3D,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;IACjCC,EAAE,GAAGD,OAAO;IACZA,OAAO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AAQ,CAC3DN,OAAO,CAACG,CAAC,GAAG,GAAG,CAChB;IACDf,SAAS,CAACG,MAAM,CAACW,IAAI,CAACL,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAClB,WAAW,CAAC2B,QAAQ,CAC3DN,OAAO,CAACI,CAAC,GAAG,GAAG,CAChB;IACDhB,SAAS,CAACG,MAAM,CAACW,IAAI,CAACL,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAClB,WAAW,CAAC2B,QAAQ,CAC3DN,OAAO,CAACK,CAAC,GAAG,GAAG,CAChB;EACH,CAAC,CACF;EAED,IAAIpC,aAAa,CAACS,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/constants.js b/project starter code/node_modules/@jimp/core/es/constants.js
index cc86acb3..0fd9babf 100644
--- a/project starter code/node_modules/@jimp/core/es/constants.js
+++ b/project starter code/node_modules/@jimp/core/es/constants.js
@@ -1,53 +1,29 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.EDGE_CROP = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_HARDLIGHT = exports.BLEND_LIGHTEN = exports.BLEND_DARKEN = exports.BLEND_OVERLAY = exports.BLEND_SCREEN = exports.BLEND_ADD = exports.BLEND_MULTIPLY = exports.BLEND_DESTINATION_OVER = exports.BLEND_SOURCE_OVER = exports.VERTICAL_ALIGN_BOTTOM = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_TOP = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_CENTER = exports.HORIZONTAL_ALIGN_LEFT = exports.AUTO = void 0;
// used to auto resizing etc.
-var AUTO = -1; // Align modes for cover, contain, bit masks
+export const AUTO = -1;
-exports.AUTO = AUTO;
-var HORIZONTAL_ALIGN_LEFT = 1;
-exports.HORIZONTAL_ALIGN_LEFT = HORIZONTAL_ALIGN_LEFT;
-var HORIZONTAL_ALIGN_CENTER = 2;
-exports.HORIZONTAL_ALIGN_CENTER = HORIZONTAL_ALIGN_CENTER;
-var HORIZONTAL_ALIGN_RIGHT = 4;
-exports.HORIZONTAL_ALIGN_RIGHT = HORIZONTAL_ALIGN_RIGHT;
-var VERTICAL_ALIGN_TOP = 8;
-exports.VERTICAL_ALIGN_TOP = VERTICAL_ALIGN_TOP;
-var VERTICAL_ALIGN_MIDDLE = 16;
-exports.VERTICAL_ALIGN_MIDDLE = VERTICAL_ALIGN_MIDDLE;
-var VERTICAL_ALIGN_BOTTOM = 32; // blend modes
+// Align modes for cover, contain, bit masks
+export const HORIZONTAL_ALIGN_LEFT = 1;
+export const HORIZONTAL_ALIGN_CENTER = 2;
+export const HORIZONTAL_ALIGN_RIGHT = 4;
+export const VERTICAL_ALIGN_TOP = 8;
+export const VERTICAL_ALIGN_MIDDLE = 16;
+export const VERTICAL_ALIGN_BOTTOM = 32;
-exports.VERTICAL_ALIGN_BOTTOM = VERTICAL_ALIGN_BOTTOM;
-var BLEND_SOURCE_OVER = 'srcOver';
-exports.BLEND_SOURCE_OVER = BLEND_SOURCE_OVER;
-var BLEND_DESTINATION_OVER = 'dstOver';
-exports.BLEND_DESTINATION_OVER = BLEND_DESTINATION_OVER;
-var BLEND_MULTIPLY = 'multiply';
-exports.BLEND_MULTIPLY = BLEND_MULTIPLY;
-var BLEND_ADD = 'add';
-exports.BLEND_ADD = BLEND_ADD;
-var BLEND_SCREEN = 'screen';
-exports.BLEND_SCREEN = BLEND_SCREEN;
-var BLEND_OVERLAY = 'overlay';
-exports.BLEND_OVERLAY = BLEND_OVERLAY;
-var BLEND_DARKEN = 'darken';
-exports.BLEND_DARKEN = BLEND_DARKEN;
-var BLEND_LIGHTEN = 'lighten';
-exports.BLEND_LIGHTEN = BLEND_LIGHTEN;
-var BLEND_HARDLIGHT = 'hardLight';
-exports.BLEND_HARDLIGHT = BLEND_HARDLIGHT;
-var BLEND_DIFFERENCE = 'difference';
-exports.BLEND_DIFFERENCE = BLEND_DIFFERENCE;
-var BLEND_EXCLUSION = 'exclusion'; // Edge Handling
+// blend modes
+export const BLEND_SOURCE_OVER = "srcOver";
+export const BLEND_DESTINATION_OVER = "dstOver";
+export const BLEND_MULTIPLY = "multiply";
+export const BLEND_ADD = "add";
+export const BLEND_SCREEN = "screen";
+export const BLEND_OVERLAY = "overlay";
+export const BLEND_DARKEN = "darken";
+export const BLEND_LIGHTEN = "lighten";
+export const BLEND_HARDLIGHT = "hardLight";
+export const BLEND_DIFFERENCE = "difference";
+export const BLEND_EXCLUSION = "exclusion";
-exports.BLEND_EXCLUSION = BLEND_EXCLUSION;
-var EDGE_EXTEND = 1;
-exports.EDGE_EXTEND = EDGE_EXTEND;
-var EDGE_WRAP = 2;
-exports.EDGE_WRAP = EDGE_WRAP;
-var EDGE_CROP = 3;
-exports.EDGE_CROP = EDGE_CROP;
+// Edge Handling
+export const EDGE_EXTEND = 1;
+export const EDGE_WRAP = 2;
+export const EDGE_CROP = 3;
//# sourceMappingURL=constants.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/constants.js.map b/project starter code/node_modules/@jimp/core/es/constants.js.map
index 31fc25ea..c3f0c2f7 100644
--- a/project starter code/node_modules/@jimp/core/es/constants.js.map
+++ b/project starter code/node_modules/@jimp/core/es/constants.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/constants.js"],"names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"mappings":";;;;;;AAAA;AACO,IAAMA,IAAI,GAAG,CAAC,CAAd,C,CAEP;;;AACO,IAAMC,qBAAqB,GAAG,CAA9B;;AACA,IAAMC,uBAAuB,GAAG,CAAhC;;AACA,IAAMC,sBAAsB,GAAG,CAA/B;;AAEA,IAAMC,kBAAkB,GAAG,CAA3B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B,C,CAEP;;;AACO,IAAMC,iBAAiB,GAAG,SAA1B;;AACA,IAAMC,sBAAsB,GAAG,SAA/B;;AACA,IAAMC,cAAc,GAAG,UAAvB;;AACA,IAAMC,SAAS,GAAG,KAAlB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,eAAe,GAAG,WAAxB;;AACA,IAAMC,gBAAgB,GAAG,YAAzB;;AACA,IAAMC,eAAe,GAAG,WAAxB,C,CAEP;;;AACO,IAAMC,WAAW,GAAG,CAApB;;AACA,IAAMC,SAAS,GAAG,CAAlB;;AACA,IAAMC,SAAS,GAAG,CAAlB","sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = 'srcOver';\nexport const BLEND_DESTINATION_OVER = 'dstOver';\nexport const BLEND_MULTIPLY = 'multiply';\nexport const BLEND_ADD = 'add';\nexport const BLEND_SCREEN = 'screen';\nexport const BLEND_OVERLAY = 'overlay';\nexport const BLEND_DARKEN = 'darken';\nexport const BLEND_LIGHTEN = 'lighten';\nexport const BLEND_HARDLIGHT = 'hardLight';\nexport const BLEND_DIFFERENCE = 'difference';\nexport const BLEND_EXCLUSION = 'exclusion';\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"file":"constants.js"}
\ No newline at end of file
+{"version":3,"file":"constants.js","names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"sources":["../src/constants.js"],"sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = \"srcOver\";\nexport const BLEND_DESTINATION_OVER = \"dstOver\";\nexport const BLEND_MULTIPLY = \"multiply\";\nexport const BLEND_ADD = \"add\";\nexport const BLEND_SCREEN = \"screen\";\nexport const BLEND_OVERLAY = \"overlay\";\nexport const BLEND_DARKEN = \"darken\";\nexport const BLEND_LIGHTEN = \"lighten\";\nexport const BLEND_HARDLIGHT = \"hardLight\";\nexport const BLEND_DIFFERENCE = \"difference\";\nexport const BLEND_EXCLUSION = \"exclusion\";\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"mappings":"AAAA;AACA,OAAO,MAAMA,IAAI,GAAG,CAAC,CAAC;;AAEtB;AACA,OAAO,MAAMC,qBAAqB,GAAG,CAAC;AACtC,OAAO,MAAMC,uBAAuB,GAAG,CAAC;AACxC,OAAO,MAAMC,sBAAsB,GAAG,CAAC;AAEvC,OAAO,MAAMC,kBAAkB,GAAG,CAAC;AACnC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;;AAEvC;AACA,OAAO,MAAMC,iBAAiB,GAAG,SAAS;AAC1C,OAAO,MAAMC,sBAAsB,GAAG,SAAS;AAC/C,OAAO,MAAMC,cAAc,GAAG,UAAU;AACxC,OAAO,MAAMC,SAAS,GAAG,KAAK;AAC9B,OAAO,MAAMC,YAAY,GAAG,QAAQ;AACpC,OAAO,MAAMC,aAAa,GAAG,SAAS;AACtC,OAAO,MAAMC,YAAY,GAAG,QAAQ;AACpC,OAAO,MAAMC,aAAa,GAAG,SAAS;AACtC,OAAO,MAAMC,eAAe,GAAG,WAAW;AAC1C,OAAO,MAAMC,gBAAgB,GAAG,YAAY;AAC5C,OAAO,MAAMC,eAAe,GAAG,WAAW;;AAE1C;AACA,OAAO,MAAMC,WAAW,GAAG,CAAC;AAC5B,OAAO,MAAMC,SAAS,GAAG,CAAC;AAC1B,OAAO,MAAMC,SAAS,GAAG,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/index.js b/project starter code/node_modules/@jimp/core/es/index.js
index a656d756..cb4569db 100644
--- a/project starter code/node_modules/@jimp/core/es/index.js
+++ b/project starter code/node_modules/@jimp/core/es/index.js
@@ -1,165 +1,96 @@
-"use strict";
-
-var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.addConstants = addConstants;
-exports.addJimpMethods = addJimpMethods;
-exports.jimpEvMethod = jimpEvMethod;
-exports.jimpEvChange = jimpEvChange;
-Object.defineProperty(exports, "addType", {
- enumerable: true,
- get: function get() {
- return MIME.addType;
- }
-});
-exports["default"] = void 0;
-
-var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
-
-var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
-
-var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
-
-var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
-
-var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
-
-var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
-
-var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
-
-var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
-
-var _fs = _interopRequireDefault(require("fs"));
-
-var _path = _interopRequireDefault(require("path"));
-
-var _events = _interopRequireDefault(require("events"));
-
-var _utils = require("@jimp/utils");
-
-var _anyBase = _interopRequireDefault(require("any-base"));
-
-var _mkdirp = _interopRequireDefault(require("mkdirp"));
-
-var _pixelmatch = _interopRequireDefault(require("pixelmatch"));
-
-var _tinycolor = _interopRequireDefault(require("tinycolor2"));
-
-var _phash = _interopRequireDefault(require("./modules/phash"));
-
-var _request = _interopRequireDefault(require("./request"));
-
-var _composite = _interopRequireDefault(require("./composite"));
-
-var _promisify = _interopRequireDefault(require("./utils/promisify"));
-
-var MIME = _interopRequireWildcard(require("./utils/mime"));
-
-var _imageBitmap = require("./utils/image-bitmap");
-
-var constants = _interopRequireWildcard(require("./constants"));
-
-var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'; // an array storing the maximum string length of hashes at various bases
+function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
+function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
+import fs from "fs";
+import Path from "path";
+import EventEmitter from "events";
+import { isNodePattern, throwError, scan, scanIterator } from "@jimp/utils";
+import anyBase from "any-base";
+import pixelMatch from "pixelmatch";
+import tinyColor from "tinycolor2";
+import ImagePHash from "./modules/phash";
+import request from "./request";
+import composite from "./composite";
+import promisify from "./utils/promisify";
+import * as MIME from "./utils/mime";
+import { parseBitmap, getBuffer, getBufferAsync } from "./utils/image-bitmap";
+import * as constants from "./constants";
+const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_";
+
+// an array storing the maximum string length of hashes at various bases
// 0 and 1 do not exist as possible hash lengths
-
-var maxHashLength = [NaN, NaN];
-
-for (var i = 2; i < 65; i++) {
- var maxHash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, i))(new Array(64 + 1).join('1'));
+const maxHashLength = [NaN, NaN];
+for (let i = 2; i < 65; i++) {
+ const maxHash = anyBase(anyBase.BIN, alphabet.slice(0, i))(new Array(64 + 1).join("1"));
maxHashLength.push(maxHash.length);
-} // no operation
-
+}
-function noop() {} // error checking methods
+// no operation
+function noop() {}
+// error checking methods
function isArrayBuffer(test) {
- return Object.prototype.toString.call(test).toLowerCase().indexOf('arraybuffer') > -1;
-} // Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,
-// But this function is not useful when running in node directly
-
+ return Object.prototype.toString.call(test).toLowerCase().indexOf("arraybuffer") > -1;
+}
+// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,
+// But this function is not useful when running in node directly
function bufferFromArrayBuffer(arrayBuffer) {
- var buffer = Buffer.alloc(arrayBuffer.byteLength);
- var view = new Uint8Array(arrayBuffer);
-
- for (var _i = 0; _i < buffer.length; ++_i) {
- buffer[_i] = view[_i];
+ const buffer = Buffer.alloc(arrayBuffer.byteLength);
+ const view = new Uint8Array(arrayBuffer);
+ for (let i = 0; i < buffer.length; ++i) {
+ buffer[i] = view[i];
}
-
return buffer;
}
-
function loadFromURL(options, cb) {
- (0, _request["default"])(options, function (err, response, data) {
+ request(options, (err, data) => {
if (err) {
return cb(err);
}
-
- if ('headers' in response && 'location' in response.headers) {
- options.url = response.headers.location;
- return loadFromURL(options, cb);
- }
-
- if ((0, _typeof2["default"])(data) === 'object' && Buffer.isBuffer(data)) {
+ if (typeof data === "object" && Buffer.isBuffer(data)) {
return cb(null, data);
}
-
- var msg = 'Could not load Buffer from <' + options.url + '> ' + '(HTTP: ' + response.statusCode + ')';
- return new Error(msg);
+ if (typeof data === "object" && isArrayBuffer(data)) {
+ return cb(null, bufferFromArrayBuffer(data));
+ }
+ return new Error(`Could not load Buffer from <${options.url}>`);
});
}
-
function loadBufferFromPath(src, cb) {
- if (_fs["default"] && typeof _fs["default"].readFile === 'function' && !src.match(/^(http|ftp)s?:\/\/./)) {
- _fs["default"].readFile(src, cb);
+ if (fs && typeof fs.readFile === "function" && !src.match(/^(http|ftp)s?:\/\/./)) {
+ fs.readFile(src, cb);
} else {
loadFromURL({
url: src
}, cb);
}
}
-
function isRawRGBAData(obj) {
- return obj && (0, _typeof2["default"])(obj) === 'object' && typeof obj.width === 'number' && typeof obj.height === 'number' && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === 'function' && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3);
+ return obj && typeof obj === "object" && typeof obj.width === "number" && typeof obj.height === "number" && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === "function" && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3);
}
-
function makeRGBABufferFromRGB(buffer) {
if (buffer.length % 3 !== 0) {
- throw new Error('Buffer length is incorrect');
+ throw new Error("Buffer length is incorrect");
}
-
- var rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4);
- var j = 0;
-
- for (var _i2 = 0; _i2 < buffer.length; _i2++) {
- rgbaBuffer[j] = buffer[_i2];
-
- if ((_i2 + 1) % 3 === 0) {
+ const rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4);
+ let j = 0;
+ for (let i = 0; i < buffer.length; i++) {
+ rgbaBuffer[j] = buffer[i];
+ if ((i + 1) % 3 === 0) {
rgbaBuffer[++j] = 255;
}
-
j++;
}
-
return rgbaBuffer;
}
-
-var emptyBitmap = {
+const emptyBitmap = {
data: null,
width: null,
height: null
};
+
/**
* Jimp constructor (from a file)
* @param path a path to the image
@@ -199,222 +130,181 @@ var emptyBitmap = {
* @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap
*/
-var Jimp =
-/*#__PURE__*/
-function (_EventEmitter) {
- (0, _inherits2["default"])(Jimp, _EventEmitter);
-
+class Jimp extends EventEmitter {
// An object representing a bitmap in memory, comprising:
// - data: a buffer of the bitmap data
// - width: the width of the image in pixels
// - height: the height of the image in pixels
+
// Default colour to use for new pixels
+
// Default MIME is PNG
+
// Exif data for the image
+
// Whether Transparency supporting formats will be exported as RGB or RGBA
- function Jimp() {
- var _this;
+ constructor() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
-
- (0, _classCallCheck2["default"])(this, Jimp);
- _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Jimp).call(this));
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bitmap", emptyBitmap);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_background", 0x00000000);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_originalMime", Jimp.MIME_PNG);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_exif", null);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_rgba", true);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function (path) {
- return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path);
- });
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBase64Async", function (mime) {
- return (0, _promisify["default"])(_this.getBase64, (0, _assertThisInitialized2["default"])(_this), mime);
- });
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBuffer", _imageBitmap.getBuffer);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBufferAsync", _imageBitmap.getBufferAsync);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPixelColour", _this.getPixelColor);
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setPixelColour", _this.setPixelColor);
- var jimpInstance = (0, _assertThisInitialized2["default"])(_this);
- var cb = noop;
-
+ super();
+ _defineProperty(this, "bitmap", emptyBitmap);
+ _defineProperty(this, "_background", 0x00000000);
+ _defineProperty(this, "_originalMime", Jimp.MIME_PNG);
+ _defineProperty(this, "_exif", null);
+ _defineProperty(this, "_rgba", true);
+ _defineProperty(this, "writeAsync", path => promisify(this.write, this, path));
+ _defineProperty(this, "getBase64Async", mime => promisify(this.getBase64, this, mime));
+ _defineProperty(this, "getBuffer", getBuffer);
+ _defineProperty(this, "getBufferAsync", getBufferAsync);
+ _defineProperty(this, "getPixelColour", this.getPixelColor);
+ _defineProperty(this, "setPixelColour", this.setPixelColor);
+ const jimpInstance = this;
+ let cb = noop;
if (isArrayBuffer(args[0])) {
args[0] = bufferFromArrayBuffer(args[0]);
}
-
function finish() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
-
- var err = args[0];
- var evData = err || {};
- evData.methodName = 'constructor';
- setTimeout(function () {
- var _cb;
-
+ const [err] = args;
+ const evData = err || {};
+ evData.methodName = "constructor";
+ setTimeout(() => {
// run on next tick.
if (err && cb === noop) {
- jimpInstance.emitError('constructor', err);
+ jimpInstance.emitError("constructor", err);
} else if (!err) {
- jimpInstance.emitMulti('constructor', 'initialized');
+ jimpInstance.emitMulti("constructor", "initialized");
}
-
- (_cb = cb).call.apply(_cb, [jimpInstance].concat(args));
+ cb.call(jimpInstance, ...args);
}, 1);
}
-
- if (typeof args[0] === 'number' && typeof args[1] === 'number' || parseInt(args[0], 10) && parseInt(args[1], 10)) {
+ if (typeof args[0] === "number" && typeof args[1] === "number" || parseInt(args[0], 10) && parseInt(args[1], 10)) {
// create a new image
- var w = parseInt(args[0], 10);
- var h = parseInt(args[1], 10);
- cb = args[2]; // with a hex color
+ const w = parseInt(args[0], 10);
+ const h = parseInt(args[1], 10);
+ cb = args[2];
- if (typeof args[2] === 'number') {
- _this._background = args[2];
+ // with a hex color
+ if (typeof args[2] === "number") {
+ this._background = args[2];
cb = args[3];
- } // with a css color
-
+ }
- if (typeof args[2] === 'string') {
- _this._background = Jimp.cssColorToHex(args[2]);
+ // with a css color
+ if (typeof args[2] === "string") {
+ this._background = Jimp.cssColorToHex(args[2]);
cb = args[3];
}
-
- if (typeof cb === 'undefined') {
+ if (typeof cb === "undefined") {
cb = noop;
}
-
- if (typeof cb !== 'function') {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish));
+ if (typeof cb !== "function") {
+ return throwError.call(this, "cb must be a function", finish);
}
-
- _this.bitmap = {
+ this.bitmap = {
data: Buffer.alloc(w * h * 4),
width: w,
height: h
};
-
- for (var _i3 = 0; _i3 < _this.bitmap.data.length; _i3 += 4) {
- _this.bitmap.data.writeUInt32BE(_this._background, _i3);
+ for (let i = 0; i < this.bitmap.data.length; i += 4) {
+ this.bitmap.data.writeUInt32BE(this._background, i);
}
-
- finish(null, (0, _assertThisInitialized2["default"])(_this));
- } else if ((0, _typeof2["default"])(args[0]) === 'object' && args[0].url) {
+ finish(null, this);
+ } else if (typeof args[0] === "object" && args[0].url) {
cb = args[1] || noop;
-
- if (typeof cb !== 'function') {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish));
+ if (typeof cb !== "function") {
+ return throwError.call(this, "cb must be a function", finish);
}
-
- loadFromURL(args[0], function (err, data) {
+ loadFromURL(args[0], (err, data) => {
if (err) {
- return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish);
+ return throwError.call(this, err, finish);
}
-
- _this.parseBitmap(data, args[0].url, finish);
+ this.parseBitmap(data, args[0].url, finish);
});
} else if (args[0] instanceof Jimp) {
// clone an existing Jimp
- var original = args[0];
+ const [original] = args;
cb = args[1];
-
- if (typeof cb === 'undefined') {
+ if (typeof cb === "undefined") {
cb = noop;
}
-
- if (typeof cb !== 'function') {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish));
+ if (typeof cb !== "function") {
+ return throwError.call(this, "cb must be a function", finish);
}
-
- _this.bitmap = {
+ this.bitmap = {
data: Buffer.from(original.bitmap.data),
width: original.bitmap.width,
height: original.bitmap.height
};
- _this._quality = original._quality;
- _this._deflateLevel = original._deflateLevel;
- _this._deflateStrategy = original._deflateStrategy;
- _this._filterType = original._filterType;
- _this._rgba = original._rgba;
- _this._background = original._background;
- _this._originalMime = original._originalMime;
- finish(null, (0, _assertThisInitialized2["default"])(_this));
+ this._quality = original._quality;
+ this._deflateLevel = original._deflateLevel;
+ this._deflateStrategy = original._deflateStrategy;
+ this._filterType = original._filterType;
+ this._rgba = original._rgba;
+ this._background = original._background;
+ this._originalMime = original._originalMime;
+ finish(null, this);
} else if (isRawRGBAData(args[0])) {
- var imageData = args[0];
+ const [imageData] = args;
cb = args[1] || noop;
- var isRGBA = imageData.width * imageData.height * 4 === imageData.data.length;
- var buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data);
- _this.bitmap = {
+ const isRGBA = imageData.width * imageData.height * 4 === imageData.data.length;
+ const buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data);
+ this.bitmap = {
data: buffer,
width: imageData.width,
height: imageData.height
};
- finish(null, (0, _assertThisInitialized2["default"])(_this));
- } else if (typeof args[0] === 'string') {
+ finish(null, this);
+ } else if (typeof args[0] === "string") {
// read from a path
- var path = args[0];
+ const path = args[0];
cb = args[1];
-
- if (typeof cb === 'undefined') {
+ if (typeof cb === "undefined") {
cb = noop;
}
-
- if (typeof cb !== 'function') {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish));
+ if (typeof cb !== "function") {
+ return throwError.call(this, "cb must be a function", finish);
}
-
- loadBufferFromPath(path, function (err, data) {
+ loadBufferFromPath(path, (err, data) => {
if (err) {
- return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish);
+ return throwError.call(this, err, finish);
}
-
- _this.parseBitmap(data, path, finish);
+ this.parseBitmap(data, path, finish);
});
- } else if ((0, _typeof2["default"])(args[0]) === 'object' && Buffer.isBuffer(args[0])) {
+ } else if (typeof args[0] === "object" && Buffer.isBuffer(args[0])) {
// read from a buffer
- var data = args[0];
+ const data = args[0];
cb = args[1];
-
- if (typeof cb !== 'function') {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish));
+ if (typeof cb !== "function") {
+ return throwError.call(this, "cb must be a function", finish);
}
-
- _this.parseBitmap(data, null, finish);
+ this.parseBitmap(data, null, finish);
} else {
// Allow client libs to add new ways to build a Jimp object.
// Extra constructors must be added by `Jimp.appendConstructorOption()`
cb = args[args.length - 1];
-
- if (typeof cb !== 'function') {
+ if (typeof cb !== "function") {
// TODO: try to solve the args after cb problem.
cb = args[args.length - 2];
-
- if (typeof cb !== 'function') {
+ if (typeof cb !== "function") {
cb = noop;
}
}
-
- var extraConstructor = Jimp.__extraConstructors.find(function (c) {
- return c.test.apply(c, args);
- });
-
+ const extraConstructor = Jimp.__extraConstructors.find(c => c.test(...args));
if (extraConstructor) {
- new Promise(function (resolve, reject) {
- var _extraConstructor$run;
-
- return (_extraConstructor$run = extraConstructor.run).call.apply(_extraConstructor$run, [(0, _assertThisInitialized2["default"])(_this), resolve, reject].concat(args));
- }).then(function () {
- return finish(null, (0, _assertThisInitialized2["default"])(_this));
- })["catch"](finish);
+ new Promise((resolve, reject) => {
+ extraConstructor.run.call(this, resolve, reject, ...args);
+ }).then(() => finish(null, this)).catch(finish);
} else {
- return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'No matching constructor overloading was found. ' + 'Please see the docs for how to call the Jimp constructor.', finish));
+ return throwError.call(this, "No matching constructor overloading was found. " + "Please see the docs for how to call the Jimp constructor.", finish);
}
}
-
- return _this;
}
+
/**
* Parse a bitmap with the loaded image types.
*
@@ -423,513 +313,408 @@ function (_EventEmitter) {
* @param {function(Error, Jimp)} finish (optional) a callback for when complete
* @memberof Jimp
*/
+ parseBitmap(data, path, finish) {
+ parseBitmap.call(this, data, null, finish);
+ }
+ /**
+ * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)
+ * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ rgba(bool, cb) {
+ if (typeof bool !== "boolean") {
+ return throwError.call(this, "bool must be a boolean, true for RGBA or false for RGB", cb);
+ }
+ this._rgba = bool;
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
- (0, _createClass2["default"])(Jimp, [{
- key: "parseBitmap",
- value: function parseBitmap(data, path, finish) {
- _imageBitmap.parseBitmap.call(this, data, null, finish);
+ /**
+ * Emit for multiple listeners
+ * @param {string} methodName name of the method to emit an error for
+ * @param {string} eventName name of the eventName to emit an error for
+ * @param {object} data to emit
+ */
+ emitMulti(methodName, eventName) {
+ let data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
+ data = Object.assign(data, {
+ methodName,
+ eventName
+ });
+ this.emit("any", data);
+ if (methodName) {
+ this.emit(methodName, data);
}
- /**
- * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)
- * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
+ this.emit(eventName, data);
+ }
+ emitError(methodName, err) {
+ this.emitMulti(methodName, "error", err);
+ }
- }, {
- key: "rgba",
- value: function rgba(bool, cb) {
- if (typeof bool !== 'boolean') {
- return _utils.throwError.call(this, 'bool must be a boolean, true for RGBA or false for RGB', cb);
- }
+ /**
+ * Get the current height of the image
+ * @return {number} height of the image
+ */
+ getHeight() {
+ return this.bitmap.height;
+ }
- this._rgba = bool;
+ /**
+ * Get the current width of the image
+ * @return {number} width of the image
+ */
+ getWidth() {
+ return this.bitmap.width;
+ }
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
+ /**
+ * Nicely format Jimp object when sent to the console e.g. console.log(image)
+ * @returns {string} pretty printed
+ */
+ inspect() {
+ return "";
+ }
- return this;
- }
- /**
- * Emit for multiple listeners
- * @param {string} methodName name of the method to emit an error for
- * @param {string} eventName name of the eventName to emit an error for
- * @param {object} data to emit
- */
+ /**
+ * Nicely format Jimp object when converted to a string
+ * @returns {string} pretty printed
+ */
+ toString() {
+ return "[object Jimp]";
+ }
- }, {
- key: "emitMulti",
- value: function emitMulti(methodName, eventName) {
- var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- data = Object.assign(data, {
- methodName: methodName,
- eventName: eventName
- });
- this.emit('any', data);
+ /**
+ * Returns the original MIME of the image (default: "image/png")
+ * @returns {string} the MIME
+ */
+ getMIME() {
+ const mime = this._originalMime || Jimp.MIME_PNG;
+ return mime;
+ }
- if (methodName) {
- this.emit(methodName, data);
- }
+ /**
+ * Returns the appropriate file extension for the original MIME of the image (default: "png")
+ * @returns {string} the file extension
+ */
+ getExtension() {
+ const mime = this.getMIME();
+ return MIME.getExtension(mime);
+ }
- this.emit(eventName, data);
+ /**
+ * Writes the image to a file
+ * @param {string} path a path to the destination file
+ * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk
+ * @returns {Jimp} this for chaining of methods
+ */
+ write(path, cb) {
+ if (!fs || !fs.createWriteStream) {
+ throw new Error("Cant access the filesystem. You can use the getBase64 method.");
}
- }, {
- key: "emitError",
- value: function emitError(methodName, err) {
- this.emitMulti(methodName, 'error', err);
+ if (typeof path !== "string") {
+ return throwError.call(this, "path must be a string", cb);
}
- /**
- * Get the current height of the image
- * @return {number} height of the image
- */
-
- }, {
- key: "getHeight",
- value: function getHeight() {
- return this.bitmap.height;
+ if (typeof cb === "undefined") {
+ cb = noop;
}
- /**
- * Get the current width of the image
- * @return {number} width of the image
- */
-
- }, {
- key: "getWidth",
- value: function getWidth() {
- return this.bitmap.width;
+ if (typeof cb !== "function") {
+ return throwError.call(this, "cb must be a function", cb);
}
- /**
- * Nicely format Jimp object when sent to the console e.g. console.log(image)
- * @returns {string} pretty printed
- */
-
- }, {
- key: "inspect",
- value: function inspect() {
- return '';
+ const mime = MIME.getType(path) || this.getMIME();
+ const pathObj = Path.parse(path);
+ if (pathObj.dir) {
+ fs.mkdirSync(pathObj.dir, {
+ recursive: true
+ });
}
- /**
- * Nicely format Jimp object when converted to a string
- * @returns {string} pretty printed
- */
-
- }, {
- key: "toString",
- value: function toString() {
- return '[object Jimp]';
+ this.getBuffer(mime, (err, buffer) => {
+ if (err) {
+ return throwError.call(this, err, cb);
+ }
+ const stream = fs.createWriteStream(path);
+ stream.on("open", () => {
+ stream.write(buffer);
+ stream.end();
+ }).on("error", err => {
+ return throwError.call(this, err, cb);
+ });
+ stream.on("finish", () => {
+ cb.call(this, null, this);
+ });
+ });
+ return this;
+ }
+ /**
+ * Converts the image to a base 64 string
+ * @param {string} mime the mime type of the image data to be created
+ * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument
+ * @returns {Jimp} this for chaining of methods
+ */
+ getBase64(mime, cb) {
+ if (mime === Jimp.AUTO) {
+ // allow auto MIME detection
+ mime = this.getMIME();
}
- /**
- * Returns the original MIME of the image (default: "image/png")
- * @returns {string} the MIME
- */
-
- }, {
- key: "getMIME",
- value: function getMIME() {
- var mime = this._originalMime || Jimp.MIME_PNG;
- return mime;
+ if (typeof mime !== "string") {
+ return throwError.call(this, "mime must be a string", cb);
}
- /**
- * Returns the appropriate file extension for the original MIME of the image (default: "png")
- * @returns {string} the file extension
- */
-
- }, {
- key: "getExtension",
- value: function getExtension() {
- var mime = this.getMIME();
- return MIME.getExtension(mime);
+ if (typeof cb !== "function") {
+ return throwError.call(this, "cb must be a function", cb);
}
- /**
- * Writes the image to a file
- * @param {string} path a path to the destination file
- * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk
- * @returns {Jimp} this for chaining of methods
- */
-
- }, {
- key: "write",
- value: function write(path, cb) {
- var _this2 = this;
-
- if (!_fs["default"] || !_fs["default"].createWriteStream) {
- throw new Error('Cant access the filesystem. You can use the getBase64 method.');
- }
-
- if (typeof path !== 'string') {
- return _utils.throwError.call(this, 'path must be a string', cb);
- }
-
- if (typeof cb === 'undefined') {
- cb = noop;
- }
-
- if (typeof cb !== 'function') {
- return _utils.throwError.call(this, 'cb must be a function', cb);
- }
-
- var mime = MIME.getType(path) || this.getMIME();
-
- var pathObj = _path["default"].parse(path);
-
- if (pathObj.dir) {
- _mkdirp["default"].sync(pathObj.dir);
+ this.getBuffer(mime, function (err, data) {
+ if (err) {
+ return throwError.call(this, err, cb);
}
-
- this.getBuffer(mime, function (err, buffer) {
- if (err) {
- return _utils.throwError.call(_this2, err, cb);
- }
-
- var stream = _fs["default"].createWriteStream(path);
-
- stream.on('open', function () {
- stream.write(buffer);
- stream.end();
- }).on('error', function (err) {
- return _utils.throwError.call(_this2, err, cb);
- });
- stream.on('finish', function () {
- cb.call(_this2, null, _this2);
- });
- });
- return this;
+ const src = "data:" + mime + ";base64," + data.toString("base64");
+ cb.call(this, null, src);
+ });
+ return this;
+ }
+ /**
+ * Generates a perceptual hash of the image . And pads the string. Can configure base.
+ * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {string} a string representing the hash
+ */
+ hash(base, cb) {
+ base = base || 64;
+ if (typeof base === "function") {
+ cb = base;
+ base = 64;
}
- }, {
- key: "getBase64",
-
- /**
- * Converts the image to a base 64 string
- * @param {string} mime the mime type of the image data to be created
- * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument
- * @returns {Jimp} this for chaining of methods
- */
- value: function getBase64(mime, cb) {
- if (mime === Jimp.AUTO) {
- // allow auto MIME detection
- mime = this.getMIME();
- }
-
- if (typeof mime !== 'string') {
- return _utils.throwError.call(this, 'mime must be a string', cb);
- }
-
- if (typeof cb !== 'function') {
- return _utils.throwError.call(this, 'cb must be a function', cb);
- }
-
- this.getBuffer(mime, function (err, data) {
- if (err) {
- return _utils.throwError.call(this, err, cb);
- }
-
- var src = 'data:' + mime + ';base64,' + data.toString('base64');
- cb.call(this, null, src);
- });
- return this;
+ if (typeof base !== "number") {
+ return throwError.call(this, "base must be a number", cb);
}
- }, {
- key: "hash",
-
- /**
- * Generates a perceptual hash of the image . And pads the string. Can configure base.
- * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {string} a string representing the hash
- */
- value: function hash(base, cb) {
- base = base || 64;
-
- if (typeof base === 'function') {
- cb = base;
- base = 64;
- }
-
- if (typeof base !== 'number') {
- return _utils.throwError.call(this, 'base must be a number', cb);
- }
-
- if (base < 2 || base > 64) {
- return _utils.throwError.call(this, 'base must be a number between 2 and 64', cb);
- }
-
- var hash = this.pHash();
- hash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, base))(hash);
-
- while (hash.length < maxHashLength[base]) {
- hash = '0' + hash; // pad out with leading zeros
- }
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, hash);
- }
-
- return hash;
+ if (base < 2 || base > 64) {
+ return throwError.call(this, "base must be a number between 2 and 64", cb);
}
- /**
- * Calculates the perceptual hash
- * @returns {number} the perceptual hash
- */
-
- }, {
- key: "pHash",
- value: function pHash() {
- var pHash = new _phash["default"]();
- return pHash.getHash(this);
+ let hash = this.pHash();
+ hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);
+ while (hash.length < maxHashLength[base]) {
+ hash = "0" + hash; // pad out with leading zeros
}
- /**
- * Calculates the hamming distance of the current image and a hash based on their perceptual hash
- * @param {hash} compareHash hash to compare to
- * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical
- */
- }, {
- key: "distanceFromHash",
- value: function distanceFromHash(compareHash) {
- var pHash = new _phash["default"]();
- var currentHash = pHash.getHash(this);
- return pHash.distance(currentHash, compareHash);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, hash);
}
- /**
- * Converts the image to a buffer
- * @param {string} mime the mime type of the image buffer to be created
- * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument
- * @returns {Jimp} this for chaining of methods
- */
-
- }, {
- key: "getPixelIndex",
-
- /**
- * Returns the offset of a pixel in the bitmap buffer
- * @param {number} x the x coordinate
- * @param {number} y the y coordinate
- * @param {string} edgeHandling (optional) define how to sum pixels from outside the border
- * @param {number} cb (optional) a callback for when complete
- * @returns {number} the index of the pixel or -1 if not found
- */
- value: function getPixelIndex(x, y, edgeHandling, cb) {
- var xi;
- var yi;
-
- if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {
- cb = edgeHandling;
- edgeHandling = null;
- }
-
- if (!edgeHandling) {
- edgeHandling = Jimp.EDGE_EXTEND;
- }
-
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers', cb);
- } // round input
-
-
- x = Math.round(x);
- y = Math.round(y);
- xi = x;
- yi = y;
+ return hash;
+ }
- if (edgeHandling === Jimp.EDGE_EXTEND) {
- if (x < 0) xi = 0;
- if (x >= this.bitmap.width) xi = this.bitmap.width - 1;
- if (y < 0) yi = 0;
- if (y >= this.bitmap.height) yi = this.bitmap.height - 1;
- }
+ /**
+ * Calculates the perceptual hash
+ * @returns {number} the perceptual hash
+ */
+ pHash() {
+ const pHash = new ImagePHash();
+ return pHash.getHash(this);
+ }
- if (edgeHandling === Jimp.EDGE_WRAP) {
- if (x < 0) {
- xi = this.bitmap.width + x;
- }
+ /**
+ * Calculates the hamming distance of the current image and a hash based on their perceptual hash
+ * @param {hash} compareHash hash to compare to
+ * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical
+ */
+ distanceFromHash(compareHash) {
+ const pHash = new ImagePHash();
+ const currentHash = pHash.getHash(this);
+ return pHash.distance(currentHash, compareHash);
+ }
- if (x >= this.bitmap.width) {
- xi = x % this.bitmap.width;
- }
+ /**
+ * Converts the image to a buffer
+ * @param {string} mime the mime type of the image buffer to be created
+ * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument
+ * @returns {Jimp} this for chaining of methods
+ */
- if (y < 0) {
- xi = this.bitmap.height + y;
- }
+ /**
+ * Returns the offset of a pixel in the bitmap buffer
+ * @param {number} x the x coordinate
+ * @param {number} y the y coordinate
+ * @param {number} edgeHandling (optional) define how to sum pixels from outside the border
+ * @param {number} cb (optional) a callback for when complete
+ * @returns {number} the index of the pixel or -1 if not found
+ */
+ getPixelIndex(x, y, edgeHandling, cb) {
+ let xi;
+ let yi;
+ if (typeof edgeHandling === "function" && typeof cb === "undefined") {
+ cb = edgeHandling;
+ edgeHandling = null;
+ }
+ if (!edgeHandling) {
+ edgeHandling = Jimp.EDGE_EXTEND;
+ }
+ if (typeof x !== "number" || typeof y !== "number") {
+ return throwError.call(this, "x and y must be numbers", cb);
+ }
- if (y >= this.bitmap.height) {
- yi = y % this.bitmap.height;
- }
+ // round input
+ x = Math.round(x);
+ y = Math.round(y);
+ xi = x;
+ yi = y;
+ if (edgeHandling === Jimp.EDGE_EXTEND) {
+ if (x < 0) xi = 0;
+ if (x >= this.bitmap.width) xi = this.bitmap.width - 1;
+ if (y < 0) yi = 0;
+ if (y >= this.bitmap.height) yi = this.bitmap.height - 1;
+ }
+ if (edgeHandling === Jimp.EDGE_WRAP) {
+ if (x < 0) {
+ xi = this.bitmap.width + x;
}
-
- var i = this.bitmap.width * yi + xi << 2; // if out of bounds index is -1
-
- if (xi < 0 || xi >= this.bitmap.width) {
- i = -1;
+ if (x >= this.bitmap.width) {
+ xi = x % this.bitmap.width;
}
-
- if (yi < 0 || yi >= this.bitmap.height) {
- i = -1;
+ if (y < 0) {
+ yi = this.bitmap.height + y;
}
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, i);
+ if (y >= this.bitmap.height) {
+ yi = y % this.bitmap.height;
}
-
- return i;
}
- /**
- * Returns the hex colour value of a pixel
- * @param {number} x the x coordinate
- * @param {number} y the y coordinate
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {number} the color of the pixel
- */
-
- }, {
- key: "getPixelColor",
- value: function getPixelColor(x, y, cb) {
- if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); // round input
+ let i = this.bitmap.width * yi + xi << 2;
- x = Math.round(x);
- y = Math.round(y);
- var idx = this.getPixelIndex(x, y);
- var hex = this.bitmap.data.readUInt32BE(idx);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, hex);
- }
-
- return hex;
+ // if out of bounds index is -1
+ if (xi < 0 || xi >= this.bitmap.width) {
+ i = -1;
}
- }, {
- key: "setPixelColor",
-
- /**
- * Returns the hex colour value of a pixel
- * @param {number} hex color to set
- * @param {number} x the x coordinate
- * @param {number} y the y coordinate
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {number} the index of the pixel or -1 if not found
- */
- value: function setPixelColor(hex, x, y, cb) {
- if (typeof hex !== 'number' || typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'hex, x and y must be numbers', cb); // round input
-
- x = Math.round(x);
- y = Math.round(y);
- var idx = this.getPixelIndex(x, y);
- this.bitmap.data.writeUInt32BE(hex, idx);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+ if (yi < 0 || yi >= this.bitmap.height) {
+ i = -1;
}
- }, {
- key: "hasAlpha",
-
- /**
- * Determine if the image contains opaque pixels.
- * @return {boolean} hasAlpha whether the image contains opaque pixels
- */
- value: function hasAlpha() {
- for (var yIndex = 0; yIndex < this.bitmap.height; yIndex++) {
- for (var xIndex = 0; xIndex < this.bitmap.width; xIndex++) {
- var idx = this.bitmap.width * yIndex + xIndex << 2;
- var alpha = this.bitmap.data[idx + 3];
-
- if (alpha !== 0xff) {
- return true;
- }
- }
- }
-
- return false;
+ if (isNodePattern(cb)) {
+ cb.call(this, null, i);
}
- /**
- * Iterate scan through a region of the bitmap
- * @param {number} x the x coordinate to begin the scan at
- * @param {number} y the y coordinate to begin the scan at
- * @param w the width of the scan region
- * @param h the height of the scan region
- * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}
- */
-
- }, {
- key: "scanIterator",
- value: function scanIterator(x, y, w, h) {
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers');
- }
+ return i;
+ }
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers');
+ /**
+ * Returns the hex colour value of a pixel
+ * @param {number} x the x coordinate
+ * @param {number} y the y coordinate
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {number} the color of the pixel
+ */
+ getPixelColor(x, y, cb) {
+ if (typeof x !== "number" || typeof y !== "number") return throwError.call(this, "x and y must be numbers", cb);
+ const idx = this.getPixelIndex(x, y);
+ const hex = this.bitmap.data.readUInt32BE(idx);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, hex);
+ }
+ return hex;
+ }
+ /**
+ * Returns the hex colour value of a pixel
+ * @param {number} hex color to set
+ * @param {number} x the x coordinate
+ * @param {number} y the y coordinate
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {number} the index of the pixel or -1 if not found
+ */
+ setPixelColor(hex, x, y, cb) {
+ if (typeof hex !== "number" || typeof x !== "number" || typeof y !== "number") return throwError.call(this, "hex, x and y must be numbers", cb);
+ const idx = this.getPixelIndex(x, y);
+ this.bitmap.data.writeUInt32BE(hex, idx);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+ /**
+ * Determine if the image contains opaque pixels.
+ * @return {boolean} hasAlpha whether the image contains opaque pixels
+ */
+ hasAlpha() {
+ const {
+ width,
+ height,
+ data
+ } = this.bitmap;
+ const byteLen = width * height << 2;
+ for (let idx = 3; idx < byteLen; idx += 4) {
+ if (data[idx] !== 0xff) {
+ return true;
}
-
- return (0, _utils.scanIterator)(this, x, y, w, h);
}
- }]);
- return Jimp;
-}(_events["default"]);
-
-function addConstants(constants) {
- var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;
- Object.entries(constants).forEach(function (_ref) {
- var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
- name = _ref2[0],
- value = _ref2[1];
+ return false;
+ }
+ /**
+ * Iterate scan through a region of the bitmap
+ * @param {number} x the x coordinate to begin the scan at
+ * @param {number} y the y coordinate to begin the scan at
+ * @param w the width of the scan region
+ * @param h the height of the scan region
+ * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}
+ */
+ scanIterator(x, y, w, h) {
+ if (typeof x !== "number" || typeof y !== "number") {
+ return throwError.call(this, "x and y must be numbers");
+ }
+ if (typeof w !== "number" || typeof h !== "number") {
+ return throwError.call(this, "w and h must be numbers");
+ }
+ return scanIterator(this, x, y, w, h);
+ }
+}
+export function addConstants(constants) {
+ let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;
+ Object.entries(constants).forEach(_ref => {
+ let [name, value] = _ref;
jimpInstance[name] = value;
});
}
-
-function addJimpMethods(methods) {
- var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;
- Object.entries(methods).forEach(function (_ref3) {
- var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
- name = _ref4[0],
- value = _ref4[1];
-
+export function addJimpMethods(methods) {
+ let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;
+ Object.entries(methods).forEach(_ref2 => {
+ let [name, value] = _ref2;
jimpInstance.prototype[name] = value;
});
}
-
addConstants(constants);
addJimpMethods({
- composite: _composite["default"]
+ composite
});
Jimp.__extraConstructors = [];
+
/**
* Allow client libs to add new ways to build a Jimp object.
* @param {string} name identify the extra constructor.
* @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.
* @param {function} run where the magic happens.
*/
-
Jimp.appendConstructorOption = function (name, test, run) {
Jimp.__extraConstructors.push({
- name: name,
- test: test,
- run: run
+ name,
+ test,
+ run
});
};
+
/**
* Read an image from a file or a Buffer. Takes the same args as the constructor
* @returns {Promise} a promise
*/
-
-
Jimp.read = function () {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
-
- return new Promise(function (resolve, reject) {
- (0, _construct2["default"])(Jimp, args.concat([function (err, image) {
+ return new Promise((resolve, reject) => {
+ // eslint-disable-next-line no-new
+ new Jimp(...args, (err, image) => {
if (err) reject(err);else resolve(image);
- }]));
+ });
});
};
-
Jimp.create = Jimp.read;
+
/**
* A static helper method that converts RGBA values to a single integer value
* @param {number} r the red value (0-255)
@@ -939,90 +724,82 @@ Jimp.create = Jimp.read;
* @param {function(Error, Jimp)} cb (optional) A callback for when complete
* @returns {number} an single integer colour value
*/
-
Jimp.rgbaToInt = function (r, g, b, a, cb) {
- if (typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' || typeof a !== 'number') {
- return _utils.throwError.call(this, 'r, g, b and a must be numbers', cb);
+ if (typeof r !== "number" || typeof g !== "number" || typeof b !== "number" || typeof a !== "number") {
+ return throwError.call(this, "r, g, b and a must be numbers", cb);
}
-
if (r < 0 || r > 255) {
- return _utils.throwError.call(this, 'r must be between 0 and 255', cb);
+ return throwError.call(this, "r must be between 0 and 255", cb);
}
-
if (g < 0 || g > 255) {
- _utils.throwError.call(this, 'g must be between 0 and 255', cb);
+ throwError.call(this, "g must be between 0 and 255", cb);
}
-
if (b < 0 || b > 255) {
- return _utils.throwError.call(this, 'b must be between 0 and 255', cb);
+ return throwError.call(this, "b must be between 0 and 255", cb);
}
-
if (a < 0 || a > 255) {
- return _utils.throwError.call(this, 'a must be between 0 and 255', cb);
+ return throwError.call(this, "a must be between 0 and 255", cb);
}
-
- r = Math.round(r);
- b = Math.round(b);
- g = Math.round(g);
- a = Math.round(a);
- var i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0);
-
- if ((0, _utils.isNodePattern)(cb)) {
+ let i = r & 0xff;
+ i <<= 8;
+ i |= g & 0xff;
+ i <<= 8;
+ i |= b & 0xff;
+ i <<= 8;
+ i |= a & 0xff;
+
+ // Ensure sign is correct
+ i >>>= 0;
+ if (isNodePattern(cb)) {
cb.call(this, null, i);
}
-
return i;
};
+
/**
* A static helper method that converts RGBA values to a single integer value
* @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)
* @param {function(Error, Jimp)} cb (optional) A callback for when complete
* @returns {object} an object with the properties r, g, b and a representing RGBA values
*/
-
-
Jimp.intToRGBA = function (i, cb) {
- if (typeof i !== 'number') {
- return _utils.throwError.call(this, 'i must be a number', cb);
+ if (typeof i !== "number") {
+ return throwError.call(this, "i must be a number", cb);
}
-
- var rgba = {};
+ const rgba = {};
rgba.r = Math.floor(i / Math.pow(256, 3));
rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));
rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1));
rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0));
-
- if ((0, _utils.isNodePattern)(cb)) {
+ if (isNodePattern(cb)) {
cb.call(this, null, rgba);
}
-
return rgba;
};
+
/**
* Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number
* @param {string} cssColor a number
* @returns {number} a hex number representing a color
*/
-
-
Jimp.cssColorToHex = function (cssColor) {
cssColor = cssColor || 0; // 0, null, undefined, NaN
- if (typeof cssColor === 'number') return Number(cssColor);
- return parseInt((0, _tinycolor["default"])(cssColor).toHex8(), 16);
+ if (typeof cssColor === "number") return Number(cssColor);
+ return parseInt(tinyColor(cssColor).toHex8(), 16);
};
+
/**
* Limits a number to between 0 or 255
* @param {number} n a number
* @returns {number} the number limited to between 0 or 255
*/
-
-
Jimp.limit255 = function (n) {
n = Math.max(n, 0);
n = Math.min(n, 255);
return n;
};
+
/**
* Diffs two images and returns
* @param {Jimp} img1 a Jimp image to compare
@@ -1030,14 +807,11 @@ Jimp.limit255 = function (n) {
* @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)
* @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }
*/
-
-
Jimp.diff = function (img1, img2) {
- var threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1;
- if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, 'img1 and img2 must be an Jimp images');
- var bmp1 = img1.bitmap;
- var bmp2 = img2.bitmap;
-
+ let threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1;
+ if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return throwError.call(this, "img1 and img2 must be an Jimp images");
+ const bmp1 = img1.bitmap;
+ const bmp2 = img2.bitmap;
if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {
if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {
// img1 is bigger
@@ -1047,46 +821,43 @@ Jimp.diff = function (img1, img2) {
img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);
}
}
-
- if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) {
- return _utils.throwError.call(this, 'threshold must be a number between 0 and 1');
+ if (typeof threshold !== "number" || threshold < 0 || threshold > 1) {
+ return throwError.call(this, "threshold must be a number between 0 and 1");
}
-
- var diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);
- var numDiffPixels = (0, _pixelmatch["default"])(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, {
- threshold: threshold
+ const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);
+ const numDiffPixels = pixelMatch(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, {
+ threshold
});
return {
percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),
image: diff
};
};
+
/**
* Calculates the hamming distance of two images based on their perceptual hash
* @param {Jimp} img1 a Jimp image to compare
* @param {Jimp} img2 a Jimp image to compare
* @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical
*/
-
-
Jimp.distance = function (img1, img2) {
- var phash = new _phash["default"]();
- var hash1 = phash.getHash(img1);
- var hash2 = phash.getHash(img2);
+ const phash = new ImagePHash();
+ const hash1 = phash.getHash(img1);
+ const hash2 = phash.getHash(img2);
return phash.distance(hash1, hash2);
};
+
/**
* Calculates the hamming distance of two images based on their perceptual hash
* @param {hash} hash1 a pHash
* @param {hash} hash2 a pHash
* @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical
*/
-
-
Jimp.compareHashes = function (hash1, hash2) {
- var phash = new _phash["default"]();
+ const phash = new ImagePHash();
return phash.distance(hash1, hash2);
};
+
/**
* Compute color difference
* 0 means no difference, 1 means maximum difference.
@@ -1096,26 +867,21 @@ Jimp.compareHashes = function (hash1, hash2) {
* Where `a` is optional and `val` is an integer between 0 and 255.
* @returns {number} float between 0 and 1.
*/
-
-
Jimp.colorDiff = function (rgba1, rgba2) {
- var pow = function pow(n) {
- return Math.pow(n, 2);
- };
-
- var max = Math.max;
- var maxVal = 255 * 255 * 3;
-
+ const pow = n => Math.pow(n, 2);
+ const {
+ max
+ } = Math;
+ const maxVal = 255 * 255 * 3;
if (rgba1.a !== 0 && !rgba1.a) {
rgba1.a = 255;
}
-
if (rgba2.a !== 0 && !rgba2.a) {
rgba2.a = 255;
}
-
return (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) + max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) + max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) / maxVal;
};
+
/**
* Helper to create Jimp methods that emit events before and after its execution.
* @param {string} methodName The name to be appended to Jimp prototype.
@@ -1130,110 +896,92 @@ Jimp.colorDiff = function (rgba1, rgba2) {
* The emitted event comes with a object parameter to the listener with the
* `methodName` as one attribute.
*/
-
-
-function jimpEvMethod(methodName, evName, method) {
- var evNameBefore = 'before-' + evName;
- var evNameAfter = evName.replace(/e$/, '') + 'ed';
-
+export function jimpEvMethod(methodName, evName, method) {
+ const evNameBefore = "before-" + evName;
+ const evNameAfter = evName.replace(/e$/, "") + "ed";
Jimp.prototype[methodName] = function () {
- var wrappedCb;
-
+ let wrappedCb;
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
-
- var cb = args[method.length - 1];
- var jimpInstance = this;
-
- if (typeof cb === 'function') {
- wrappedCb = function wrappedCb() {
+ const cb = args[method.length - 1];
+ const jimpInstance = this;
+ if (typeof cb === "function") {
+ wrappedCb = function () {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
-
- var err = args[0],
- data = args[1];
-
+ const [err, data] = args;
if (err) {
jimpInstance.emitError(methodName, err);
} else {
- jimpInstance.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, data));
+ jimpInstance.emitMulti(methodName, evNameAfter, {
+ [methodName]: data
+ });
}
-
cb.apply(this, args);
};
-
args[args.length - 1] = wrappedCb;
} else {
wrappedCb = false;
}
-
this.emitMulti(methodName, evNameBefore);
- var result;
-
+ let result;
try {
result = method.apply(this, args);
-
if (!wrappedCb) {
- this.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, result));
+ this.emitMulti(methodName, evNameAfter, {
+ [methodName]: result
+ });
}
} catch (error) {
error.methodName = methodName;
this.emitError(methodName, error);
}
-
return result;
};
-
- Jimp.prototype[methodName + 'Quiet'] = method;
+ Jimp.prototype[methodName + "Quiet"] = method;
}
+
/**
* Creates a new image that is a clone of this one.
* @param {function(Error, Jimp)} cb (optional) A callback for when complete
* @returns the new image
*/
-
-
-jimpEvMethod('clone', 'clone', function (cb) {
- var clone = new Jimp(this);
-
- if ((0, _utils.isNodePattern)(cb)) {
+jimpEvMethod("clone", "clone", function (cb) {
+ const clone = new Jimp(this);
+ if (isNodePattern(cb)) {
cb.call(clone, null, clone);
}
-
return clone;
});
+
/**
* Simplify jimpEvMethod call for the common `change` evName.
* @param {string} methodName name of the method
* @param {function} method to watch changes for
*/
-
-function jimpEvChange(methodName, method) {
- jimpEvMethod(methodName, 'change', method);
+export function jimpEvChange(methodName, method) {
+ jimpEvMethod(methodName, "change", method);
}
+
/**
* Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)
* @param b A Boolean, true to use RGBA or false to use RGB
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-
-
-jimpEvChange('background', function (hex, cb) {
- if (typeof hex !== 'number') {
- return _utils.throwError.call(this, 'hex must be a hexadecimal rgba value', cb);
+jimpEvChange("background", function (hex, cb) {
+ if (typeof hex !== "number") {
+ return throwError.call(this, "hex must be a hexadecimal rgba value", cb);
}
-
this._background = hex;
-
- if ((0, _utils.isNodePattern)(cb)) {
+ if (isNodePattern(cb)) {
cb.call(this, null, this);
}
-
return this;
});
+
/**
* Scans through a region of the bitmap, calling a function for each pixel.
* @param {number} x the x coordinate to begin the scan at
@@ -1245,47 +993,35 @@ jimpEvChange('background', function (hex, cb) {
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-
-jimpEvChange('scan', function (x, y, w, h, f, cb) {
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers', cb);
+jimpEvChange("scan", function (x, y, w, h, f, cb) {
+ if (typeof x !== "number" || typeof y !== "number") {
+ return throwError.call(this, "x and y must be numbers", cb);
}
-
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers', cb);
+ if (typeof w !== "number" || typeof h !== "number") {
+ return throwError.call(this, "w and h must be numbers", cb);
}
-
- if (typeof f !== 'function') {
- return _utils.throwError.call(this, 'f must be a function', cb);
+ if (typeof f !== "function") {
+ return throwError.call(this, "f must be a function", cb);
}
-
- var result = (0, _utils.scan)(this, x, y, w, h, f);
-
- if ((0, _utils.isNodePattern)(cb)) {
+ const result = scan(this, x, y, w, h, f);
+ if (isNodePattern(cb)) {
cb.call(this, null, result);
}
-
return result;
});
-
-if (process.env.ENVIRONMENT === 'BROWSER') {
+if (process.env.ENVIRONMENT === "BROWSER") {
// For use in a web browser or web worker
-
/* global self */
- var gl;
-
- if (typeof window !== 'undefined' && (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) === 'object') {
+ let gl;
+ if (typeof window !== "undefined" && typeof window === "object") {
gl = window;
}
-
- if (typeof self !== 'undefined' && (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object') {
+ if (typeof self !== "undefined" && typeof self === "object") {
gl = self;
}
-
gl.Jimp = Jimp;
gl.Buffer = Buffer;
}
-
-var _default = Jimp;
-exports["default"] = _default;
+export { addType } from "./utils/mime";
+export default Jimp;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/index.js.map b/project starter code/node_modules/@jimp/core/es/index.js.map
index 8e69060a..cd3c35f6 100644
--- a/project starter code/node_modules/@jimp/core/es/index.js.map
+++ b/project starter code/node_modules/@jimp/core/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["alphabet","maxHashLength","NaN","i","maxHash","anyBase","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","err","response","data","headers","url","location","isBuffer","msg","statusCode","Error","loadBufferFromPath","src","fs","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","args","MIME_PNG","path","write","mime","getBase64","getBuffer","getBufferAsync","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","throwError","bitmap","writeUInt32BE","parseBitmap","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","bool","eventName","assign","emit","getMIME","MIME","getExtension","createWriteStream","getType","pathObj","Path","parse","dir","mkdirp","sync","stream","on","end","AUTO","base","hash","pHash","ImagePHash","getHash","compareHash","currentHash","distance","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","getPixelIndex","hex","readUInt32BE","yIndex","xIndex","alpha","EventEmitter","addConstants","constants","entries","forEach","name","value","addJimpMethods","methods","composite","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","pow","intToRGBA","rgba","floor","cssColor","Number","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","process","env","ENVIRONMENT","gl","window","self"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,QAAQ,GACZ,kEADF,C,CAGA;AACA;;AACA,IAAMC,aAAa,GAAG,CAACC,GAAD,EAAMA,GAAN,CAAtB;;AAEA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,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, throwError, scan, scanIterator } from '@jimp/utils';\nimport anyBase from 'any-base';\nimport mkdirp from 'mkdirp';\nimport pixelMatch from 'pixelmatch';\nimport tinyColor from 'tinycolor2';\n\nimport ImagePHash from './modules/phash';\nimport request from './request';\n\nimport composite from './composite';\nimport promisify from './utils/promisify';\nimport * as MIME from './utils/mime';\nimport { parseBitmap, getBuffer, getBufferAsync } from './utils/image-bitmap';\nimport * as constants from './constants';\n\nconst alphabet =\n '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_';\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(anyBase.BIN, alphabet.slice(0, i))(\n new Array(64 + 1).join('1')\n );\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString\n .call(test)\n .toLowerCase()\n .indexOf('arraybuffer') > -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, response, data) => {\n if (err) {\n return cb(err);\n }\n\n if ('headers' in response && 'location' in response.headers) {\n options.url = response.headers.location;\n return loadFromURL(options, cb);\n }\n\n if (typeof data === 'object' && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n const msg =\n 'Could not load Buffer from <' +\n options.url +\n '> ' +\n '(HTTP: ' +\n response.statusCode +\n ')';\n\n return new Error(msg);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === 'function' &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.width === 'number' &&\n typeof obj.height === 'number' &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === 'function' &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error('Buffer length is incorrect');\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = 'constructor';\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError('constructor', err);\n } else if (!err) {\n jimpInstance.emitMulti('constructor', 'initialized');\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === 'number' && typeof args[1] === 'number') ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === 'number') {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === 'string') {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === 'object' && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height\n };\n\n finish(null, this);\n } else if (typeof args[0] === 'string') {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === 'object' && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== 'function') {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== 'function') {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find(c =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) =>\n extraConstructor.run.call(this, resolve, reject, ...args)\n )\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n 'No matching constructor overloading was found. ' +\n 'Please see the docs for how to call the Jimp constructor.',\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== 'boolean') {\n return throwError.call(\n this,\n 'bool must be a boolean, true for RGBA or false for RGB',\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit('any', data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, 'error', err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n ''\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return '[object Jimp]';\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n 'Cant access the filesystem. You can use the getBase64 method.'\n );\n }\n\n if (typeof path !== 'string') {\n return throwError.call(this, 'path must be a string', cb);\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n mkdirp.sync(pathObj.dir);\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on('open', () => {\n stream.write(buffer);\n stream.end();\n })\n .on('error', err => {\n return throwError.call(this, err, cb);\n });\n stream.on('finish', () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = path => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n this.getBuffer(mime, function(err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = 'data:' + mime + ';base64,' + data.toString('base64');\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = mime => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === 'function') {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== 'number') {\n return throwError.call(this, 'base must be a number', cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n 'base must be a number between 2 and 64',\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = '0' + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n xi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== 'number' ||\n typeof x !== 'number' ||\n typeof y !== 'number'\n )\n return throwError.call(this, 'hex, x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n for (let yIndex = 0; yIndex < this.bitmap.height; yIndex++) {\n for (let xIndex = 0; xIndex < this.bitmap.width; xIndex++) {\n const idx = (this.bitmap.width * yIndex + xIndex) << 2;\n const alpha = this.bitmap.data[idx + 3];\n\n if (alpha !== 0xff) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers');\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers');\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function(name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function(...args) {\n return new Promise((resolve, reject) => {\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function(r, g, b, a, cb) {\n if (\n typeof r !== 'number' ||\n typeof g !== 'number' ||\n typeof b !== 'number' ||\n typeof a !== 'number'\n ) {\n return throwError.call(this, 'r, g, b and a must be numbers', cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, 'r must be between 0 and 255', cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, 'g must be between 0 and 255', cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, 'b must be between 0 and 255', cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, 'a must be between 0 and 255', cb);\n }\n\n r = Math.round(r);\n b = Math.round(b);\n g = Math.round(g);\n a = Math.round(a);\n\n const i =\n r * Math.pow(256, 3) +\n g * Math.pow(256, 2) +\n b * Math.pow(256, 1) +\n a * Math.pow(256, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function(i, cb) {\n if (typeof i !== 'number') {\n return throwError.call(this, 'i must be a number', cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function(cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === 'number') return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function(n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function(img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, 'img1 and img2 must be an Jimp images');\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) {\n return throwError.call(this, 'threshold must be a number between 0 and 1');\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function(img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function(hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function(rgba1, rgba2) {\n const pow = n => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = 'before-' + evName;\n const evNameAfter = evName.replace(/e$/, '') + 'ed';\n\n Jimp.prototype[methodName] = function(...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === 'function') {\n wrappedCb = function(...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + 'Quiet'] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod('clone', 'clone', function(cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, 'change', method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('background', function(hex, cb) {\n if (typeof hex !== 'number') {\n return throwError.call(this, 'hex must be a hexadecimal rgba value', cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('scan', function(x, y, w, h, f, cb) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof f !== 'function') {\n return throwError.call(this, 'f must be a function', cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === 'BROWSER') {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== 'undefined' && typeof window === 'object') {\n gl = window;\n }\n\n if (typeof self !== 'undefined' && typeof self === 'object') {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from './utils/mime';\n\nexport default Jimp;\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["fs","Path","EventEmitter","isNodePattern","throwError","scan","scanIterator","anyBase","pixelMatch","tinyColor","ImagePHash","request","composite","promisify","MIME","parseBitmap","getBuffer","getBufferAsync","constants","alphabet","maxHashLength","NaN","i","maxHash","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","err","data","isBuffer","Error","url","loadBufferFromPath","src","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","constructor","args","MIME_PNG","path","write","mime","getBase64","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","bitmap","writeUInt32BE","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","catch","rgba","bool","eventName","assign","emit","getHeight","getWidth","inspect","getMIME","getExtension","createWriteStream","getType","pathObj","parse","dir","mkdirSync","recursive","stream","on","end","AUTO","hash","base","pHash","getHash","distanceFromHash","compareHash","currentHash","distance","getPixelIndex","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","hex","readUInt32BE","hasAlpha","byteLen","addConstants","entries","forEach","name","value","addJimpMethods","methods","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","intToRGBA","floor","pow","cssColor","Number","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","process","env","ENVIRONMENT","gl","window","self","addType"],"sources":["../src/index.js"],"sourcesContent":["import fs from \"fs\";\nimport Path from \"path\";\nimport EventEmitter from \"events\";\n\nimport { isNodePattern, throwError, scan, scanIterator } from \"@jimp/utils\";\nimport anyBase from \"any-base\";\nimport pixelMatch from \"pixelmatch\";\nimport tinyColor from \"tinycolor2\";\n\nimport ImagePHash from \"./modules/phash\";\nimport request from \"./request\";\n\nimport composite from \"./composite\";\nimport promisify from \"./utils/promisify\";\nimport * as MIME from \"./utils/mime\";\nimport { parseBitmap, getBuffer, getBufferAsync } from \"./utils/image-bitmap\";\nimport * as constants from \"./constants\";\n\nconst alphabet =\n \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_\";\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(\n anyBase.BIN,\n alphabet.slice(0, i)\n )(new Array(64 + 1).join(\"1\"));\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString.call(test).toLowerCase().indexOf(\"arraybuffer\") >\n -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, data) => {\n if (err) {\n return cb(err);\n }\n\n if (typeof data === \"object\" && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n if (typeof data === \"object\" && isArrayBuffer(data)) {\n return cb(null, bufferFromArrayBuffer(data));\n }\n\n return new Error(`Could not load Buffer from <${options.url}>`);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === \"function\" &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === \"object\" &&\n typeof obj.width === \"number\" &&\n typeof obj.height === \"number\" &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === \"function\" &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error(\"Buffer length is incorrect\");\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null,\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = \"constructor\";\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError(\"constructor\", err);\n } else if (!err) {\n jimpInstance.emitMulti(\"constructor\", \"initialized\");\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === \"number\" && typeof args[1] === \"number\") ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === \"number\") {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === \"string\") {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h,\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === \"object\" && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height,\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height,\n };\n\n finish(null, this);\n } else if (typeof args[0] === \"string\") {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === \"object\" && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== \"function\") {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== \"function\") {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find((c) =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) => {\n extraConstructor.run.call(this, resolve, reject, ...args);\n })\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n \"No matching constructor overloading was found. \" +\n \"Please see the docs for how to call the Jimp constructor.\",\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== \"boolean\") {\n return throwError.call(\n this,\n \"bool must be a boolean, true for RGBA or false for RGB\",\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit(\"any\", data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, \"error\", err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n \"\"\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return \"[object Jimp]\";\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n \"Cant access the filesystem. You can use the getBase64 method.\"\n );\n }\n\n if (typeof path !== \"string\") {\n return throwError.call(this, \"path must be a string\", cb);\n }\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n fs.mkdirSync(pathObj.dir, { recursive: true });\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on(\"open\", () => {\n stream.write(buffer);\n stream.end();\n })\n .on(\"error\", (err) => {\n return throwError.call(this, err, cb);\n });\n stream.on(\"finish\", () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = (path) => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n this.getBuffer(mime, function (err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = \"data:\" + mime + \";base64,\" + data.toString(\"base64\");\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = (mime) => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === \"function\") {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== \"number\") {\n return throwError.call(this, \"base must be a number\", cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n \"base must be a number between 2 and 64\",\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = \"0\" + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n yi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\")\n return throwError.call(this, \"x and y must be numbers\", cb);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== \"number\" ||\n typeof x !== \"number\" ||\n typeof y !== \"number\"\n )\n return throwError.call(this, \"hex, x and y must be numbers\", cb);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n const {width, height, data} = this.bitmap;\n const byteLen = (width * height) << 2;\n\n for (let idx = 3; idx < byteLen; idx += 4) {\n if (data[idx] !== 0xff) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\");\n }\n\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\");\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function (name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function (...args) {\n return new Promise((resolve, reject) => {\n // eslint-disable-next-line no-new\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function (r, g, b, a, cb) {\n if (\n typeof r !== \"number\" ||\n typeof g !== \"number\" ||\n typeof b !== \"number\" ||\n typeof a !== \"number\"\n ) {\n return throwError.call(this, \"r, g, b and a must be numbers\", cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, \"r must be between 0 and 255\", cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, \"g must be between 0 and 255\", cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, \"b must be between 0 and 255\", cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, \"a must be between 0 and 255\", cb);\n }\n\n let i = (r & 0xff);\n i <<= 8;\n i |= (g & 0xff)\n i <<= 8;\n i |= (b & 0xff)\n i <<= 8;\n i |= (a & 0xff);\n\n // Ensure sign is correct\n i >>>= 0;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function (i, cb) {\n if (typeof i !== \"number\") {\n return throwError.call(this, \"i must be a number\", cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function (cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === \"number\") return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function (n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function (img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, \"img1 and img2 must be an Jimp images\");\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== \"number\" || threshold < 0 || threshold > 1) {\n return throwError.call(this, \"threshold must be a number between 0 and 1\");\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff,\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function (img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function (hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function (rgba1, rgba2) {\n const pow = (n) => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = \"before-\" + evName;\n const evNameAfter = evName.replace(/e$/, \"\") + \"ed\";\n\n Jimp.prototype[methodName] = function (...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === \"function\") {\n wrappedCb = function (...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data,\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result,\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + \"Quiet\"] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod(\"clone\", \"clone\", function (cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, \"change\", method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"background\", function (hex, cb) {\n if (typeof hex !== \"number\") {\n return throwError.call(this, \"hex must be a hexadecimal rgba value\", cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"scan\", function (x, y, w, h, f, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof f !== \"function\") {\n return throwError.call(this, \"f must be a function\", cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === \"BROWSER\") {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== \"undefined\" && typeof window === \"object\") {\n gl = window;\n }\n\n if (typeof self !== \"undefined\" && typeof self === \"object\") {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from \"./utils/mime\";\n\nexport default Jimp;\n"],"mappings":";;;AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,YAAY,MAAM,QAAQ;AAEjC,SAASC,aAAa,EAAEC,UAAU,EAAEC,IAAI,EAAEC,YAAY,QAAQ,aAAa;AAC3E,OAAOC,OAAO,MAAM,UAAU;AAC9B,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,UAAU,MAAM,iBAAiB;AACxC,OAAOC,OAAO,MAAM,WAAW;AAE/B,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAO,KAAKC,IAAI,MAAM,cAAc;AACpC,SAASC,WAAW,EAAEC,SAAS,EAAEC,cAAc,QAAQ,sBAAsB;AAC7E,OAAO,KAAKC,SAAS,MAAM,aAAa;AAExC,MAAMC,QAAQ,GACZ,kEAAkE;;AAEpE;AACA;AACA,MAAMC,aAAa,GAAG,CAACC,GAAG,EAAEA,GAAG,CAAC;AAEhC,KAAK,IAAIC,CAAC,GAAG,CA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AAI,CAAC,IAAI,EAAE0I,CAAC,EAAEC,CAAC,EAAEzD,CAAC,EAAEC,CAAC,EAAE6H,CAAC,CAAC;EAExC,IAAIlN,aAAa,CAAC8C,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACb,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE6K,MAAM,CAAC;EAC7B;EAEA,OAAOA,MAAM;AACf,CAAC,CAAC;AAEF,IAAIK,OAAO,CAACC,GAAG,CAACC,WAAW,KAAK,SAAS,EAAE;EACzC;EACA;EACA,IAAIC,EAAE;EAEN,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC/DD,EAAE,GAAGC,MAAM;EACb;EAEA,IAAI,OAAOC,IAAI,KAAK,WAAW,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC3DF,EAAE,GAAGE,IAAI;EACX;EAEAF,EAAE,CAACpJ,IAAI,GAAGA,IAAI;EACdoJ,EAAE,CAAC/K,MAAM,GAAGA,MAAM;AACpB;AAEA,SAASkL,OAAO,QAAQ,cAAc;AAEtC,eAAevJ,IAAI"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/modules/phash.js b/project starter code/node_modules/@jimp/core/es/modules/phash.js
index dac128a5..b404606e 100644
--- a/project starter code/node_modules/@jimp/core/es/modules/phash.js
+++ b/project starter code/node_modules/@jimp/core/es/modules/phash.js
@@ -1,5 +1,3 @@
-"use strict";
-
/*
Copyright (c) 2011 Elliot Shepherd
@@ -21,6 +19,7 @@ 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.
*/
+
// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java
/*
@@ -28,28 +27,25 @@ THE SOFTWARE.
* Author: Elliot Shepherd (elliot@jarofworms.com
* Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html
*/
+
function ImagePHash(size, smallerSize) {
this.size = this.size || size;
this.smallerSize = this.smallerSize || smallerSize;
initCoefficients(this.size);
}
-
ImagePHash.prototype.size = 32;
ImagePHash.prototype.smallerSize = 8;
-
ImagePHash.prototype.distance = function (s1, s2) {
- var counter = 0;
-
- for (var k = 0; k < s1.length; k++) {
+ let counter = 0;
+ for (let k = 0; k < s1.length; k++) {
if (s1[k] !== s2[k]) {
counter++;
}
}
-
return counter / s1.length;
-}; // Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.
-
+};
+// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.
ImagePHash.prototype.getHash = function (img) {
/* 1. Reduce size.
* Like Average Hash, pHash starts with a small image.
@@ -58,51 +54,46 @@ ImagePHash.prototype.getHash = function (img) {
* because it is needed to reduce the high frequencies.
*/
img = img.clone().resize(this.size, this.size);
+
/* 2. Reduce color.
* The image is reduced to a grayscale just to further simplify
* the number of computations.
*/
-
img.grayscale();
- var vals = [];
-
- for (var x = 0; x < img.bitmap.width; x++) {
+ const vals = [];
+ for (let x = 0; x < img.bitmap.width; x++) {
vals[x] = [];
-
- for (var y = 0; y < img.bitmap.height; y++) {
+ for (let y = 0; y < img.bitmap.height; y++) {
vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;
}
}
+
/* 3. Compute the DCT.
* The DCT separates the image into a collection of frequencies
* and scalars. While JPEG uses an 8x8 DCT, this algorithm uses
* a 32x32 DCT.
*/
+ const dctVals = applyDCT(vals, this.size);
-
- var dctVals = applyDCT(vals, this.size);
/* 4. Reduce the DCT.
* This is the magic step. While the DCT is 32x32, just keep the
* top-left 8x8. Those represent the lowest frequencies in the
* picture.
*/
-
/* 5. Compute the average value.
* Like the Average Hash, compute the mean DCT value (using only
* the 8x8 DCT low-frequency values and excluding the first term
* since the DC coefficient can be significantly different from
* the other values and will throw off the average).
*/
-
- var total = 0;
-
- for (var _x = 0; _x < this.smallerSize; _x++) {
- for (var _y = 0; _y < this.smallerSize; _y++) {
- total += dctVals[_x][_y];
+ let total = 0;
+ for (let x = 0; x < this.smallerSize; x++) {
+ for (let y = 0; y < this.smallerSize; y++) {
+ total += dctVals[x][y];
}
}
+ const avg = total / (this.smallerSize * this.smallerSize);
- var avg = total / (this.smallerSize * this.smallerSize);
/* 6. Further reduce the DCT.
* This is the magic step. Set the 64 hash bits to 0 or 1
* depending on whether each of the 64 DCT values is above or
@@ -113,61 +104,59 @@ ImagePHash.prototype.getHash = function (img) {
* remains the same; this can survive gamma and color histogram
* adjustments without a problem.
*/
-
- var hash = '';
-
- for (var _x2 = 0; _x2 < this.smallerSize; _x2++) {
- for (var _y2 = 0; _y2 < this.smallerSize; _y2++) {
- hash += dctVals[_x2][_y2] > avg ? '1' : '0';
+ let hash = "";
+ for (let x = 0; x < this.smallerSize; x++) {
+ for (let y = 0; y < this.smallerSize; y++) {
+ hash += dctVals[x][y] > avg ? "1" : "0";
}
}
-
return hash;
-}; // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java
+};
+// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java
+/**
+ Convert a 32-bit integer color value to an RGBA object.
+ */
function intToRGBA(i) {
- var rgba = {};
- rgba.r = Math.floor(i / Math.pow(256, 3));
- rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));
- rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1));
- rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0));
- return rgba;
+ const a = i & 0xff;
+ i >>>= 8;
+ const b = i & 0xff;
+ i >>>= 8;
+ const g = i & 0xff;
+ i >>>= 8;
+ const r = i & 0xff;
+ return {
+ r,
+ g,
+ b,
+ a
+ };
}
-
-var c = [];
-
+const c = [];
function initCoefficients(size) {
- for (var i = 1; i < size; i++) {
+ for (let i = 1; i < size; i++) {
c[i] = 1;
}
-
c[0] = 1 / Math.sqrt(2.0);
}
-
function applyDCT(f, size) {
- var N = size;
- var F = [];
-
- for (var u = 0; u < N; u++) {
+ const N = size;
+ const F = [];
+ for (let u = 0; u < N; u++) {
F[u] = [];
-
- for (var v = 0; v < N; v++) {
- var sum = 0;
-
- for (var i = 0; i < N; i++) {
- for (var j = 0; j < N; j++) {
+ for (let v = 0; v < N; v++) {
+ let sum = 0;
+ for (let i = 0; i < N; i++) {
+ for (let j = 0; j < N; j++) {
sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j];
}
}
-
sum *= c[u] * c[v] / 4;
F[u][v] = sum;
}
}
-
return F;
}
-
-module.exports = ImagePHash;
+export default ImagePHash;
//# sourceMappingURL=phash.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/modules/phash.js.map b/project starter code/node_modules/@jimp/core/es/modules/phash.js.map
index 5556e315..d3476d5f 100644
--- a/project starter code/node_modules/@jimp/core/es/modules/phash.js.map
+++ b/project starter code/node_modules/@jimp/core/es/modules/phash.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/modules/phash.js"],"names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","rgba","r","Math","floor","pow","g","a","c","sqrt","f","N","F","u","v","sum","j","cos","PI","module","exports"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBA;;AAEA;;;;;AAMA,SAASA,UAAT,CAAoBC,IAApB,EAA0BC,WAA1B,EAAuC;AACrC,OAAKD,IAAL,GAAY,KAAKA,IAAL,IAAaA,IAAzB;AACA,OAAKC,WAAL,GAAmB,KAAKA,WA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AAkBc,CAAlB,EAAqBvC,IAArB,EAA2B;AACzB,MAAMwC,CAAC,GAAGxC,IAAV;AACA,MAAMyC,CAAC,GAAG,EAAV;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,CAApB,EAAuBE,CAAC,EAAxB,EAA4B;AAC1BD,IAAAA,CAAC,CAACC,CAAD,CAAD,GAAO,EAAP;;AACA,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,CAApB,EAAuBG,CAAC,EAAxB,EAA4B;AAC1B,UAAIC,GAAG,GAAG,CAAV;;AACA,WAAK,IAAIf,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGW,CAApB,EAAuBX,CAAC,EAAxB,EAA4B;AAC1B,aAAK,IAAIgB,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,CAApB,EAAuBK,CAAC,EAAxB,EAA4B;AAC1BD,UAAAA,GAAG,IACDZ,IAAI,CAACc,GAAL,CAAU,CAAC,IAAIjB,CAAJ,GAAQ,CAAT,KAAe,MAAMW,CAArB,CAAD,GAA4BE,CAA5B,GAAgCV,IAAI,CAACe,EAA9C,IACAf,IAAI,CAACc,GAAL,CAAU,CAAC,IAAID,CAAJ,GAAQ,CAAT,KAAe,MAAML,CAArB,CAAD,GAA4BG,CAA5B,GAAgCX,IAAI,CAACe,EAA9C,CADA,GAEAR,CAAC,CAACV,CAAD,CAAD,CAAKgB,CAAL,CAHF;AAID;AACF;;AAEDD,MAAAA,GAAG,IAAKP,CAAC,CAACK,CAAD,CAAD,GAAOL,CAAC,CAACM,CAAD,CAAT,GAAgB,CAAvB;AACAF,MAAAA,CAAC,CAACC,CAAD,CAAD,CAAKC,CAAL,IAAUC,GAAV;AACD;AACF;;AAED,SAAOH,CAAP;AACD;;AAEDO,MAAM,CAACC,OAAP,GAAiBlD,UAAjB","sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function(s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function(img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = '';\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? '1' : '0';\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\nfunction intToRGBA(i) {\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n return rgba;\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n }\n }\n\n return F;\n}\n\nmodule.exports = ImagePHash;\n"],"file":"phash.js"}
\ No newline at end of file
+{"version":3,"file":"phash.js","names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","a","g","r","c","Math","sqrt","f","N","F","u","v","sum","j","cos","PI"],"sources":["../../src/modules/phash.js"],"sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function (s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function (img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = \"\";\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? \"1\" : \"0\";\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\n/**\n Convert a 32-bit integer color value to an RGBA object.\n */\nfunction intToRGBA(i) {\n const a = i & 0xff;\n i >>>= 8;\n const b = i & 0xff;\n i >>>= 8;\n const g = i & 0xff;\n i >>>= 8;\n const r = i & 0xff;\n\n return {r, g, b, a};\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n }\n }\n\n return F;\n}\n\nexport default ImagePHash;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,CAACC,IAAI,EAAEC,WAAW,EAAE;EACrC,IAAI,CAACD,IAAI,GAAG,IAAI,CAACA,IAAI,IAAIA,IAAI;EAC7B,IAAI,CAACC,WAAW,GAAG,IAAI,CAACA,WAAW,IAAIA,WAAW;EAClDC,gBAAgB,CAAC,IAAI,CAACF,IAAI,CAAC;AAC7B;AAEAD,UAAU,CAACI,SAAS,CAACH,IAAI,GAAG,EAAE;AAC9BD,UAAU,CAACI,SAAS,CAACF,WAAW,GAAG,CAAC;AAEpCF,UAAU,CAACI,SAAS,CAACC,QAAQ,GAAG,UAAUC,EAAE,EAAEC,EAAE,EAAE;EAChD,IAAIC,OAAO,GAAG,CAAC;EAEf,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,EAAE,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;IAClC,IAAIH,EAAE,CAACG,CAAC,CAAC,KAAKF,EAAE,CAACE,CAAC,CAAC,EAAE;MACnBD,OAAO,EAAE;IACX;EACF;EAEA,OAAOA,OAAO,GAAGF,EAAE,CAACI,MAAM;AAC5B,CAAC;;AAED;AACAV,UAAU,CAACI,SAAS,CAACO,OAAO,GAAG,UAAUC,GAAG,EAAE;EAC5C;AACF;AACA;AACA;AACA;AACA;EACEA,GAAG,GAAGA,GAAG,CAACC,KAAK,EAAE,CAACC,MAAM,CAAC,IAAI,CAACb,IAAI,EAAE,IAAI,CAACA,IAAI,CAAC;;EA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AEA,CAAC,GAAGH,CAAC,EAAEG,CAAC,EAAE,EAAE;MAC1B,IAAIC,GAAG,GAAG,CAAC;MACX,KAAK,IAAIZ,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGQ,CAAC,EAAER,CAAC,EAAE,EAAE;QAC1B,KAAK,IAAIa,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,CAAC,EAAEK,CAAC,EAAE,EAAE;UAC1BD,GAAG,IACDP,IAAI,CAACS,GAAG,CAAE,CAAC,CAAC,GAAGd,CAAC,GAAG,CAAC,KAAK,GAAG,GAAGQ,CAAC,CAAC,GAAIE,CAAC,GAAGL,IAAI,CAACU,EAAE,CAAC,GACjDV,IAAI,CAACS,GAAG,CAAE,CAAC,CAAC,GAAGD,CAAC,GAAG,CAAC,KAAK,GAAG,GAAGL,CAAC,CAAC,GAAIG,CAAC,GAAGN,IAAI,CAACU,EAAE,CAAC,GACjDR,CAAC,CAACP,CAAC,CAAC,CAACa,CAAC,CAAC;QACX;MACF;MAEAD,GAAG,IAAKR,CAAC,CAACM,CAAC,CAAC,GAAGN,CAAC,CAACO,CAAC,CAAC,GAAI,CAAC;MACxBF,CAAC,CAACC,CAAC,CAAC,CAACC,CAAC,CAAC,GAAGC,GAAG;IACf;EACF;EAEA,OAAOH,CAAC;AACV;AAEA,eAAevC,UAAU"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/request.js b/project starter code/node_modules/@jimp/core/es/request.js
index 4b211f73..566d0a7c 100644
--- a/project starter code/node_modules/@jimp/core/es/request.js
+++ b/project starter code/node_modules/@jimp/core/es/request.js
@@ -1,55 +1,16 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
-
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
-
-function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
-
-/* global XMLHttpRequest */
-if (process.browser || process.env.ENVIRONMENT === 'BROWSER' || typeof process.versions.electron !== 'undefined' && process.type === 'renderer' && typeof XMLHttpRequest === 'function') {
- // If we run into a browser or the electron renderer process,
- // use XHR method instead of Request node module.
- module.exports = function (options, cb) {
- var xhr = new XMLHttpRequest();
- xhr.open('GET', options.url, true);
- xhr.responseType = 'arraybuffer';
- xhr.addEventListener('load', function () {
- if (xhr.status < 400) {
- try {
- var data = Buffer.from(this.response);
- cb(null, xhr, data);
- } catch (error) {
- return cb(new Error('Response is not a buffer for url ' + options.url + '. Error: ' + error.message));
- }
- } else {
- cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url));
- }
- });
- xhr.addEventListener('error', function (e) {
- cb(e);
- });
- xhr.send();
- };
-} else {
- module.exports = function (_ref, cb) {
- var options = (0, _extends2["default"])({}, _ref);
-
- var p = require('phin');
-
- p(_objectSpread({
- compression: true
- }, options), function (err, res) {
- if (err === null) {
- cb(null, res, res.body);
- } else {
- cb(err);
- }
- });
- };
-}
+import "isomorphic-fetch";
+export default ((_ref, cb) => {
+ let {
+ url,
+ ...options
+ } = _ref;
+ fetch(url, options).then(response => {
+ if (response.ok) {
+ return response.arrayBuffer().catch(error => {
+ throw new Error(`Response is not a buffer for url ${url}. Error: ${error.message}`);
+ });
+ }
+ throw new Error(`HTTP Status ${response.status} for url ${url}`);
+ }).then(data => cb(null, data)).catch(error => cb(error));
+});
//# sourceMappingURL=request.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/request.js.map b/project starter code/node_modules/@jimp/core/es/request.js.map
index 04a1d461..5e709941 100644
--- a/project starter code/node_modules/@jimp/core/es/request.js.map
+++ b/project starter code/node_modules/@jimp/core/es/request.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/request.js"],"names":["process","browser","env","ENVIRONMENT","versions","electron","type","XMLHttpRequest","module","exports","options","cb","xhr","open","url","responseType","addEventListener","status","data","Buffer","from","response","error","Error","message","e","send","p","require","compression","err","res","body"],"mappings":";;;;;;;;;;;;AAAA;AAEA,IACEA,OAAO,CAACC,OAAR,IACAD,OAAO,CAACE,GAAR,CAAYC,WAAZ,KAA4B,SAD5B,IAEC,OAAOH,OAAO,CAACI,QAAR,CAAiBC,QAAxB,KAAqC,WAArC,IACCL,OAAO,CAACM,IAAR,KAAiB,UADlB,IAEC,OAAOC,cAAP,KAA0B,UAL9B,EAME;AACA;AACA;AAEAC,EAAAA,MAAM,CAACC,OAAP,GAAiB,UAASC,OAAT,EAAkBC,EAAlB,EAAsB;AACrC,QAAMC,GAAG,GAAG,IAAIL,cAAJ,EAAZ;AACAK,IAAAA,GAAG,CAACC,IAAJ,CAAS,KAAT,EAAgBH,OAAO,CAACI,GAAxB,EAA6B,IAA7B;AACAF,IAAAA,GAAG,CAACG,YAAJ,GAAmB,aAAnB;AACAH,IAAAA,GAAG,CAACI,gBAAJ,CAAqB,MAArB,EAA6B,YAAW;AACtC,UAAIJ,GAAG,CAACK,MAAJ,GAAa,GAAjB,EAAsB;AACpB,YAAI;AACF,cAAMC,IAAI,GAAGC,MAAM,CAACC,IAAP,CAAY,KAAKC,QAAjB,CAAb;AACAV,UAAAA,EAAE,CAAC,IAAD,EAAOC,GAAP,EAAYM,IAAZ,CAAF;AACD,SAHD,CAGE,OAAOI,KAAP,EAAc;AACd,iBAAOX,EAAE,CACP,IAAIY,KAAJ,CACE,sCACEb,OAAO,CAACI,GADV,GAEE,WAFF,GAGEQ,KAAK,CAACE,OAJV,CADO,CAAT;AAQD;AACF,OAdD,MAcO;AACLb,QAAAA,EAAE,CAAC,IAAIY,KAAJ,CAAU,iBAAiBX,GAAG,CAACK,MAArB,GAA8B,WAA9B,GAA4CP,OAAO,CAACI,GAA9D,CAAD,CAAF;AACD;AACF,KAlBD;AAmBAF,IAAAA,GAAG,CAACI,gBAAJ,CAAqB,OAArB,EAA8B,UAAAS,CAAC,EAAI;AACjCd,MAAAA,EAAE,CAACc,CAAD,CAAF;AACD,KAFD;AAGAb,IAAAA,GAAG,CAACc,IAAJ;AACD,GA3BD;AA4BD,CAtCD,MAsCO;AACLlB,EAAAA,MAAM,CAACC,OAAP,GAAiB,gBAAyBE,EAAzB,EAA6B;AAAA,QAAfD,OAAe;;AAC5C,QAAMiB,CAAC,GAAGC,OAAO,CAAC,MAAD,CAAjB;;AAEAD,IAAAA,CAAC;AAAGE,MAAAA,WAAW,EAAE;AAAhB,OAAyBnB,OAAzB,GAAoC,UAACoB,GAAD,EAAMC,GAAN,EAAc;AACjD,UAAID,GAAG,KAAK,IAAZ,EAAkB;AAChBnB,QAAAA,EAAE,CAAC,IAAD,EAAOoB,GAAP,EAAYA,GAAG,CAACC,IAAhB,CAAF;AACD,OAFD,MAEO;AACLrB,QAAAA,EAAE,CAACmB,GAAD,CAAF;AACD;AACF,KANA,CAAD;AAOD,GAVD;AAWD","sourcesContent":["/* global XMLHttpRequest */\n\nif (\n process.browser ||\n process.env.ENVIRONMENT === 'BROWSER' ||\n (typeof process.versions.electron !== 'undefined' &&\n process.type === 'renderer' &&\n typeof XMLHttpRequest === 'function')\n) {\n // If we run into a browser or the electron renderer process,\n // use XHR method instead of Request node module.\n\n module.exports = function(options, cb) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', options.url, true);\n xhr.responseType = 'arraybuffer';\n xhr.addEventListener('load', function() {\n if (xhr.status < 400) {\n try {\n const data = Buffer.from(this.response);\n cb(null, xhr, data);\n } catch (error) {\n return cb(\n new Error(\n 'Response is not a buffer for url ' +\n options.url +\n '. Error: ' +\n error.message\n )\n );\n }\n } else {\n cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url));\n }\n });\n xhr.addEventListener('error', e => {\n cb(e);\n });\n xhr.send();\n };\n} else {\n module.exports = function({ ...options }, cb) {\n const p = require('phin');\n\n p({ compression: true, ...options }, (err, res) => {\n if (err === null) {\n cb(null, res, res.body);\n } else {\n cb(err);\n }\n });\n };\n}\n"],"file":"request.js"}
\ No newline at end of file
+{"version":3,"file":"request.js","names":["cb","url","options","fetch","then","response","ok","arrayBuffer","catch","error","Error","message","status","data"],"sources":["../src/request.js"],"sourcesContent":["import \"isomorphic-fetch\";\n\nexport default ({ url, ...options }, cb) => {\n fetch(url, options)\n .then((response) => {\n if (response.ok) {\n return response.arrayBuffer().catch((error) => {\n throw new Error(\n `Response is not a buffer for url ${url}. Error: ${error.message}`\n );\n });\n }\n\n throw new Error(`HTTP Status ${response.status} for url ${url}`);\n })\n .then((data) => cb(null, data))\n .catch((error) => cb(error));\n};\n"],"mappings":"AAAA,OAAO,kBAAkB;AAEzB,gBAAe,OAAsBA,EAAE,KAAK;EAAA,IAA5B;IAAEC,GAAG;IAAE,GAAGC;EAAQ,CAAC;EACjCC,KAAK,CAACF,GAAG,EAAEC,OAAO,CAAC,CAChBE,IAAI,CAAEC,QAAQ,IAAK;IAClB,IAAIA,QAAQ,CAACC,EAAE,EAAE;MACf,OAAOD,QAAQ,CAACE,WAAW,EAAE,CAACC,KAAK,CAAEC,KAAK,IAAK;QAC7C,MAAM,IAAIC,KAAK,CACZ,oCAAmCT,GAAI,YAAWQ,KAAK,CAACE,OAAQ,EAAC,CACnE;MACH,CAAC,CAAC;IACJ;IAEA,MAAM,IAAID,KAAK,CAAE,eAAcL,QAAQ,CAACO,MAAO,YAAWX,GAAI,EAAC,CAAC;EAClE,CAAC,CAAC,CACDG,IAAI,CAAES,IAAI,IAAKb,EAAE,CAAC,IAAI,EAAEa,IAAI,CAAC,CAAC,CAC9BL,KAAK,CAAEC,KAAK,IAAKT,EAAE,CAACS,KAAK,CAAC,CAAC;AAChC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js b/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js
index 4beabbe0..1ae43bec 100644
--- a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js
+++ b/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js
@@ -1,46 +1,23 @@
-"use strict";
-
-var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.parseBitmap = parseBitmap;
-exports.getBuffer = getBuffer;
-exports.getBufferAsync = getBufferAsync;
-
-var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
-
-var _fileType = _interopRequireDefault(require("file-type"));
-
-var _exifParser = _interopRequireDefault(require("exif-parser"));
-
-var _utils = require("@jimp/utils");
-
-var constants = _interopRequireWildcard(require("../constants"));
-
-var MIME = _interopRequireWildcard(require("./mime"));
-
-var _promisify = _interopRequireDefault(require("./promisify"));
-
-function getMIMEFromBuffer(buffer, path) {
- var fileTypeFromBuffer = (0, _fileType["default"])(buffer);
-
+import FileType from "file-type";
+import EXIFParser from "exif-parser";
+import { throwError } from "@jimp/utils";
+import * as constants from "../constants";
+import * as MIME from "./mime";
+import promisify from "./promisify";
+async function getMIMEFromBuffer(buffer, path) {
+ const fileTypeFromBuffer = await FileType.fromBuffer(buffer);
if (fileTypeFromBuffer) {
// If fileType returns something for buffer, then return the mime given
return fileTypeFromBuffer.mime;
}
-
if (path) {
// If a path is supplied, and fileType yields no results, then retry with MIME
// Path can be either a file path or a url
return MIME.getType(path);
}
-
return null;
}
+
/*
* Obtains image orientation from EXIF metadata.
*
@@ -48,11 +25,10 @@ function getMIMEFromBuffer(buffer, path) {
* @returns {number} a number 1-8 representing EXIF orientation,
* in particular 1 if orientation tag is missing
*/
-
-
function getExifOrientation(img) {
return img._exif && img._exif.tags && img._exif.tags.Orientation || 1;
}
+
/**
* Returns a function which translates EXIF-rotated coordinates into
* non-rotated ones.
@@ -62,64 +38,54 @@ function getExifOrientation(img) {
* @param img {Jimp} a Jimp image object
* @returns {function} transformation function for transformBitmap().
*/
-
-
function getExifOrientationTransformation(img) {
- var w = img.getWidth();
- var h = img.getHeight();
-
+ const w = img.getWidth();
+ const h = img.getHeight();
switch (getExifOrientation(img)) {
case 1:
// Horizontal (normal)
// does not need to be supported here
return null;
-
case 2:
// Mirror horizontal
return function (x, y) {
return [w - x - 1, y];
};
-
case 3:
// Rotate 180
return function (x, y) {
return [w - x - 1, h - y - 1];
};
-
case 4:
// Mirror vertical
return function (x, y) {
return [x, h - y - 1];
};
-
case 5:
// Mirror horizontal and rotate 270 CW
return function (x, y) {
return [y, x];
};
-
case 6:
// Rotate 90 CW
return function (x, y) {
return [y, h - x - 1];
};
-
case 7:
// Mirror horizontal and rotate 90 CW
return function (x, y) {
return [w - y - 1, h - x - 1];
};
-
case 8:
// Rotate 270 CW
return function (x, y) {
return [w - y - 1, x];
};
-
default:
return null;
}
}
+
/*
* Transforms bitmap in place (moves pixels around) according to given
* transformation function.
@@ -134,111 +100,87 @@ function getExifOrientationTransformation(img) {
* the source bitmap, i.e. has following form:
* `function(new_x, new_y) { return [src_x, src_y] }`.
*/
-
-
function transformBitmap(img, width, height, transformation) {
// Underscore-prefixed values are related to the source bitmap
// Their counterparts with no prefix are related to the target bitmap
- var _data = img.bitmap.data;
- var _width = img.bitmap.width;
- var data = Buffer.alloc(_data.length);
-
- for (var x = 0; x < width; x++) {
- for (var y = 0; y < height; y++) {
- var _transformation = transformation(x, y),
- _transformation2 = (0, _slicedToArray2["default"])(_transformation, 2),
- _x = _transformation2[0],
- _y = _transformation2[1];
-
- var idx = width * y + x << 2;
-
- var _idx = _width * _y + _x << 2;
-
- var pixel = _data.readUInt32BE(_idx);
-
+ const _data = img.bitmap.data;
+ const _width = img.bitmap.width;
+ const data = Buffer.alloc(_data.length);
+ for (let x = 0; x < width; x++) {
+ for (let y = 0; y < height; y++) {
+ const [_x, _y] = transformation(x, y);
+ const idx = width * y + x << 2;
+ const _idx = _width * _y + _x << 2;
+ const pixel = _data.readUInt32BE(_idx);
data.writeUInt32BE(pixel, idx);
}
}
-
img.bitmap.data = data;
img.bitmap.width = width;
img.bitmap.height = height;
}
+
/*
* Automagically rotates an image based on its EXIF data (if present).
* @param img {Jimp} a Jimp image object
*/
-
-
function exifRotate(img) {
if (getExifOrientation(img) < 2) return;
- var transformation = getExifOrientationTransformation(img);
- var swapDimensions = getExifOrientation(img) > 4;
- var newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;
- var newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;
+ const transformation = getExifOrientationTransformation(img);
+ const swapDimensions = getExifOrientation(img) > 4;
+ const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;
+ const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;
transformBitmap(img, newWidth, newHeight, transformation);
-} // parses a bitmap from the constructor to the JIMP bitmap property
-
-
-function parseBitmap(data, path, cb) {
- var mime = getMIMEFromBuffer(data, path);
+}
- if (typeof mime !== 'string') {
- return cb(new Error('Could not find MIME for Buffer <' + path + '>'));
+// parses a bitmap from the constructor to the JIMP bitmap property
+export async function parseBitmap(data, path, cb) {
+ const mime = await getMIMEFromBuffer(data, path);
+ if (typeof mime !== "string") {
+ return cb(new Error("Could not find MIME for Buffer <" + path + ">"));
}
-
this._originalMime = mime.toLowerCase();
-
try {
- var _mime = this.getMIME();
-
- if (this.constructor.decoders[_mime]) {
- this.bitmap = this.constructor.decoders[_mime](data);
+ const mime = this.getMIME();
+ if (this.constructor.decoders[mime]) {
+ this.bitmap = this.constructor.decoders[mime](data);
} else {
- return _utils.throwError.call(this, 'Unsupported MIME type: ' + _mime, cb);
+ return throwError.call(this, "Unsupported MIME type: " + mime, cb);
}
} catch (error) {
return cb.call(this, error, this);
}
-
try {
- this._exif = _exifParser["default"].create(data).parse();
+ this._exif = EXIFParser.create(data).parse();
exifRotate(this); // EXIF data
} catch (error) {
/* meh */
}
-
cb.call(this, null, this);
return this;
}
-
function compositeBitmapOverBackground(Jimp, image) {
return new Jimp(image.bitmap.width, image.bitmap.height, image._background).composite(image, 0, 0).bitmap;
}
+
/**
* Converts the image to a buffer
- * @param {string} mime the mime type of the image buffer to be created
+ * @param {(string|number)} mime the mime type of the image buffer to be created
* @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument
* @returns {Jimp} this for chaining of methods
*/
-
-
-function getBuffer(mime, cb) {
+export function getBuffer(mime, cb) {
if (mime === constants.AUTO) {
// allow auto MIME detection
mime = this.getMIME();
}
-
- if (typeof mime !== 'string') {
- return _utils.throwError.call(this, 'mime must be a string', cb);
+ if (typeof mime !== "string") {
+ return throwError.call(this, "mime must be a string", cb);
}
-
- if (typeof cb !== 'function') {
- return _utils.throwError.call(this, 'cb must be a function', cb);
+ if (typeof cb !== "function") {
+ return throwError.call(this, "cb must be a function", cb);
}
-
mime = mime.toLowerCase();
-
if (this._rgba && this.constructor.hasAlpha[mime]) {
this.bitmap.data = Buffer.from(this.bitmap.data);
} else {
@@ -246,18 +188,23 @@ function getBuffer(mime, cb) {
// composite onto a new image so that the background shows through alpha channels
this.bitmap.data = compositeBitmapOverBackground(this.constructor, this).data;
}
-
if (this.constructor.encoders[mime]) {
- var buffer = this.constructor.encoders[mime](this);
- cb.call(this, null, buffer);
+ const buffer = this.constructor.encoders[mime](this);
+ // Typically, buffers return a string or map. However, the gif library "gifwrap" seemingly returns promises.
+ if (buffer instanceof Promise) {
+ // trigger the callback when the promise has been resolved
+ buffer.then(buff => {
+ cb.call(this, null, buff);
+ });
+ } else {
+ cb.call(this, null, buffer);
+ }
} else {
- cb.call(this, 'Unsupported MIME type: ' + mime);
+ return throwError.call(this, "Unsupported MIME type: " + mime, cb);
}
-
return this;
}
-
-function getBufferAsync(mime) {
- return (0, _promisify["default"])(getBuffer, this, mime);
+export function getBufferAsync(mime) {
+ return promisify(getBuffer, this, mime);
}
//# sourceMappingURL=image-bitmap.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map b/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map
index dc78d9d8..10277e5d 100644
--- a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map
+++ b/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/utils/image-bitmap.js"],"names":["getMIMEFromBuffer","buffer","path","fileTypeFromBuffer","mime","MIME","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","throwError","call","error","EXIFParser","create","parse","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","constants","AUTO","_rgba","hasAlpha","from","encoders","getBufferAsync"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAEA,SAASA,iBAAT,CAA2BC,MAA3B,EAAmCC,IAAnC,EAAyC;AACvC,MAAMC,kBAAkB,GAAG,0BAASF,MAAT,CAA3B;;AAEA,MAAIE,kBAAJ,EAAwB;AACtB;AACA,WAAOA,kBAAkB,CAACC,IAA1B;AACD;;AAED,MAAIF,IAAJ,EAAU;AACR;AACA;AACA,WAAOG,IAAI,CAACC,OAAL,CAAaJ,IAAb,CAAP;AACD;;AAED,SAAO,IAAP;AACD;AAED;;;;;;;;;AAOA,SAASK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AI,OAAOA,EAAP,KAAc,UAAlB,EAA8B;AAC5B,WAAOO,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,uBAAtB,EAA+CR,EAA/C,CAAP;AACD;;AAEDtC,EAAAA,IAAI,GAAGA,IAAI,CAACyC,WAAL,EAAP;;AAEA,MAAI,KAAKkB,KAAL,IAAc,KAAKhB,WAAL,CAAiBiB,QAAjB,CAA0B5D,IAA1B,CAAlB,EAAmD;AACjD,SAAKoB,MAAL,CAAYC,IAAZ,GAAmBE,MAAM,CAACsC,IAAP,CAAY,KAAKzC,MAAL,CAAYC,IAAxB,CAAnB;AACD,GAFD,MAEO;AACL;AACA;AACA,SAAKD,MAAL,CAAYC,IAAZ,GAAmB8B,6BAA6B,CAC9C,KAAKR,WADyC,EAE9C,IAF8C,CAA7B,CAGjBtB,IAHF;AAID;;AAED,MAAI,KAAKsB,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,CAAJ,EAAqC;AACnC,QAAMH,MAAM,GAAG,KAAK8C,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,EAAgC,IAAhC,CAAf;AACAsC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoBjD,MAApB;AACD,GAHD,MAGO;AACLyC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,4BAA4B9C,IAA1C;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAAS+D,cAAT,CAAwB/D,IAAxB,EAA8B;AACnC,SAAO,2BAAUwD,SAAV,EAAqB,IAArB,EAA2BxD,IAA3B,CAAP;AACD","sourcesContent":["import fileType from 'file-type';\n\nimport EXIFParser from 'exif-parser';\nimport { throwError } from '@jimp/utils';\n\nimport * as constants from '../constants';\nimport * as MIME from './mime';\nimport promisify from './promisify';\n\nfunction getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = fileType(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function(x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function(x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function(x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function(x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function(x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function(x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function(x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport function parseBitmap(data, path, cb) {\n const mime = getMIMEFromBuffer(data, path);\n\n if (typeof mime !== 'string') {\n return cb(new Error('Could not find MIME for Buffer <' + path + '>'));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, 'Unsupported MIME type: ' + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n cb.call(this, null, buffer);\n } else {\n cb.call(this, 'Unsupported MIME type: ' + mime);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"file":"image-bitmap.js"}
\ No newline at end of file
+{"version":3,"file":"image-bitmap.js","names":["FileType","EXIFParser","throwError","constants","MIME","promisify","getMIMEFromBuffer","buffer","path","fileTypeFromBuffer","fromBuffer","mime","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","call","error","create","parse","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","AUTO","_rgba","hasAlpha","from","encoders","Promise","then","buff","getBufferAsync"],"sources":["../../src/utils/image-bitmap.js"],"sourcesContent":["import FileType from \"file-type\";\n\nimport EXIFParser from \"exif-parser\";\nimport { throwError } from \"@jimp/utils\";\n\nimport * as constants from \"../constants\";\nimport * as MIME from \"./mime\";\nimport promisify from \"./promisify\";\n\nasync function getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = await FileType.fromBuffer(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function (x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function (x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function (x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function (x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function (x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function (x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function (x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport async function parseBitmap(data, path, cb) {\n const mime = await getMIMEFromBuffer(data, path);\n\n if (typeof mime !== \"string\") {\n return cb(new Error(\"Could not find MIME for Buffer <\" + path + \">\"));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {(string|number)} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n // Typically, buffers return a string or map. However, the gif library \"gifwrap\" seemingly returns promises.\n if (buffer instanceof Promise) {\n // trigger the callback when the promise has been resolved\n buffer.then((buff) => {\n cb.call(this, null, buff);\n });\n } else {\n cb.call(this, null, buffer);\n }\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,WAAW;AAEhC,OAAOC,UAAU,MAAM,aAAa;AACpC,SAASC,UAAU,QAAQ,aAAa;AAExC,OAAO,KAAKC,SAAS,MAAM,cAAc;AACzC,OAAO,KAAKC,IAAI,MAAM,QAAQ;AAC9B,OAAOC,SAAS,MAAM,aAAa;AAEnC,eAAeC,iBAAiB,CAACC,MAAM,EAAEC,IAAI,EAAE;EAC7C,MAAMC,kB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L,UAAU,CAACqD,IAAI,CAAC,IAAI,EAAE,yBAAyB,GAAG5C,IAAI,EAAEqC,EAAE,CAAC;EACpE;EAEA,OAAO,IAAI;AACb;AAEA,OAAO,SAASyB,cAAc,CAAC9D,IAAI,EAAE;EACnC,OAAON,SAAS,CAAC2D,SAAS,EAAE,IAAI,EAAErD,IAAI,CAAC;AACzC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/utils/mime.js b/project starter code/node_modules/@jimp/core/es/utils/mime.js
index 9e48085a..55e0c51e 100644
--- a/project starter code/node_modules/@jimp/core/es/utils/mime.js
+++ b/project starter code/node_modules/@jimp/core/es/utils/mime.js
@@ -1,47 +1,25 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.getExtension = exports.getType = exports.addType = void 0;
-var mimeTypes = {};
-
-var findType = function findType(extension) {
- return Object.entries(mimeTypes).find(function (type) {
- return type[1].includes(extension);
- }) || [];
-};
-
-var addType = function addType(mime, extensions) {
+const mimeTypes = {};
+const findType = extension => Object.entries(mimeTypes).find(type => type[1].includes(extension)) || [];
+export const addType = (mime, extensions) => {
mimeTypes[mime] = extensions;
};
+
/**
* Lookup a mime type based on extension
* @param {string} path path to find extension for
* @returns {string} mime found mime type
*/
-
-
-exports.addType = addType;
-
-var getType = function getType(path) {
- var pathParts = path.split('/').slice(-1);
- var extension = pathParts[pathParts.length - 1].split('.').pop();
- var type = findType(extension);
+export const getType = path => {
+ const pathParts = path.split("/").slice(-1);
+ const extension = pathParts[pathParts.length - 1].split(".").pop();
+ const type = findType(extension);
return type[0];
};
+
/**
* Return file extension associated with a mime type
* @param {string} type mime type to look up
* @returns {string} extension file extension
*/
-
-
-exports.getType = getType;
-
-var getExtension = function getExtension(type) {
- return (mimeTypes[type.toLowerCase()] || [])[0];
-};
-
-exports.getExtension = getExtension;
+export const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0];
//# sourceMappingURL=mime.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/utils/mime.js.map b/project starter code/node_modules/@jimp/core/es/utils/mime.js.map
index 5a3501b1..896500f2 100644
--- a/project starter code/node_modules/@jimp/core/es/utils/mime.js.map
+++ b/project starter code/node_modules/@jimp/core/es/utils/mime.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/utils/mime.js"],"names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"mappings":";;;;;;AAAA,IAAMA,SAAS,GAAG,EAAlB;;AAEA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAAAC,SAAS;AAAA,SACxBC,MAAM,CAACC,OAAP,CAAeJ,SAAf,EAA0BK,IAA1B,CAA+B,UAAAC,IAAI;AAAA,WAAIA,IAAI,CAAC,CAAD,CAAJ,CAAQC,QAAR,CAAiBL,SAAjB,CAAJ;AAAA,GAAnC,KAAuE,EAD/C;AAAA,CAA1B;;AAGO,IAAMM,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,UAAP,EAAsB;AAC3CV,EAAAA,SAAS,CAACS,IAAD,CAAT,GAAkBC,UAAlB;AACD,CAFM;AAIP;;;;;;;;;AAKO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAAC,IAAI,EAAI;AAC7B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAL,CAAW,GAAX,EAAgBC,KAAhB,CAAsB,CAAC,CAAvB,CAAlB;AACA,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAV,GAAmB,CAApB,CAAT,CAAgCF,KAAhC,CAAsC,GAAtC,EAA2CG,GAA3C,EAAlB;AACA,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAD,CAArB;AAEA,SAAOI,IAAI,CAAC,CAAD,CAAX;AACD,CANM;AAQP;;;;;;;;;AAKO,IAAMY,YAAY,GAAG,SAAfA,YAAe,CAAAZ,IAAI;AAAA,SAAI,CAACN,SAAS,CAACM,IAAI,CAACa,WAAL,EAAD,CAAT,IAAiC,EAAlC,EAAsC,CAAtC,CAAJ;AAAA,CAAzB","sourcesContent":["const mimeTypes = {};\n\nconst findType = extension =>\n Object.entries(mimeTypes).find(type => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = path => {\n const pathParts = path.split('/').slice(-1);\n const extension = pathParts[pathParts.length - 1].split('.').pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"file":"mime.js"}
\ No newline at end of file
+{"version":3,"file":"mime.js","names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"sources":["../../src/utils/mime.js"],"sourcesContent":["const mimeTypes = {};\n\nconst findType = (extension) =>\n Object.entries(mimeTypes).find((type) => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = (path) => {\n const pathParts = path.split(\"/\").slice(-1);\n const extension = pathParts[pathParts.length - 1].split(\".\").pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = (type) => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"mappings":"AAAA,MAAMA,SAAS,GAAG,CAAC,CAAC;AAEpB,MAAMC,QAAQ,GAAIC,SAAS,IACzBC,MAAM,CAACC,OAAO,CAACJ,SAAS,CAAC,CAACK,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAAC,CAAC,CAAC,CAACC,QAAQ,CAACL,SAAS,CAAC,CAAC,IAAI,EAAE;AAE7E,OAAO,MAAMM,OAAO,GAAG,CAACC,IAAI,EAAEC,UAAU,KAAK;EAC3CV,SAAS,CAACS,IAAI,CAAC,GAAGC,UAAU;AAC9B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAIC,IAAI,IAAK;EAC/B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;EAC3C,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAM,GAAG,CAAC,CAAC,CAACF,KAAK,CAAC,GAAG,CAAC,CAACG,GAAG,EAAE;EAClE,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAS,CAAC;EAEhC,OAAOI,IAAI,CAAC,CAAC,CAAC;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMY,YAAY,GAAIZ,IAAI,IAAK,CAACN,SAAS,CAACM,IAAI,CAACa,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/utils/promisify.js b/project starter code/node_modules/@jimp/core/es/utils/promisify.js
index a307532d..c40350de 100644
--- a/project starter code/node_modules/@jimp/core/es/utils/promisify.js
+++ b/project starter code/node_modules/@jimp/core/es/utils/promisify.js
@@ -1,27 +1,16 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var promisify = function promisify(fun, ctx) {
+const promisify = function (fun, ctx) {
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
-
- return new Promise(function (resolve, reject) {
- args.push(function (err, data) {
+ return new Promise((resolve, reject) => {
+ args.push((err, data) => {
if (err) {
reject(err);
}
-
resolve(data);
});
- fun.bind(ctx).apply(void 0, args);
+ fun.bind(ctx)(...args);
});
};
-
-var _default = promisify;
-exports["default"] = _default;
+export default promisify;
//# sourceMappingURL=promisify.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map b/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map
index c72c0c48..9b619756 100644
--- a/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map
+++ b/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/utils/promisify.js"],"names":["promisify","fun","ctx","args","Promise","resolve","reject","push","err","data","bind"],"mappings":";;;;;;;AAAA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,GAAD,EAAMC,GAAN;AAAA,oCAAcC,IAAd;AAAcA,IAAAA,IAAd;AAAA;;AAAA,SAChB,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAUC,MAAV,EAAqB;AAC/BH,IAAAA,IAAI,CAACI,IAAL,CAAU,UAACC,GAAD,EAAMC,IAAN,EAAe;AACvB,UAAID,GAAJ,EAAS;AACPF,QAAAA,MAAM,CAACE,GAAD,CAAN;AACD;;AAEDH,MAAAA,OAAO,CAACI,IAAD,CAAP;AACD,KAND;AAOAR,IAAAA,GAAG,CAACS,IAAJ,CAASR,GAAT,gBAAiBC,IAAjB;AACD,GATD,CADgB;AAAA,CAAlB;;eAYeH,S","sourcesContent":["const promisify = (fun, ctx, ...args) =>\n new Promise((resolve, reject) => {\n args.push((err, data) => {\n if (err) {\n reject(err);\n }\n\n resolve(data);\n });\n fun.bind(ctx)(...args);\n });\n\nexport default promisify;\n"],"file":"promisify.js"}
\ No newline at end of file
+{"version":3,"file":"promisify.js","names":["promisify","fun","ctx","args","Promise","resolve","reject","push","err","data","bind"],"sources":["../../src/utils/promisify.js"],"sourcesContent":["const promisify = (fun, ctx, ...args) =>\n new Promise((resolve, reject) => {\n args.push((err, data) => {\n if (err) {\n reject(err);\n }\n\n resolve(data);\n });\n fun.bind(ctx)(...args);\n });\n\nexport default promisify;\n"],"mappings":"AAAA,MAAMA,SAAS,GAAG,UAACC,GAAG,EAAEC,GAAG;EAAA,kCAAKC,IAAI;IAAJA,IAAI;EAAA;EAAA,OAClC,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IAC/BH,IAAI,CAACI,IAAI,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAK;MACvB,IAAID,GAAG,EAAE;QACPF,MAAM,CAACE,GAAG,CAAC;MACb;MAEAH,OAAO,CAACI,IAAI,CAAC;IACf,CAAC,CAAC;IACFR,GAAG,CAACS,IAAI,CAACR,GAAG,CAAC,CAAC,GAAGC,IAAI,CAAC;EACxB,CAAC,CAAC;AAAA;AAEJ,eAAeH,SAAS"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/core/package.json b/project starter code/node_modules/@jimp/core/package.json
index ab28529b..7558b3eb 100644
--- a/project starter code/node_modules/@jimp/core/package.json
+++ b/project starter code/node_modules/@jimp/core/package.json
@@ -1,10 +1,11 @@
{
"name": "@jimp/core",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Jimp core",
"main": "dist/index.js",
"module": "es/index.js",
"types": "types/index.d.ts",
+ "sideEffects": false,
"files": [
"dist",
"es",
@@ -12,15 +13,9 @@
"fonts",
"types"
],
- "repository": {
- "type": "git",
- "url": "https://github.com/oliver-moran/jimp.git"
- },
- "bugs": {
- "url": "https://github.com/oliver-moran/jimp/issues"
- },
+ "repository": "jimp-dev/jimp",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register test/**/*.js",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -34,24 +29,17 @@
"author": "Oliver Moran ",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
+ "@jimp/utils": "^0.22.12",
"any-base": "^1.1.0",
"buffer": "^5.2.0",
"exif-parser": "^0.1.12",
- "file-type": "^9.0.0",
- "load-bmfont": "^1.3.1",
- "mkdirp": "^0.5.1",
- "phin": "^2.9.1",
+ "file-type": "^16.5.4",
+ "isomorphic-fetch": "^3.0.0",
"pixelmatch": "^4.0.2",
- "tinycolor2": "^1.4.1"
- },
- "devDependencies": {
- "should": "^13.2.3"
+ "tinycolor2": "^1.6.0"
},
- "xo": false,
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/core/types/etc.d.ts b/project starter code/node_modules/@jimp/core/types/etc.d.ts
index e5f16b56..e13192e6 100644
--- a/project starter code/node_modules/@jimp/core/types/etc.d.ts
+++ b/project starter code/node_modules/@jimp/core/types/etc.d.ts
@@ -1,4 +1,4 @@
-import {Jimp} from '@jimp/core/types/jimp';
+import { Jimp } from "./jimp";
export interface Image {
bitmap: Bitmap;
@@ -35,33 +35,35 @@ type BlendMode = {
opacityDest: number;
};
-type ChangeName = 'background' | 'scan' | 'crop';
+type ChangeName = "background" | "scan" | "crop";
type ListenableName =
- | 'any'
- | 'initialized'
- | 'before-change'
- | 'changed'
- | 'before-clone'
- | 'cloned'
+ | "any"
+ | "initialized"
+ | "before-change"
+ | "changed"
+ | "before-clone"
+ | "cloned"
| ChangeName;
-type ListenerData = T extends 'any'
+type ListenerData = T extends "any"
? any
: T extends ChangeName
- ? {
- eventName: 'before-change' | 'changed';
- methodName: T;
- [key: string]: any;
- }
- : {
- eventName: T;
- methodName: T extends 'initialized'
- ? 'constructor'
- : T extends 'before-change' | 'changed'
- ? ChangeName
- : T extends 'before-clone' | 'cloned' ? 'clone' : any;
- };
+ ? {
+ eventName: "before-change" | "changed";
+ methodName: T;
+ [key: string]: any;
+ }
+ : {
+ eventName: T;
+ methodName: T extends "initialized"
+ ? "constructor"
+ : T extends "before-change" | "changed"
+ ? ChangeName
+ : T extends "before-clone" | "cloned"
+ ? "clone"
+ : any;
+ };
type URLOptions = {
url: string;
diff --git a/project starter code/node_modules/@jimp/core/types/functions.d.ts b/project starter code/node_modules/@jimp/core/types/functions.d.ts
index d7366054..de74902e 100644
--- a/project starter code/node_modules/@jimp/core/types/functions.d.ts
+++ b/project starter code/node_modules/@jimp/core/types/functions.d.ts
@@ -1,4 +1,4 @@
-import {Jimp} from '@jimp/core/types/jimp';
+import { Jimp } from "./jimp";
export function addConstants(
constants: [string, string | number],
diff --git a/project starter code/node_modules/@jimp/core/types/index.d.ts b/project starter code/node_modules/@jimp/core/types/index.d.ts
index 83042628..88bd53a7 100644
--- a/project starter code/node_modules/@jimp/core/types/index.d.ts
+++ b/project starter code/node_modules/@jimp/core/types/index.d.ts
@@ -1,8 +1,8 @@
-export * from '@jimp/core/types/etc';
-export * from '@jimp/core/types/functions';
-export * from '@jimp/core/types/plugins';
-export * from '@jimp/core/types/utils';
-import {Jimp, JimpConstructors} from '@jimp/core/types/jimp';
+export * from "./etc";
+export * from "./functions";
+export * from "./plugins";
+export * from "./utils";
+import { Jimp, JimpConstructors } from "./jimp";
export { Jimp, JimpConstructors };
declare const defaultExp: Jimp;
diff --git a/project starter code/node_modules/@jimp/core/types/jimp.d.ts b/project starter code/node_modules/@jimp/core/types/jimp.d.ts
index a01331c9..3c3509ea 100644
--- a/project starter code/node_modules/@jimp/core/types/jimp.d.ts
+++ b/project starter code/node_modules/@jimp/core/types/jimp.d.ts
@@ -7,8 +7,8 @@ import {
GenericCallback,
BlendMode,
RGBA,
- RGB
-} from '@jimp/core/types/etc';
+ RGB,
+} from "./etc";
interface DiffReturn {
percent: number;
@@ -51,20 +51,27 @@ export interface JimpConstructors {
EDGE_CROP: 3;
// Constructors
- new(path: string, cb?: ImageCallback): this['prototype'];
- new(urlOptions: URLOptions, cb?: ImageCallback): this['prototype'];
- new(image: Jimp, cb?: ImageCallback): this['prototype'];
- new(data: Buffer, cb?: ImageCallback): this['prototype'];
- new(data: Bitmap, cb?: ImageCallback): this['prototype'];
- new(w: number, h: number, cb?: ImageCallback): this['prototype'];
- new(
+ new (path: string, cb?: ImageCallback): this["prototype"];
+ new (
+ urlOptions: URLOptions,
+ cb?: ImageCallback
+ ): this["prototype"];
+ new (image: Jimp, cb?: ImageCallback): this["prototype"];
+ new (data: Buffer, cb?: ImageCallback): this["prototype"];
+ new (data: Bitmap, cb?: ImageCallback): this["prototype"];
+ new (
+ w: number,
+ h: number,
+ cb?: ImageCallback
+ ): this["prototype"];
+ new (
w: number,
h: number,
background?: number | string,
- cb?: ImageCallback
- ): this['prototype'];
+ cb?: ImageCallback
+ ): this["prototype"];
// For custom constructors when using Jimp.appendConstructorOption
- new(...args: any[]): this['prototype'];
+ new (...args: any[]): this["prototype"];
// Functions
/**
@@ -72,7 +79,10 @@ export interface JimpConstructors {
* it's not possible RN:
* https://github.com/microsoft/TypeScript/issues/26113
*/
- appendConstructorOption(
+ appendConstructorOption<
+ Args extends any[],
+ J extends Jimp = this["prototype"]
+ >(
name: string,
test: (...args: any[]) => boolean,
run: (
@@ -82,30 +92,47 @@ export interface JimpConstructors {
...args: any[]
) => any
): void;
- read(path: string, cb?: ImageCallback): Promise;
- read(image: Jimp, cb?: ImageCallback): Promise;
- read(data: Buffer, cb?: ImageCallback): Promise;
+ read(
+ path: string,
+ cb?: ImageCallback
+ ): Promise;
+ read(
+ image: Jimp,
+ cb?: ImageCallback
+ ): Promise;
+ read(
+ data: Buffer,
+ cb?: ImageCallback
+ ): Promise;
read(
w: number,
h: number,
background?: number | string,
- cb?: ImageCallback
- ): Promise;
- create(path: string): Promise;
- create(image: Jimp): Promise;
- create(data: Buffer): Promise;
- create(w: number, h: number, background?: number | string): Promise;
+ cb?: ImageCallback
+ ): Promise;
+ create(path: string): Promise;
+ create(image: Jimp): Promise;
+ create(data: Buffer): Promise;
+ create(
+ w: number,
+ h: number,
+ background?: number | string
+ ): Promise;
rgbaToInt(
r: number,
g: number,
b: number,
a: number,
- cb?: GenericCallback
+ cb?: GenericCallback
): number;
intToRGBA(i: number, cb?: GenericCallback): RGBA;
cssColorToHex(cssColor: string): number;
limit255(n: number): number;
- diff(img1: Jimp, img2: Jimp, threshold?: number): DiffReturn;
+ diff(
+ img1: Jimp,
+ img2: Jimp,
+ threshold?: number
+ ): DiffReturn;
distance(img1: Jimp, img2: Jimp): number;
compareHashes(hash1: string, hash2: string): number;
colorDiff(rgba1: RGB, rgba2: RGB): number;
@@ -139,8 +166,9 @@ export interface Jimp {
write(path: string, cb?: ImageCallback): this;
writeAsync(path: string): Promise;
rgba(bool: boolean, cb?: ImageCallback): this;
- getBase64(mime: string, cb: GenericCallback): this;
- getBase64Async(mime: string): Promise;
+ getBase64(mime: string | JimpConstructors["AUTO"], cb: GenericCallback): this;
+ pHash: () => string;
+ getBase64Async(mime: string | JimpConstructors["AUTO"]): Promise;
hash(cb?: GenericCallback): string;
hash(
base: number | null | undefined,
@@ -156,7 +184,7 @@ export interface Jimp {
getPixelIndex(
x: number,
y: number,
- edgeHandling: string,
+ edgeHandling: number,
cb?: GenericCallback
): number;
getPixelColor(
diff --git a/project starter code/node_modules/@jimp/core/types/plugins.d.ts b/project starter code/node_modules/@jimp/core/types/plugins.d.ts
index 26fe4dcd..62bf2ea9 100644
--- a/project starter code/node_modules/@jimp/core/types/plugins.d.ts
+++ b/project starter code/node_modules/@jimp/core/types/plugins.d.ts
@@ -1,23 +1,17 @@
/**
* These files pertain to the typings of plugins or types
- *
+ *
* They're not meant as utils to decode types, but rather
* the type definitons themsleves for plugins and types of various kinds
*/
-import {
- Image,
- EncoderFn,
- DecoderFn
-} from '@jimp/core/types/etc';
+import { Image, EncoderFn, DecoderFn } from "./etc";
-import {
- Omit
-} from '@jimp/core/types/utils';
+import { Omit } from "./utils";
-export type IllformedPlugin = Omit & {
+export type IllformedPlugin = Omit & {
class?: never;
constants?: never;
-}
+};
export interface WellFormedPlugin {
mime?: {
@@ -43,13 +37,13 @@ export interface WellFormedPlugin {
type ClassOrConstantPlugin = WellFormedPlugin &
(
- | Required, 'class'>>
- | Required, 'constants'>>
+ | Required, "class">>
+ | Required, "constants">>
);
// A Jimp type requires mime, but not class
export type JimpType = WellFormedPlugin &
- Required, 'mime'>>;
+ Required, "mime">>;
// Jimp plugin either MUST have class OR constant or be illformed
export type JimpPlugin =
diff --git a/project starter code/node_modules/@jimp/core/types/utils.d.ts b/project starter code/node_modules/@jimp/core/types/utils.d.ts
index afde123a..463321b9 100644
--- a/project starter code/node_modules/@jimp/core/types/utils.d.ts
+++ b/project starter code/node_modules/@jimp/core/types/utils.d.ts
@@ -1,26 +1,30 @@
-import {
- JimpType,
- JimpPlugin,
-} from '@jimp/core/types/plugins';
+import { JimpType, JimpPlugin } from "./plugins";
// This is required as providing type arrays gives a union of all the generic
// types in the array rather than an intersection
-export type UnionToIntersection =
- (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
+export type UnionToIntersection = (
+ U extends any ? (k: U) => void : never
+) extends (k: infer I) => void
+ ? I
+ : never;
/**
* The values to be extracted from a WellFormedPlugin to put onto the Jimp instance
* Left loose as "any" in order to enable the GetPluginVal to work properly
*/
-export type WellFormedValues =
- (T extends {class: infer Class} ? Class : {});
+export type WellFormedValues = T extends { class: infer Class }
+ ? Class
+ : {};
/**
* The constants to be extracted from a WellFormedPlugin to put onto the Jimp instance
* Left loose as "any" in order to enable the GetPluginConstants to work properly
*/
-export type WellFormedConstants =
- (T extends {constants: infer Constants} ? Constants : {});
+export type WellFormedConstants = T extends {
+ constants: infer Constants;
+}
+ ? Constants
+ : {};
// Util type for the functions that deal with `@jimp/custom`
// Must accept any or no props thanks to typing of the `plugins` intersected function
@@ -32,27 +36,43 @@ export type FunctionRet = Array<(...props: any[] | never) => T>;
* up `undefined`. Because we're always extending `IllformedPlugin` on the
* plugins, this should work fine
*/
-export type GetPluginVal = Q extends Required<{class: any}> | Required<{constants: any}>
+export type GetPluginVal = Q extends
+ | Required<{ class: any }>
+ | Required<{ constants: any }>
? WellFormedValues
: Q;
-export type GetPluginConst = Q extends Required<{class: any}> | Required<{constants: any}>
+export type GetPluginConst = Q extends
+ | Required<{ class: any }>
+ | Required<{ constants: any }>
? WellFormedConstants
: {};
-export type GetPluginDecoders = Q extends Required<{class: any}> | Required<{constants: any}>
- ? Q extends {decoders: infer Decoders} ? Decoders : {} : {};
+export type GetPluginDecoders = Q extends
+ | Required<{ class: any }>
+ | Required<{ constants: any }>
+ ? Q extends { decoders: infer Decoders }
+ ? Decoders
+ : {}
+ : {};
-export type GetPluginEncoders = Q extends Required<{class: any}> | Required<{constants: any}>
- ? Q extends {encoders: infer Encoders} ? Encoders : {} : {};
+export type GetPluginEncoders = Q extends
+ | Required<{ class: any }>
+ | Required<{ constants: any }>
+ ? Q extends { encoders: infer Encoders }
+ ? Encoders
+ : {}
+ : {};
type GetPluginFuncArrValues =
// Given an array of types infer `Q` (Q should be the type value)
- PluginFuncArr extends ReadonlyArray ? F extends () => infer Q
- ? // Get the plugin value, may be ill-formed or well-formed
- GetPluginVal
- : // This should never be reached
- undefined : undefined;
+ PluginFuncArr extends ReadonlyArray
+ ? F extends () => infer Q
+ ? // Get the plugin value, may be ill-formed or well-formed
+ GetPluginVal
+ : // This should never be reached
+ undefined
+ : undefined;
/**
* A helper type to get the values to be intersected with `Jimp` to give
@@ -60,31 +80,39 @@ type GetPluginFuncArrValues =
*/
export type GetIntersectionFromPlugins<
PluginFuncArr extends FunctionRet
-> = UnionToIntersection, undefined>>;
+> = UnionToIntersection<
+ Exclude, undefined>
+>;
type GetPluginFuncArrConsts =
// Given an array of types infer `Q` (Q should be the type value)
- PluginFuncArr extends ReadonlyArray ? F extends () => infer Q
- ? // Get the plugin constants, may be ill-formed or well-formed
- GetPluginConst
- : // This should never be reached
- undefined : undefined;
+ PluginFuncArr extends ReadonlyArray
+ ? F extends () => infer Q
+ ? // Get the plugin constants, may be ill-formed or well-formed
+ GetPluginConst
+ : // This should never be reached
+ undefined
+ : undefined;
type GetPluginFuncArrEncoders =
// Given an array of types infer `Q` (Q should be the type value)
- PluginFuncArr extends ReadonlyArray ? F extends () => infer Q
- ? // Get the plugin encoders, may be ill-formed or well-formed
- GetPluginEncoders
- : // This should never be reached
- undefined : undefined;
+ PluginFuncArr extends ReadonlyArray
+ ? F extends () => infer Q
+ ? // Get the plugin encoders, may be ill-formed or well-formed
+ GetPluginEncoders
+ : // This should never be reached
+ undefined
+ : undefined;
type GetPluginFuncArrDecoders =
// Given an array of types infer `Q` (Q should be the type value)
- PluginFuncArr extends ReadonlyArray ? F extends () => infer Q
- ? // Get the plugin decoders, may be ill-formed or well-formed
- GetPluginDecoders
- : // This should never be reached
- undefined : undefined;
+ PluginFuncArr extends ReadonlyArray
+ ? F extends () => infer Q
+ ? // Get the plugin decoders, may be ill-formed or well-formed
+ GetPluginDecoders
+ : // This should never be reached
+ undefined
+ : undefined;
/**
* A helper type to get the statics to be intersected with `Jimp` to give
diff --git a/project starter code/node_modules/@jimp/custom/CHANGELOG.md b/project starter code/node_modules/@jimp/custom/CHANGELOG.md
index 9997674c..5f415137 100644
--- a/project starter code/node_modules/@jimp/custom/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/custom/CHANGELOG.md
@@ -1,3 +1,87 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.18.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### switch from browserify to webpack ([#1140](https://github.com/jimp-dev/jimp/pull/1140))
+
+This PR can be considered a breaking change as it remove the `jimp.min.js` file.
+
+Instead there is now only the `jimp.js` file and we ship source maps for it.
+
+We also configured the `browser` field so jimp will be automatically bundled better
+
+---
+
+#### 💥 Breaking Change
+
+- switch from browserify to webpack [#1140](https://github.com/jimp-dev/jimp/pull/1140) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -36,7 +120,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -44,4 +128,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/custom/README.md b/project starter code/node_modules/@jimp/custom/README.md
index e7892bb6..961d7333 100644
--- a/project starter code/node_modules/@jimp/custom/README.md
+++ b/project starter code/node_modules/@jimp/custom/README.md
@@ -10,15 +10,15 @@
The following wil configure a `jimp` instance with the same functionality as the main `jimp` package.
```js
-import configure from '@jimp/custom';
+import configure from "@jimp/custom";
// all of jimp's default types
-import types from '@jimp/types';
+import types from "@jimp/types";
// all of jimp's default types
-import plugins from '@jimp/plugins';
+import plugins from "@jimp/plugins";
configure({
types: [types],
- plugins: [plugins]
+ plugins: [plugins],
});
```
@@ -54,12 +54,12 @@ You can use configure to add more types and plugins to a jimp multiple times.
```js
let jimp = configure({
- types: [bmp]
+ types: [bmp],
});
jimp = configure(
{
- types: [jpeg]
+ types: [jpeg],
},
jimp
);
@@ -167,7 +167,7 @@ Defining a plugin has access to all the same things in the type definition. Main
Below is the `invert` plugin. If a plugin doesn return an object with `constants` and `class`, all keys are treated as class functions.
```js
-import { isNodePattern } from '@jimp/utils';
+import { isNodePattern } from "@jimp/utils";
/**
* Inverts the image
@@ -176,21 +176,23 @@ import { isNodePattern } from '@jimp/utils';
*/
export default () => ({
invert(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- this.bitmap.data[idx] = 255 - this.bitmap.data[idx];
- this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];
- this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];
- });
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ this.bitmap.data[idx] = 255 - this.bitmap.data[idx];
+ this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];
+ this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
}
return this;
- }
+ },
});
```
diff --git a/project starter code/node_modules/@jimp/custom/dist/index.js b/project starter code/node_modules/@jimp/custom/dist/index.js
index 5379fa58..c0de6b06 100644
--- a/project starter code/node_modules/@jimp/custom/dist/index.js
+++ b/project starter code/node_modules/@jimp/custom/dist/index.js
@@ -1,89 +1,73 @@
"use strict";
-var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = configure;
-
-var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
-
+exports.default = configure;
var _core = _interopRequireWildcard(require("@jimp/core"));
-
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
-
-function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
-
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function configure(configuration) {
- var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _core["default"];
- var jimpConfig = {
+ let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _core.default;
+ const jimpConfig = {
hasAlpha: {},
encoders: {},
decoders: {},
- "class": {},
+ class: {},
constants: {}
};
-
function addToConfig(newConfig) {
- Object.entries(newConfig).forEach(function (_ref) {
- var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
- key = _ref2[0],
- value = _ref2[1];
-
- jimpConfig[key] = _objectSpread({}, jimpConfig[key], {}, value);
+ Object.entries(newConfig).forEach(_ref => {
+ let [key, value] = _ref;
+ jimpConfig[key] = {
+ ...jimpConfig[key],
+ ...value
+ };
});
}
-
function addImageType(typeModule) {
- var type = typeModule();
-
+ const type = typeModule();
if (Array.isArray(type.mime)) {
- _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(type.mime));
+ (0, _core.addType)(...type.mime);
} else {
- Object.entries(type.mime).forEach(function (mimeType) {
- return _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(mimeType));
- });
+ Object.entries(type.mime).forEach(mimeType => (0, _core.addType)(...mimeType));
}
-
delete type.mime;
addToConfig(type);
}
-
function addPlugin(pluginModule) {
- var plugin = pluginModule(_core.jimpEvChange) || {};
-
- if (!plugin["class"] && !plugin.constants) {
+ const plugin = pluginModule(_core.jimpEvChange) || {};
+ if (!plugin.class && !plugin.constants) {
// Default to class function
addToConfig({
- "class": plugin
+ class: plugin
});
} else {
addToConfig(plugin);
}
}
-
if (configuration.types) {
configuration.types.forEach(addImageType);
- jimpInstance.decoders = _objectSpread({}, jimpInstance.decoders, {}, jimpConfig.decoders);
- jimpInstance.encoders = _objectSpread({}, jimpInstance.encoders, {}, jimpConfig.encoders);
- jimpInstance.hasAlpha = _objectSpread({}, jimpInstance.hasAlpha, {}, jimpConfig.hasAlpha);
+ jimpInstance.decoders = {
+ ...jimpInstance.decoders,
+ ...jimpConfig.decoders
+ };
+ jimpInstance.encoders = {
+ ...jimpInstance.encoders,
+ ...jimpConfig.encoders
+ };
+ jimpInstance.hasAlpha = {
+ ...jimpInstance.hasAlpha,
+ ...jimpConfig.hasAlpha
+ };
}
-
if (configuration.plugins) {
configuration.plugins.forEach(addPlugin);
}
-
- (0, _core.addJimpMethods)(jimpConfig["class"], jimpInstance);
+ (0, _core.addJimpMethods)(jimpConfig.class, jimpInstance);
(0, _core.addConstants)(jimpConfig.constants, jimpInstance);
- return _core["default"];
+ return _core.default;
}
-
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/custom/dist/index.js.map b/project starter code/node_modules/@jimp/custom/dist/index.js.map
index afe7b2a4..d6677071 100644
--- a/project starter code/node_modules/@jimp/custom/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/custom/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["configure","configuration","jimpInstance","Jimp","jimpConfig","hasAlpha","encoders","decoders","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","addType","mimeType","addPlugin","pluginModule","plugin","jimpEvChange","types","plugins"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;AAOe,SAASA,SAAT,CAAmBC,aAAnB,EAAuD;AAAA,MAArBC,YAAqB,uEAANC,gBAAM;AACpE,MAAMC,UAAU,GAAG;AACjBC,IAAAA,QAAQ,EAAE,EADO;AAEjBC,IAAAA,QAAQ,EAAE,EAFO;AAGjBC,IAAAA,QAAQ,EAAE,EAHO;AAIjB,aAAO,EAJU;AAKjBC,IAAAA,SAAS,EAAE;AALM,GAAnB;;AAQA,WAASC,WAAT,CAAqBC,SAArB,EAAgC;AAC9BC,IAAAA,MAAM,CAACC,OAAP,CAAeF,SAAf,EAA0BG,OAA1B,CAAkC,gBAAkB;AAAA;AAAA,UAAhBC,GAAgB;AAAA,UAAXC,KAAW;;AAClDX,MAAAA,UAAU,CAACU,GAAD,CAAV,qBACKV,UAAU,CAACU,GAAD,CADf,MAEKC,KAFL;AAID,KALD;AAMD;;AAED,WAASC,YAAT,CAAsBC,UAAtB,EAAkC;AAChC,QAAMC,IAAI,GAAGD,UAAU,EAAvB;;AAEA,QAAIE,KAAK,CAACC,OAAN,CAAcF,IAAI,CAACG,IAAnB,CAAJ,EAA8B;AAC5BC,sEAAWJ,IAAI,CAACG,IAAhB;AACD,KAFD,MAEO;AACLV,MAAAA,MAAM,CAACC,OAAP,CAAeM,IAAI,CAACG,IAApB,EAA0BR,OAA1B,CAAkC,UAAAU,QAAQ;AAAA,eAAID,gEAAWC,QAAX,EAAJ;AAAA,OAA1C;AACD;;AAED,WAAOL,IAAI,CAACG,IAAZ;AACAZ,IAAAA,WAAW,CAACS,IAAD,CAAX;AACD;;AAED,WAASM,SAAT,CAAmBC,YAAnB,EAAiC;AAC/B,QAAMC,MAAM,GAAGD,YAAY,CAACE,kBAAD,CAAZ,IAA8B,EAA7C;;AACA,QAAI,CAACD,MAAM,SAAP,IAAiB,CAACA,MAAM,CAAClB,SAA7B,EAAwC;AACtC;AACAC,MAAAA,WAAW,CAAC;AAAE,iBAAOiB;AAAT,OAAD,CAAX;AACD,KAHD,MAGO;AACLjB,MAAAA,WAAW,CAACiB,MAAD,CAAX;AACD;AACF;;AAED,MAAIzB,aAAa,CAAC2B,KAAlB,EAAyB;AACvB3B,IAAAA,aAAa,CAAC2B,KAAd,CAAoBf,OAApB,CAA4BG,YAA5B;AAEAd,IAAAA,YAAY,CAACK,QAAb,qBACKL,YAAY,CAACK,QADlB,MAEKH,UAAU,CAACG,QAFhB;AAIAL,IAAAA,YAAY,CAACI,QAAb,qBACKJ,YAAY,CAACI,QADlB,MAEKF,UAAU,CAACE,QAFhB;AAIAJ,IAAAA,YAAY,CAACG,QAAb,qBACKH,YAAY,CAACG,QADlB,MAEKD,UAAU,CAACC,QAFhB;AAID;;AAED,MAAIJ,aAAa,CAAC4B,OAAlB,EAA2B;AACzB5B,IAAAA,aAAa,CAAC4B,OAAd,CAAsBhB,OAAtB,CAA8BW,SAA9B;AACD;;AAED,4BAAepB,UAAU,SAAzB,EAAiCF,YAAjC;AACA,0BAAaE,UAAU,CAACI,SAAxB,EAAmCN,YAAnC;AAEA,SAAOC,gBAAP;AACD","sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange\n} from '@jimp/core';\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {}\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach(mimeType => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["configure","configuration","jimpInstance","Jimp","jimpConfig","hasAlpha","encoders","decoders","class","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","addType","mimeType","addPlugin","pluginModule","plugin","jimpEvChange","types","plugins","addJimpMethods","addConstants"],"sources":["../src/index.js"],"sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange,\n} from \"@jimp/core\";\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {},\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value,\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach((mimeType) => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders,\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders,\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha,\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"mappings":";;;;;;AAAA;AAKoB;AAAA;AAEL,SAASA,SAAS,CAACC,aAAa,EAAuB;EAAA,IAArBC,YAAY,uEAAGC,aAAI;EAClE,MAAMC,UAAU,GAAG;IACjBC,QAAQ,EAAE,CAAC,CAAC;IACZC,QAAQ,EAAE,CAAC,CAAC;IACZC,QAAQ,EAAE,CAAC,CAAC;IACZC,KAAK,EAAE,CAAC,CAAC;IACTC,SAAS,EAAE,CAAC;EACd,CAAC;EAED,SAASC,WAAW,CAACC,SAAS,EAAE;IAC9BC,MAAM,CAACC,OAAO,CAACF,SAAS,CAAC,CAACG,OAAO,CAAC,QAAkB;MAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC;MAC7CZ,UAAU,CAACW,GAAG,CAAC,GAAG;QAChB,GAAGX,UAAU,CAACW,GAAG,CAAC;QAClB,GAAGC;MACL,CAAC;IACH,CAAC,CAAC;EACJ;EAEA,SAASC,YAAY,CA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AC1C;EAEA,IAAAM,oBAAc,EAAC3B,UAAU,CAACI,KAAK,EAAEN,YAAY,CAAC;EAC9C,IAAA8B,kBAAY,EAAC5B,UAAU,CAACK,SAAS,EAAEP,YAAY,CAAC;EAEhD,OAAOC,aAAI;AACb;AAAC;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/custom/es/index.js b/project starter code/node_modules/@jimp/custom/es/index.js
index ddc334e1..efc8a97a 100644
--- a/project starter code/node_modules/@jimp/custom/es/index.js
+++ b/project starter code/node_modules/@jimp/custom/es/index.js
@@ -1,87 +1,63 @@
-"use strict";
-
-var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = configure;
-
-var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
-
-var _core = _interopRequireWildcard(require("@jimp/core"));
-
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
-
-function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
-
-function configure(configuration) {
- var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _core["default"];
- var jimpConfig = {
+import Jimp, { addType, addJimpMethods, addConstants, jimpEvChange } from "@jimp/core";
+export default function configure(configuration) {
+ let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;
+ const jimpConfig = {
hasAlpha: {},
encoders: {},
decoders: {},
- "class": {},
+ class: {},
constants: {}
};
-
function addToConfig(newConfig) {
- Object.entries(newConfig).forEach(function (_ref) {
- var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
- key = _ref2[0],
- value = _ref2[1];
-
- jimpConfig[key] = _objectSpread({}, jimpConfig[key], {}, value);
+ Object.entries(newConfig).forEach(_ref => {
+ let [key, value] = _ref;
+ jimpConfig[key] = {
+ ...jimpConfig[key],
+ ...value
+ };
});
}
-
function addImageType(typeModule) {
- var type = typeModule();
-
+ const type = typeModule();
if (Array.isArray(type.mime)) {
- _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(type.mime));
+ addType(...type.mime);
} else {
- Object.entries(type.mime).forEach(function (mimeType) {
- return _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(mimeType));
- });
+ Object.entries(type.mime).forEach(mimeType => addType(...mimeType));
}
-
delete type.mime;
addToConfig(type);
}
-
function addPlugin(pluginModule) {
- var plugin = pluginModule(_core.jimpEvChange) || {};
-
- if (!plugin["class"] && !plugin.constants) {
+ const plugin = pluginModule(jimpEvChange) || {};
+ if (!plugin.class && !plugin.constants) {
// Default to class function
addToConfig({
- "class": plugin
+ class: plugin
});
} else {
addToConfig(plugin);
}
}
-
if (configuration.types) {
configuration.types.forEach(addImageType);
- jimpInstance.decoders = _objectSpread({}, jimpInstance.decoders, {}, jimpConfig.decoders);
- jimpInstance.encoders = _objectSpread({}, jimpInstance.encoders, {}, jimpConfig.encoders);
- jimpInstance.hasAlpha = _objectSpread({}, jimpInstance.hasAlpha, {}, jimpConfig.hasAlpha);
+ jimpInstance.decoders = {
+ ...jimpInstance.decoders,
+ ...jimpConfig.decoders
+ };
+ jimpInstance.encoders = {
+ ...jimpInstance.encoders,
+ ...jimpConfig.encoders
+ };
+ jimpInstance.hasAlpha = {
+ ...jimpInstance.hasAlpha,
+ ...jimpConfig.hasAlpha
+ };
}
-
if (configuration.plugins) {
configuration.plugins.forEach(addPlugin);
}
-
- (0, _core.addJimpMethods)(jimpConfig["class"], jimpInstance);
- (0, _core.addConstants)(jimpConfig.constants, jimpInstance);
- return _core["default"];
+ addJimpMethods(jimpConfig.class, jimpInstance);
+ addConstants(jimpConfig.constants, jimpInstance);
+ return Jimp;
}
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/custom/es/index.js.map b/project starter code/node_modules/@jimp/custom/es/index.js.map
index afe7b2a4..066194f4 100644
--- a/project starter code/node_modules/@jimp/custom/es/index.js.map
+++ b/project starter code/node_modules/@jimp/custom/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["configure","configuration","jimpInstance","Jimp","jimpConfig","hasAlpha","encoders","decoders","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","addType","mimeType","addPlugin","pluginModule","plugin","jimpEvChange","types","plugins"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;AAOe,SAASA,SAAT,CAAmBC,aAAnB,EAAuD;AAAA,MAArBC,YAAqB,uEAANC,gBAAM;AACpE,MAAMC,UAAU,GAAG;AACjBC,IAAAA,QAAQ,EAAE,EADO;AAEjBC,IAAAA,QAAQ,EAAE,EAFO;AAGjBC,IAAAA,QAAQ,EAAE,EAHO;AAIjB,aAAO,EAJU;AAKjBC,IAAAA,SAAS,EAAE;AALM,GAAnB;;AAQA,WAASC,WAAT,CAAqBC,SAArB,EAAgC;AAC9BC,IAAAA,MAAM,CAACC,OAAP,CAAeF,SAAf,EAA0BG,OAA1B,CAAkC,gBAAkB;AAAA;AAAA,UAAhBC,GAAgB;AAAA,UAAXC,KAAW;;AAClDX,MAAAA,UAAU,CAACU,GA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AAAA,aAAa,CAAC4B,OAAd,CAAsBhB,OAAtB,CAA8BW,SAA9B;AACD;;AAED,4BAAepB,UAAU,SAAzB,EAAiCF,YAAjC;AACA,0BAAaE,UAAU,CAACI,SAAxB,EAAmCN,YAAnC;AAEA,SAAOC,gBAAP;AACD","sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange\n} from '@jimp/core';\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {}\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach(mimeType => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["Jimp","addType","addJimpMethods","addConstants","jimpEvChange","configure","configuration","jimpInstance","jimpConfig","hasAlpha","encoders","decoders","class","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","mimeType","addPlugin","pluginModule","plugin","types","plugins"],"sources":["../src/index.js"],"sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange,\n} from \"@jimp/core\";\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {},\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value,\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach((mimeType) => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders,\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders,\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha,\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,IACTC,OAAO,EACPC,cAAc,EACdC,YAAY,EACZC,YAAY,QACP,YAAY;AAEnB,eAAe,SAASC,SAAS,CAACC,aAAa,EAAuB;EAAA,IAArBC,YAAY,uEAAGP,IAAI;EAClE,MAAMQ,UAAU,GAAG;IACjBC,QAAQ,EAAE,CAAC,CAAC;IACZC,QAAQ,EAAE,CAAC,CAAC;IACZC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,GAAGJ,YAAY,CAACI,QAAQ;MACxB,GAAGH,UAAU,CAACG;IAChB,CAAC;IACDJ,YAAY,CAACG,QAAQ,GAAG;MACtB,GAAGH,YAAY,CAACG,QAAQ;MACxB,GAAGF,UAAU,CAACE;IAChB,CAAC;IACDH,YAAY,CAACE,QAAQ,GAAG;MACtB,GAAGF,YAAY,CAACE,QAAQ;MACxB,GAAGD,UAAU,CAACC;IAChB,CAAC;EACH;EAEA,IAAIH,aAAa,CAAC0B,OAAO,EAAE;IACzB1B,aAAa,CAAC0B,OAAO,CAACd,OAAO,CAACU,SAAS,CAAC;EAC1C;EAEA1B,cAAc,CAACM,UAAU,CAACI,KAAK,EAAEL,YAAY,CAAC;EAC9CJ,YAAY,CAACK,UAAU,CAACK,SAAS,EAAEN,YAAY,CAAC;EAEhD,OAAOP,IAAI;AACb"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/custom/package.json b/project starter code/node_modules/@jimp/custom/package.json
index e0aa83b5..d64fb4be 100644
--- a/project starter code/node_modules/@jimp/custom/package.json
+++ b/project starter code/node_modules/@jimp/custom/package.json
@@ -1,9 +1,10 @@
{
"name": "@jimp/custom",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Interface to customize jimp configuration",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "types/index.d.ts",
"scripts": {
"build": "npm run build:node:production && npm run build:module",
@@ -17,11 +18,10 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/core": "^0.16.2"
+ "@jimp/core": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/custom/src/index.js b/project starter code/node_modules/@jimp/custom/src/index.js
index ce571f80..dddc7d90 100644
--- a/project starter code/node_modules/@jimp/custom/src/index.js
+++ b/project starter code/node_modules/@jimp/custom/src/index.js
@@ -2,8 +2,8 @@ import Jimp, {
addType,
addJimpMethods,
addConstants,
- jimpEvChange
-} from '@jimp/core';
+ jimpEvChange,
+} from "@jimp/core";
export default function configure(configuration, jimpInstance = Jimp) {
const jimpConfig = {
@@ -11,14 +11,14 @@ export default function configure(configuration, jimpInstance = Jimp) {
encoders: {},
decoders: {},
class: {},
- constants: {}
+ constants: {},
};
function addToConfig(newConfig) {
Object.entries(newConfig).forEach(([key, value]) => {
jimpConfig[key] = {
...jimpConfig[key],
- ...value
+ ...value,
};
});
}
@@ -29,7 +29,7 @@ export default function configure(configuration, jimpInstance = Jimp) {
if (Array.isArray(type.mime)) {
addType(...type.mime);
} else {
- Object.entries(type.mime).forEach(mimeType => addType(...mimeType));
+ Object.entries(type.mime).forEach((mimeType) => addType(...mimeType));
}
delete type.mime;
@@ -51,15 +51,15 @@ export default function configure(configuration, jimpInstance = Jimp) {
jimpInstance.decoders = {
...jimpInstance.decoders,
- ...jimpConfig.decoders
+ ...jimpConfig.decoders,
};
jimpInstance.encoders = {
...jimpInstance.encoders,
- ...jimpConfig.encoders
+ ...jimpConfig.encoders,
};
jimpInstance.hasAlpha = {
...jimpInstance.hasAlpha,
- ...jimpConfig.hasAlpha
+ ...jimpConfig.hasAlpha,
};
}
diff --git a/project starter code/node_modules/@jimp/custom/types/index.d.ts b/project starter code/node_modules/@jimp/custom/types/index.d.ts
index bdd65342..dc528878 100644
--- a/project starter code/node_modules/@jimp/custom/types/index.d.ts
+++ b/project starter code/node_modules/@jimp/custom/types/index.d.ts
@@ -1,4 +1,4 @@
-// TypeScript Version: 3.1
+// Minimum TypeScript Version: 3.2
// See the `jimp` package index.d.ts for why the version is not 2.8
import {
FunctionRet,
@@ -7,16 +7,22 @@ import {
JimpType,
GetIntersectionFromPlugins,
GetIntersectionFromPluginsStatics,
- JimpConstructors
-} from '@jimp/core';
+ JimpConstructors,
+} from "@jimp/core";
type JimpInstance<
TypesFuncArr extends FunctionRet | undefined,
PluginFuncArr extends FunctionRet | undefined,
J extends JimpConstructors
-> = J & GetIntersectionFromPluginsStatics> & {
- prototype: JimpType & GetIntersectionFromPlugins>
-};
+> = J &
+ GetIntersectionFromPluginsStatics<
+ Exclude
+ > & {
+ prototype: JimpType &
+ GetIntersectionFromPlugins<
+ Exclude
+ >;
+ };
declare function configure<
TypesFuncArr extends FunctionRet | undefined = undefined,
diff --git a/project starter code/node_modules/@jimp/custom/types/test.ts b/project starter code/node_modules/@jimp/custom/types/test.ts
index 9b7f20a3..e0f77bb2 100644
--- a/project starter code/node_modules/@jimp/custom/types/test.ts
+++ b/project starter code/node_modules/@jimp/custom/types/test.ts
@@ -1,36 +1,36 @@
-import configure from '@jimp/custom';
-import gif from '@jimp/gif';
-import png from '@jimp/png';
-import displace from '@jimp/plugin-displace';
-import resize from '@jimp/plugin-resize';
-import scale from '@jimp/plugin-scale';
-import types from '@jimp/types';
-import plugins from '@jimp/plugins';
-import * as Jimp from 'jimp';
+import configure from "@jimp/custom";
+import gif from "@jimp/gif";
+import png from "@jimp/png";
+import displace from "@jimp/plugin-displace";
+import resize from "@jimp/plugin-resize";
+import scale from "@jimp/plugin-scale";
+import types from "@jimp/types";
+import plugins from "@jimp/plugins";
+import * as Jimp from "jimp";
// configure should return a valid Jimp type with addons
const CustomJimp = configure({
types: [gif, png],
- plugins: [displace, resize]
+ plugins: [displace, resize],
});
-test('should function the same as the `jimp` types', () => {
+test("should function the same as the `jimp` types", () => {
const FullCustomJimp = configure({
types: [types],
- plugins: [plugins]
+ plugins: [plugins],
});
- const jimpInst = new FullCustomJimp('test');
+ const jimpInst = new FullCustomJimp("test");
// Main Jimp export should already have all of these already applied
// $ExpectError
- jimpInst.read('Test');
+ jimpInst.read("Test");
jimpInst.displace(jimpInst, 2);
jimpInst.resize(40, 40);
jimpInst.displace(jimpInst, 2);
jimpInst.shadow((err, val, coords) => {});
- jimpInst.fishEye({r: 12});
- jimpInst.circle({radius: 12, x: 12, y: 12});
+ jimpInst.fishEye({ r: 12 });
+ jimpInst.circle({ radius: 12, x: 12, y: 12 });
// $ExpectError
jimpInst.PNG_FILTER_NONE;
@@ -41,7 +41,7 @@ test('should function the same as the `jimp` types', () => {
jimpInst.func();
// Main Jimp export should already have all of these already applied
- FullCustomJimp.read('Test');
+ FullCustomJimp.read("Test");
// $ExpectType 0
FullCustomJimp.PNG_FILTER_NONE;
@@ -52,34 +52,33 @@ test('should function the same as the `jimp` types', () => {
// $ExpectError
FullCustomJimp.func();
- test('can clone properly', async () => {
- const baseImage = await FullCustomJimp.read('filename');
+ test("can clone properly", async () => {
+ const baseImage = await FullCustomJimp.read("filename");
const cloneBaseImage = baseImage.clone();
// $ExpectType number
cloneBaseImage._deflateLevel;
- test('can handle `this` returns on the core type properly', () => {
+ test("can handle `this` returns on the core type properly", () => {
// $ExpectType number
- cloneBaseImage.posterize(3)._quality
+ cloneBaseImage.posterize(3)._quality;
});
- test('can handle `this` returns properly', () => {
+ test("can handle `this` returns properly", () => {
cloneBaseImage
.resize(1, 1)
.crop(0, 0, 0, 0)
.mask(cloneBaseImage, 2, 2)
- .print('a' as any, 2, 2, 'a' as any)
+ .print("a" as any, 2, 2, "a" as any)
.resize(1, 1)
.quality(1)
- .deflateLevel(2)
- ._filterType;
+ .deflateLevel(2)._filterType;
});
- test('can handle imageCallbacks `this` properly', () => {
+ test("can handle imageCallbacks `this` properly", () => {
cloneBaseImage.rgba(false, (_, jimpCBIn) => {
// $ExpectError
- jimpCBIn.read('Test');
+ jimpCBIn.read("Test");
jimpCBIn.displace(jimpInst, 2);
jimpCBIn.resize(40, 40);
// $ExpectType number
@@ -90,16 +89,16 @@ test('should function the same as the `jimp` types', () => {
// $ExpectError
jimpCBIn.func();
- })
- })
+ });
+ });
});
- test('Can handle callback with constructor', () => {
+ test("Can handle callback with constructor", () => {
const myBmpBuffer: Buffer = {} as any;
Jimp.read(myBmpBuffer, (err, cbJimpInst) => {
// $ExpectError
- cbJimpInst.read('Test');
+ cbJimpInst.read("Test");
cbJimpInst.displace(jimpInst, 2);
cbJimpInst.resize(40, 40);
// $ExpectType number
@@ -112,16 +111,15 @@ test('should function the same as the `jimp` types', () => {
cbJimpInst.func();
});
});
-
});
-test('can handle custom jimp', () => {
+test("can handle custom jimp", () => {
// Constants from types should be applied
// $ExpectType 0
CustomJimp.PNG_FILTER_NONE;
-
+
// Core functions should still work from Jimp
- CustomJimp.read('Test');
+ CustomJimp.read("Test");
// Constants should not(?) be applied from ill-formed plugins
// $ExpectError
@@ -129,18 +127,18 @@ test('can handle custom jimp', () => {
// Methods should be applied from well-formed plugins only to the instance
// $ExpectError
- CustomJimp.resize(40, 40)
-
+ CustomJimp.resize(40, 40);
+
// Constants should be applied from well-formed plugins
- CustomJimp.RESIZE_NEAREST_NEIGHBOR
-
+ CustomJimp.RESIZE_NEAREST_NEIGHBOR;
+
// $ExpectError
CustomJimp.test;
-
+
// $ExpectError
CustomJimp.func();
- const Jiimp = new CustomJimp('test');
+ const Jiimp = new CustomJimp("test");
// Methods from types should be applied
Jiimp.deflateLevel(4);
// Constants from types should be applied to the static only
@@ -154,11 +152,11 @@ test('can handle custom jimp', () => {
Jiimp.displace(Jiimp, 2);
// Methods should be applied from well-formed plugins
- Jiimp.resize(40, 40)
+ Jiimp.resize(40, 40);
// Constants should not be applied to the object
// $ExpectError
- Jiimp.RESIZE_NEAREST_NEIGHBOR
+ Jiimp.RESIZE_NEAREST_NEIGHBOR;
// $ExpectError
Jiimp.test;
@@ -167,16 +165,19 @@ test('can handle custom jimp', () => {
Jiimp.func();
});
-test('can compose', () => {
- const OtherCustomJimp = configure({
- plugins: [scale]
- }, CustomJimp);
+test("can compose", () => {
+ const OtherCustomJimp = configure(
+ {
+ plugins: [scale],
+ },
+ CustomJimp
+ );
// Constants from types should be applied
// $ExpectType 0
OtherCustomJimp.PNG_FILTER_NONE;
// Core functions should still work from Jimp
- OtherCustomJimp.read('Test');
+ OtherCustomJimp.read("Test");
// Constants should not be applied to the static instance from ill-formed plugins
// $ExpectError
@@ -194,8 +195,8 @@ test('can compose', () => {
// $ExpectError
OtherCustomJimp.func();
-
- const Jiimp = new OtherCustomJimp('test');
+
+ const Jiimp = new OtherCustomJimp("test");
// Methods from types should be applied
Jiimp.deflateLevel(4);
// Constants from types should not be applied to objects
@@ -215,11 +216,11 @@ test('can compose', () => {
Jiimp.displace(Jiimp, 2);
// Methods should be applied from well-formed plugins
- Jiimp.resize(40, 40)
+ Jiimp.resize(40, 40);
// Constants should not be applied from well-formed plugins to objects
// $ExpectError
- Jiimp.RESIZE_NEAREST_NEIGHBOR
+ Jiimp.RESIZE_NEAREST_NEIGHBOR;
// $ExpectError
Jiimp.test;
@@ -228,13 +229,13 @@ test('can compose', () => {
Jiimp.func();
});
-test('can handle only plugins', () => {
+test("can handle only plugins", () => {
const PluginsJimp = configure({
- plugins: [plugins]
+ plugins: [plugins],
});
// Core functions should still work from Jimp
- PluginsJimp.read('Test');
+ PluginsJimp.read("Test");
// Constants should not be applied from ill-formed plugins
// $ExpectError
@@ -254,8 +255,8 @@ test('can handle only plugins', () => {
// $ExpectError
PluginsJimp.func();
- const Jiimp = new PluginsJimp('test');
-
+ const Jiimp = new PluginsJimp("test");
+
// Core functions should still work from Jimp
Jiimp.getPixelColor(1, 1);
@@ -263,22 +264,22 @@ test('can handle only plugins', () => {
Jiimp.displace(Jiimp, 2);
// Methods should be applied from well-formed plugins
- Jiimp.resize(40, 40)
+ Jiimp.resize(40, 40);
// Constants should be not applied to objects from well-formed plugins
// $ExpectError
- Jiimp.RESIZE_NEAREST_NEIGHBOR
+ Jiimp.RESIZE_NEAREST_NEIGHBOR;
// $ExpectError
Jiimp.test;
// $ExpectError
Jiimp.func();
-})
+});
-test('can handle only all types', () => {
+test("can handle only all types", () => {
const TypesJimp = configure({
- types: [types]
+ types: [types],
});
// Methods from types should not be applied
@@ -294,7 +295,7 @@ test('can handle only all types', () => {
// $ExpectError
TypesJimp.func();
- const Jiimp = new TypesJimp('test');
+ const Jiimp = new TypesJimp("test");
// Methods from types should be applied
Jiimp.filterType(4);
// Constants from types should be not applied to objects
@@ -308,9 +309,9 @@ test('can handle only all types', () => {
Jiimp.func();
});
-test('can handle only one type', () => {
+test("can handle only one type", () => {
const PngJimp = configure({
- types: [png]
+ types: [png],
});
// Constants from other types should be not applied
@@ -320,15 +321,14 @@ test('can handle only one type', () => {
// Constants from types should be applied
// $ExpectType 0
PngJimp.PNG_FILTER_NONE;
-
+
// $ExpectError
PngJimp.test;
// $ExpectError
PngJimp.func();
-
- const Jiimp = new PngJimp('test');
+ const Jiimp = new PngJimp("test");
// Constants from other types should be not applied
// $ExpectError
Jiimp.MIME_TIFF;
@@ -344,10 +344,9 @@ test('can handle only one type', () => {
Jiimp.func();
});
-
-test('can handle only one plugin', () => {
+test("can handle only one plugin", () => {
const ResizeJimp = configure({
- plugins: [resize]
+ plugins: [resize],
});
// Constants from other plugins should be not applied
@@ -367,8 +366,7 @@ test('can handle only one plugin', () => {
// $ExpectError
ResizeJimp.func();
-
- const Jiimp: InstanceType = new ResizeJimp('test');
+ const Jiimp: InstanceType = new ResizeJimp("test");
// Constants from other plugins should be not applied
// $ExpectError
Jiimp.FONT_SANS_8_BLACK;
@@ -386,14 +384,13 @@ test('can handle only one plugin', () => {
Jiimp.func();
});
-
-test('Can handle appendConstructorOption', () => {
+test("Can handle appendConstructorOption", () => {
const AppendJimp = configure({});
AppendJimp.appendConstructorOption(
- 'Name of Option',
- args => args.hasSomeCustomThing,
- function(resolve, reject, args) {
+ "Name of Option",
+ (args) => args.hasSomeCustomThing,
+ function (resolve, reject, args) {
// $ExpectError
this.bitmap = 3;
// $ExpectError
diff --git a/project starter code/node_modules/@jimp/custom/types/tsconfig.json b/project starter code/node_modules/@jimp/custom/types/tsconfig.json
index dcfe450f..a2773dce 100644
--- a/project starter code/node_modules/@jimp/custom/types/tsconfig.json
+++ b/project starter code/node_modules/@jimp/custom/types/tsconfig.json
@@ -6,6 +6,7 @@
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
+ "skipLibCheck": true,
"noEmit": true,
// If the library is an external module (uses `export`), this allows your test file to import "mylib" instead of "./index".
diff --git a/project starter code/node_modules/@jimp/gif/CHANGELOG.md b/project starter code/node_modules/@jimp/gif/CHANGELOG.md
index 392a46ce..e12d31e0 100644
--- a/project starter code/node_modules/@jimp/gif/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/gif/CHANGELOG.md
@@ -1,3 +1,81 @@
+# v0.22.9 (Wed Jul 26 2023)
+
+:tada: This release contains work from a new contributor! :tada:
+
+Thank you, Nicolas Morel ([@Marsup](https://github.com/Marsup)), for all your work!
+
+#### 🚀 Enhancement
+
+- chore: upgrade gifwrap [#1222](https://github.com/jimp-dev/jimp/pull/1222) ([@Marsup](https://github.com/Marsup))
+
+#### Authors: 1
+
+- Nicolas Morel ([@Marsup](https://github.com/Marsup))
+
+---
+
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.13.0 (Fri Jun 05 2020)
#### 🚀 Enhancement
@@ -25,7 +103,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -33,4 +111,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/gif/dist/index.js b/project starter code/node_modules/@jimp/gif/dist/index.js
index ee1f31c2..b25bc145 100644
--- a/project starter code/node_modules/@jimp/gif/dist/index.js
+++ b/project starter code/node_modules/@jimp/gif/dist/index.js
@@ -1,50 +1,45 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
+exports.default = void 0;
var _omggif = _interopRequireDefault(require("omggif"));
-
var _gifwrap = require("gifwrap");
-
-var MIME_TYPE = 'image/gif';
-
-var _default = function _default() {
- return {
- mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['gif']),
- constants: {
- MIME_GIF: MIME_TYPE
- },
- decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) {
- var gifObj = new _omggif["default"].GifReader(data);
- var gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+const MIME_TYPE = "image/gif";
+var _default = () => ({
+ mime: {
+ [MIME_TYPE]: ["gif"]
+ },
+ constants: {
+ MIME_GIF: MIME_TYPE
+ },
+ decoders: {
+ [MIME_TYPE]: data => {
+ const gifObj = new _omggif.default.GifReader(data);
+ const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);
gifObj.decodeAndBlitFrameRGBA(0, gifData);
return {
data: gifData,
width: gifObj.width,
height: gifObj.height
};
- }),
- encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) {
- var bitmap = new _gifwrap.BitmapImage(data.bitmap);
-
+ }
+ },
+ encoders: {
+ [MIME_TYPE]: data => {
+ const bitmap = new _gifwrap.BitmapImage(data.bitmap);
_gifwrap.GifUtil.quantizeDekker(bitmap, 256);
-
- var newFrame = new _gifwrap.GifFrame(bitmap);
- var gifCodec = new _gifwrap.GifCodec();
- return gifCodec.encodeGif([newFrame], {}).then(function (newGif) {
+ const newFrame = new _gifwrap.GifFrame(bitmap);
+ const gifCodec = new _gifwrap.GifCodec();
+ return gifCodec.encodeGif([newFrame], {}).then(newGif => {
return newGif.buffer;
});
- })
- };
-};
-
-exports["default"] = _default;
+ }
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/gif/dist/index.js.map b/project starter code/node_modules/@jimp/gif/dist/index.js.map
index fcc6e6d8..2a9c98f7 100644
--- a/project starter code/node_modules/@jimp/gif/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/gif/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GIF","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bitmap","BitmapImage","GifUtil","quantizeDekker","newFrame","GifFrame","gifCodec","GifCodec","encodeGif","then","newGif","buffer"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAEH;AADD,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMC,MAAM,GAAG,IAAIC,mBAAIC,SAAR,CAAkBH,IAAlB,CAAf;AACA,UAAMI,OAAO,GAAGC,MAAM,CAACC,KAAP,CAAaL,MAAM,CAACM,KAAP,GAAeN,MAAM,CAACO,MAAtB,GAA+B,CAA5C,CAAhB;AAEAP,MAAAA,MAAM,CAACQ,sBAAP,CAA8B,CAA9B,EAAiCL,OAAjC;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEI,OADD;AAELG,QAAAA,KAAK,EAAEN,MAAM,CAACM,KAFT;AAGLC,QAAAA,MAAM,EAAEP,MAAM,CAACO;AAHV,OAAP;AAKD,KAZK,CAPY;AAsBpBE,IAAAA,QAAQ,uCACLf,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMW,MAAM,GAAG,IAAIC,oBAAJ,CAAgBZ,IAAI,CAACW,MAArB,CAAf;;AACAE,uBAAQC,cAAR,CAAuBH,MAAvB,EAA+B,GAA/B;;AACA,UAAMI,QAAQ,GAAG,IAAIC,iBAAJ,CAAaL,MAAb,CAAjB;AACA,UAAMM,QAAQ,GAAG,IAAIC,iBAAJ,EAAjB;AACA,aAAOD,QAAQ,CAACE,SAAT,CAAmB,CAACJ,QAAD,CAAnB,EAA+B,EAA/B,EAAmCK,IAAnC,CAAwC,UAAAC,MAAM,EAAI;AACvD,eAAOA,MAAM,CAACC,MAAd;AACD,OAFM,CAAP;AAGD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import GIF from 'omggif';\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from 'gifwrap';\n\nconst MIME_TYPE = 'image/gif';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['gif'] },\n\n constants: {\n MIME_GIF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: data => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then(newGif => {\n return newGif.buffer;\n });\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GIF","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bitmap","BitmapImage","GifUtil","quantizeDekker","newFrame","GifFrame","gifCodec","GifCodec","encodeGif","then","newGif","buffer"],"sources":["../src/index.js"],"sourcesContent":["import GIF from \"omggif\";\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from \"gifwrap\";\n\nconst MIME_TYPE = \"image/gif\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"gif\"] },\n\n constants: {\n MIME_GIF: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: (data) => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height,\n };\n },\n },\n\n encoders: {\n [MIME_TYPE]: (data) => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then((newGif) => {\n return newGif.buffer;\n });\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAAmE;AAEnE,MAAMA,SAAS,GAAG,WAAW;AAAC,eAEf,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BE,SAAS,EAAE;IACTC,QAAQ,EAAEH;EACZ,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMC,MAAM,GAAG,IAAIC,eAAG,CAACC,SAAS,CAACH,IAAI,CAAC;MACtC,MAAMI,OAAO,GAAGC,MAAM,CAACC,KAAK,CAACL,MAAM,CAACM,KAAK,GAAGN,MAAM,CAACO,MAAM,GAAG,CAAC,CAAC;MAE9DP,MAAM,CAACQ,sBAAsB,CAAC,CAAC,EAAEL,OAAO,CAAC;MAEzC,OAAO;QACLJ,IAAI,EAAEI,OAAO;QACbG,KAAK,EAAEN,MAAM,CAACM,KAAK;QACnBC,MAAM,EAAEP,MAAM,CAACO;MACjB,CAAC;IACH;EACF,CAAC;EAEDE,QAAQ,EAAE;IACR,CAACf,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMW,MAAM,GAAG,IAAIC,oBAAW,CAACZ,IAAI,CAACW,MAAM,CAAC;MAC3CE,gBAAO,CAACC,cAAc,CAACH,MAAM,EAAE,GAAG,CAAC;MACnC,MAAMI,QAAQ,GAAG,IAAIC,iBAAQ,CAACL,MAAM,CAAC;MACrC,MAAMM,QAAQ,GAAG,IAAIC,iBAAQ,EAAE;MAC/B,OAAOD,QAAQ,CAACE,SAAS,CAAC,CAACJ,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAACK,IAAI,CAAEC,MAAM,IAAK;QACzD,OAAOA,MAAM,CAACC,MAAM;MACtB,CAAC,CAAC;IACJ;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/gif/es/index.js b/project starter code/node_modules/@jimp/gif/es/index.js
index 37015c1e..5a527cd0 100644
--- a/project starter code/node_modules/@jimp/gif/es/index.js
+++ b/project starter code/node_modules/@jimp/gif/es/index.js
@@ -1,49 +1,35 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _omggif = _interopRequireDefault(require("omggif"));
-
-var _gifwrap = require("gifwrap");
-
-var MIME_TYPE = 'image/gif';
-
-var _default = function _default() {
- return {
- mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['gif']),
- constants: {
- MIME_GIF: MIME_TYPE
- },
- decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) {
- var gifObj = new _omggif["default"].GifReader(data);
- var gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);
+import GIF from "omggif";
+import { GifUtil, GifFrame, BitmapImage, GifCodec } from "gifwrap";
+const MIME_TYPE = "image/gif";
+export default (() => ({
+ mime: {
+ [MIME_TYPE]: ["gif"]
+ },
+ constants: {
+ MIME_GIF: MIME_TYPE
+ },
+ decoders: {
+ [MIME_TYPE]: data => {
+ const gifObj = new GIF.GifReader(data);
+ const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);
gifObj.decodeAndBlitFrameRGBA(0, gifData);
return {
data: gifData,
width: gifObj.width,
height: gifObj.height
};
- }),
- encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) {
- var bitmap = new _gifwrap.BitmapImage(data.bitmap);
-
- _gifwrap.GifUtil.quantizeDekker(bitmap, 256);
-
- var newFrame = new _gifwrap.GifFrame(bitmap);
- var gifCodec = new _gifwrap.GifCodec();
- return gifCodec.encodeGif([newFrame], {}).then(function (newGif) {
+ }
+ },
+ encoders: {
+ [MIME_TYPE]: data => {
+ const bitmap = new BitmapImage(data.bitmap);
+ GifUtil.quantizeDekker(bitmap, 256);
+ const newFrame = new GifFrame(bitmap);
+ const gifCodec = new GifCodec();
+ return gifCodec.encodeGif([newFrame], {}).then(newGif => {
return newGif.buffer;
});
- })
- };
-};
-
-exports["default"] = _default;
+ }
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/gif/es/index.js.map b/project starter code/node_modules/@jimp/gif/es/index.js.map
index fcc6e6d8..7ec6fc5c 100644
--- a/project starter code/node_modules/@jimp/gif/es/index.js.map
+++ b/project starter code/node_modules/@jimp/gif/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GIF","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bit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ATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import GIF from 'omggif';\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from 'gifwrap';\n\nconst MIME_TYPE = 'image/gif';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['gif'] },\n\n constants: {\n MIME_GIF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: data => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then(newGif => {\n return newGif.buffer;\n });\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["GIF","GifUtil","GifFrame","BitmapImage","GifCodec","MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bitmap","quantizeDekker","newFrame","gifCodec","encodeGif","then","newGif","buffer"],"sources":["../src/index.js"],"sourcesContent":["import GIF from \"omggif\";\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from \"gifwrap\";\n\nconst MIME_TYPE = \"image/gif\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"gif\"] },\n\n constants: {\n MIME_GIF: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: (data) => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height,\n };\n },\n },\n\n encoders: {\n [MIME_TYPE]: (data) => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then((newGif) => {\n return newGif.buffer;\n });\n },\n },\n});\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,QAAQ;AACxB,SAASC,OAAO,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,SAAS;AAElE,MAAMC,SAAS,GAAG,WAAW;AAE7B,gBAAe,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BE,SAAS,EAAE;IACTC,QAAQ,EAAEH;EACZ,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMC,MAAM,GAAG,IAAIX,GAAG,CAACY,SAAS,CAACF,IAAI,CAAC;MACtC,MAAMG,OAAO,GAAGC,MAAM,CAACC,KAAK,CAACJ,MAAM,CAACK,KAAK,GAAGL,MAAM,CAACM,MAAM,GAAG,CAAC,CAAC;MAE9DN,MAAM,CAACO,sBAAsB,CAAC,CAAC,EAAEL,OAAO,CAAC;MAEzC,OAAO;QACLH,IAAI,EAAEG,OAAO;QACbG,KAAK,EAAEL,MAAM,CAACK,KAAK;QACnBC,MAAM,EAAEN,MAAM,CAACM;MACjB,CAAC;IACH;EACF,CAAC;EAEDE,QAAQ,EAAE;IACR,CAACd,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMU,MAAM,GAAG,IAAIjB,WAAW,CAACO,IAAI,CAACU,MAAM,CAAC;MAC3CnB,OAAO,CAACoB,cAAc,CAACD,MAAM,EAAE,GAAG,CAAC;MACnC,MAAME,QAAQ,GAAG,IAAIpB,QAAQ,CAACkB,MAAM,CAAC;MACrC,MAAMG,QAAQ,GAAG,IAAInB,QAAQ,EAAE;MAC/B,OAAOmB,QAAQ,CAACC,SAAS,CAAC,CAACF,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAACG,IAAI,CAAEC,MAAM,IAAK;QACzD,OAAOA,MAAM,CAACC,MAAM;MACtB,CAAC,CAAC;IACJ;EACF;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/gif/index.d.ts b/project starter code/node_modules/@jimp/gif/index.d.ts
index 59ac0778..d1b1c679 100644
--- a/project starter code/node_modules/@jimp/gif/index.d.ts
+++ b/project starter code/node_modules/@jimp/gif/index.d.ts
@@ -1,17 +1,17 @@
-import { DecoderFn } from '@jimp/core';
+import { DecoderFn } from "@jimp/core";
interface Gif {
mime: {
- 'image/gif': string[]
- }
+ "image/gif": string[];
+ };
constants: {
- MIME_GIF: 'image/gif';
- }
+ MIME_GIF: "image/gif";
+ };
decoders: {
- 'image/gif': DecoderFn
- }
+ "image/gif": DecoderFn;
+ };
}
-export default function(): Gif;
+export default function (): Gif;
diff --git a/project starter code/node_modules/@jimp/gif/package.json b/project starter code/node_modules/@jimp/gif/package.json
index 624b6ac9..4fe0219f 100644
--- a/project starter code/node_modules/@jimp/gif/package.json
+++ b/project starter code/node_modules/@jimp/gif/package.json
@@ -1,11 +1,15 @@
{
"name": "@jimp/gif",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Default Jimp gif encoder/decoder.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
+ "test:watch": "npm run test -- --reporter min --watch",
+ "test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
"build:watch": "npm run build:node:debug -- -- --watch --verbose",
"build:debug": "npm run build:node:debug",
@@ -17,16 +21,19 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
- "gifwrap": "^0.9.2",
+ "@jimp/utils": "^0.22.12",
+ "gifwrap": "^0.10.1",
"omggif": "^1.0.9"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
},
+ "devDependencies": {
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
+ },
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/gif/src/index.js b/project starter code/node_modules/@jimp/gif/src/index.js
index 5ef76943..7acf2ff9 100644
--- a/project starter code/node_modules/@jimp/gif/src/index.js
+++ b/project starter code/node_modules/@jimp/gif/src/index.js
@@ -1,17 +1,17 @@
-import GIF from 'omggif';
-import { GifUtil, GifFrame, BitmapImage, GifCodec } from 'gifwrap';
+import GIF from "omggif";
+import { GifUtil, GifFrame, BitmapImage, GifCodec } from "gifwrap";
-const MIME_TYPE = 'image/gif';
+const MIME_TYPE = "image/gif";
export default () => ({
- mime: { [MIME_TYPE]: ['gif'] },
+ mime: { [MIME_TYPE]: ["gif"] },
constants: {
- MIME_GIF: MIME_TYPE
+ MIME_GIF: MIME_TYPE,
},
decoders: {
- [MIME_TYPE]: data => {
+ [MIME_TYPE]: (data) => {
const gifObj = new GIF.GifReader(data);
const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);
@@ -20,20 +20,20 @@ export default () => ({
return {
data: gifData,
width: gifObj.width,
- height: gifObj.height
+ height: gifObj.height,
};
- }
+ },
},
encoders: {
- [MIME_TYPE]: data => {
+ [MIME_TYPE]: (data) => {
const bitmap = new BitmapImage(data.bitmap);
GifUtil.quantizeDekker(bitmap, 256);
const newFrame = new GifFrame(bitmap);
const gifCodec = new GifCodec();
- return gifCodec.encodeGif([newFrame], {}).then(newGif => {
+ return gifCodec.encodeGif([newFrame], {}).then((newGif) => {
return newGif.buffer;
});
- }
- }
+ },
+ },
});
diff --git a/project starter code/node_modules/@jimp/gif/test/gif.test.js b/project starter code/node_modules/@jimp/gif/test/gif.test.js
index 100d7a5d..664fa676 100644
--- a/project starter code/node_modules/@jimp/gif/test/gif.test.js
+++ b/project starter code/node_modules/@jimp/gif/test/gif.test.js
@@ -1,29 +1,27 @@
-import { Jimp, getTestDir } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, getTestDir } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import expect from "@storybook/expect";
-import gif from '../src';
+import gif from "../src";
const jimp = configure({ types: [gif] }, Jimp);
-describe('GIF', () => {
- const imagesDir = getTestDir(__dirname) + '/images';
+describe("GIF", () => {
+ const imagesDir = getTestDir(__dirname) + "/images";
- it('load GIF', async () => {
- const image = await jimp.read(imagesDir + '/flower.gif');
- image.getPixelColor(10, 10).should.be.equal(0xe5e6d9ff);
+ it("load GIF", async () => {
+ const image = await jimp.read(imagesDir + "/flower.gif");
+ expect(image.getPixelColor(10, 10)).toBe(0xe5e6d9ff);
});
- it('load animated GIF', async () => {
- const image = await jimp.read(imagesDir + '/animated.gif');
- image.getPixelColor(10, 10).should.be.equal(0xa1d2f1ff);
+ it("load animated GIF", async () => {
+ const image = await jimp.read(imagesDir + "/animated.gif");
+ expect(image.getPixelColor(10, 10)).toBe(0xa1d2f1ff);
});
- it('export GIF', async () => {
- const jgd = await jimp.read(imagesDir + '/flower.gif');
- const buffer = await jgd.getBufferAsync('image/gif');
- buffer
- .toString()
- .startsWith('GIF')
- .should.be.equal(true);
+ it("export GIF", async () => {
+ const jgd = await jimp.read(imagesDir + "/flower.gif");
+ const buffer = await jgd.getBufferAsync("image/gif");
+ expect(buffer.toString()).toMatch(/^GIF/);
});
});
diff --git a/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md b/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md
index 14710629..e4262f45 100644
--- a/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md
@@ -1,3 +1,85 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.17.0 (Sat Feb 04 2023)
+
+### Release Notes
+
+#### update jpeg-js ([#1131](https://github.com/jimp-dev/jimp/pull/1131))
+
+This release changes the minimum node version from 8 to 16
+
+---
+
+#### 🚀 Enhancement
+
+- update jpeg-js [#1131](https://github.com/jimp-dev/jimp/pull/1131) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.16.2 (Thu Sep 15 2022)
#### 🐛 Bug Fix
@@ -61,7 +143,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -69,4 +151,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/jpeg/dist/index.js b/project starter code/node_modules/@jimp/jpeg/dist/index.js
index 72f904ca..a4b980c0 100644
--- a/project starter code/node_modules/@jimp/jpeg/dist/index.js
+++ b/project starter code/node_modules/@jimp/jpeg/dist/index.js
@@ -1,61 +1,51 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
+exports.default = void 0;
var _jpegJs = _interopRequireDefault(require("jpeg-js"));
-
var _utils = require("@jimp/utils");
-
-var MIME_TYPE = 'image/jpeg';
-
-var _default = function _default() {
- return {
- mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['jpeg', 'jpg', 'jpe']),
- constants: {
- MIME_JPEG: MIME_TYPE
- },
- decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode),
- encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) {
- return _jpegJs["default"].encode(image.bitmap, image._quality).data;
- }),
- "class": {
- // The quality to be used when saving JPEG images
- _quality: 100,
-
- /**
- * Sets the quality of the image when saving as JPEG format (default is 100)
- * @param {number} n The quality to use 0-100
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- quality: function quality(n, cb) {
- if (typeof n !== 'number') {
- return _utils.throwError.call(this, 'n must be a number', cb);
- }
-
- if (n < 0 || n > 100) {
- return _utils.throwError.call(this, 'n must be a number 0 - 100', cb);
- }
-
- this._quality = Math.round(n);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+const MIME_TYPE = "image/jpeg";
+var _default = () => ({
+ mime: {
+ [MIME_TYPE]: ["jpeg", "jpg", "jpe"]
+ },
+ constants: {
+ MIME_JPEG: MIME_TYPE
+ },
+ decoders: {
+ [MIME_TYPE]: _jpegJs.default.decode
+ },
+ encoders: {
+ [MIME_TYPE]: image => _jpegJs.default.encode(image.bitmap, image._quality).data
+ },
+ class: {
+ // The quality to be used when saving JPEG images
+ _quality: 100,
+ /**
+ * Sets the quality of the image when saving as JPEG format (default is 100)
+ * @param {number} n The quality to use 0-100
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ quality(n, cb) {
+ if (typeof n !== "number") {
+ return _utils.throwError.call(this, "n must be a number", cb);
+ }
+ if (n < 0 || n > 100) {
+ return _utils.throwError.call(this, "n must be a number 0 - 100", cb);
}
+ this._quality = Math.round(n);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
}
- };
-};
-
-exports["default"] = _default;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/jpeg/dist/index.js.map b/project starter code/node_modules/@jimp/jpeg/dist/index.js.map
index e8af597e..ca1f7d8d 100644
--- a/project starter code/node_modules/@jimp/jpeg/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/jpeg/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","quality","n","cb","throwError","call","Math","round"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,EAAgB,KAAhB,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACOK,mBAAKC,MADZ,CAPY;AAWpBC,IAAAA,QAAQ,uCACLP,SADK,EACO,UAAAQ,KAAK;AAAA,aAAIH,mBAAKI,MAAL,CAAYD,KAAK,CAACE,MAAlB,EAA0BF,KAAK,CAACG,QAAhC,EAA0CC,IAA9C;AAAA,KADZ,CAXY;AAepB,aAAO;AACL;AACAD,MAAAA,QAAQ,EAAE,GAFL;;AAGL;;;;;;AAMAE,MAAAA,OATK,mBASGC,CATH,EASMC,EATN,EASU;AACb,YAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAID,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAG,GAAjB,EAAsB;AACpB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,4BAAtB,EAAoDF,EAApD,CAAP;AACD;;AAED,aAAKJ,QAAL,GAAgBO,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAhB;;AAEA,YAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzBI;AAfa,GAAP;AAAA,C","sourcesContent":["import JPEG from 'jpeg-js';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/jpeg';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] },\n\n constants: {\n MIME_JPEG: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode\n },\n\n encoders: {\n [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, 'n must be a number 0 - 100', cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","class","quality","n","cb","throwError","call","Math","round","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import JPEG from \"jpeg-js\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/jpeg\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"jpeg\", \"jpg\", \"jpe\"] },\n\n constants: {\n MIME_JPEG: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode,\n },\n\n encoders: {\n [MIME_TYPE]: (image) => JPEG.encode(image.bitmap, image._quality).data,\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, \"n must be a number 0 - 100\", cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAAwD;AAExD,MAAMA,SAAS,GAAG,YAAY;AAAC,eAEhB,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK;EAAE,CAAC;EAE7CE,SAAS,EAAE;IACTC,SAAS,EAAEH;EACb,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAGK,eAAI,CAACC;EACpB,CAAC;EAEDC,QAAQ,EAAE;IACR,CAACP,SAAS,GAAIQ,KAAK,IAAKH,eAAI,CAACI,MAAM,CAACD,KAAK,CAACE,MAAM,EAAEF,KAAK,CAACG,QAAQ,CAAC,CAACC;EACpE,CAAC;EAEDC,KAAK,EAAE;IACL;IACAF,QAAQ,EAAE,GAAG;IACb;AACJ;AACA;AACA;AACA;AACA;IACIG,OAAO,CAACC,CAAC,EAAEC,EAAE,EAAE;MACb,IAAI,OAAOD,CAAC,KAAK,QAAQ,EAAE;QACzB,OAAOE,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAEF,EAAE,CAAC;MACxD;MAEA,IAAID,CAAC,GAAG,CAAC,IAAIA,CAAC,GAAG,GAAG,EAAE;QACpB,OAAOE,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,4BAA4B,EAAEF,EAAE,CAAC;MAChE;MAEA,IAAI,CAACL,QAAQ,GAAGQ,IAAI,CAACC,KAAK,CAACL,CAAC,CAAC;MAE7B,IAAI,IAAAM,oBAAa,EAACL,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/jpeg/es/index.js b/project starter code/node_modules/@jimp/jpeg/es/index.js
index cb33e15c..f081884b 100644
--- a/project starter code/node_modules/@jimp/jpeg/es/index.js
+++ b/project starter code/node_modules/@jimp/jpeg/es/index.js
@@ -1,60 +1,41 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _jpegJs = _interopRequireDefault(require("jpeg-js"));
-
-var _utils = require("@jimp/utils");
-
-var MIME_TYPE = 'image/jpeg';
-
-var _default = function _default() {
- return {
- mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['jpeg', 'jpg', 'jpe']),
- constants: {
- MIME_JPEG: MIME_TYPE
- },
- decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode),
- encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) {
- return _jpegJs["default"].encode(image.bitmap, image._quality).data;
- }),
- "class": {
- // The quality to be used when saving JPEG images
- _quality: 100,
-
- /**
- * Sets the quality of the image when saving as JPEG format (default is 100)
- * @param {number} n The quality to use 0-100
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- quality: function quality(n, cb) {
- if (typeof n !== 'number') {
- return _utils.throwError.call(this, 'n must be a number', cb);
- }
-
- if (n < 0 || n > 100) {
- return _utils.throwError.call(this, 'n must be a number 0 - 100', cb);
- }
-
- this._quality = Math.round(n);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+import JPEG from "jpeg-js";
+import { throwError, isNodePattern } from "@jimp/utils";
+const MIME_TYPE = "image/jpeg";
+export default (() => ({
+ mime: {
+ [MIME_TYPE]: ["jpeg", "jpg", "jpe"]
+ },
+ constants: {
+ MIME_JPEG: MIME_TYPE
+ },
+ decoders: {
+ [MIME_TYPE]: JPEG.decode
+ },
+ encoders: {
+ [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data
+ },
+ class: {
+ // The quality to be used when saving JPEG images
+ _quality: 100,
+ /**
+ * Sets the quality of the image when saving as JPEG format (default is 100)
+ * @param {number} n The quality to use 0-100
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ quality(n, cb) {
+ if (typeof n !== "number") {
+ return throwError.call(this, "n must be a number", cb);
}
+ if (n < 0 || n > 100) {
+ return throwError.call(this, "n must be a number 0 - 100", cb);
+ }
+ this._quality = Math.round(n);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
}
- };
-};
-
-exports["default"] = _default;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/jpeg/es/index.js.map b/project starter code/node_modules/@jimp/jpeg/es/index.js.map
index e8af597e..f621d691 100644
--- a/project starter code/node_modules/@jimp/jpeg/es/index.js.map
+++ b/project starter code/node_modules/@jimp/jpeg/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","quality","n","cb","throwError","call","Math","round"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,EAAgB,KAAhB,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACOK,mBAAKC,MADZ,CAPY;AAWpBC,IAAAA,QAAQ,uCACLP,SADK,EACO,UAAAQ,KAAK;AAAA,aAAIH,mBAAKI,MAAL,CAAYD,KAAK,CAACE,MAAlB,EAA0BF,KAAK,CAACG,QAAhC,EAA0CC,IAA9C;AAAA,KADZ,CAXY;AAepB,aAAO;AACL;AACAD,MAAAA,QAAQ,EAAE,GAFL;;AAGL;;;;;;AAMAE,MAAAA,OATK,mBASGC,CATH,EASMC,EATN,EASU;AACb,YAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAID,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAG,GAAjB,EAAsB;AACpB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,4BAAtB,EAAoDF,EAApD,CAAP;AACD;;AAED,aAAKJ,QAAL,GAAgBO,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAhB;;AAEA,YAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzBI;AAfa,GAAP;AAAA,C","sourcesContent":["import JPEG from 'jpeg-js';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/jpeg';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] },\n\n constants: {\n MIME_JPEG: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode\n },\n\n encoders: {\n [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, 'n must be a number 0 - 100', cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["JPEG","throwError","isNodePattern","MIME_TYPE","mime","constants","MIME_JPEG","decoders","decode","encoders","image","encode","bitmap","_quality","data","class","quality","n","cb","call","Math","round"],"sources":["../src/index.js"],"sourcesContent":["import JPEG from \"jpeg-js\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/jpeg\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"jpeg\", \"jpg\", \"jpe\"] },\n\n constants: {\n MIME_JPEG: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode,\n },\n\n encoders: {\n [MIME_TYPE]: (image) => JPEG.encode(image.bitmap, image._quality).data,\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, \"n must be a number 0 - 100\", cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,SAAS;AAC1B,SAASC,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,MAAMC,SAAS,GAAG,YAAY;AAE9B,gBAAe,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK;EAAE,CAAC;EAE7CE,SAAS,EAAE;IACTC,SAAS,EAAEH;EACb,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAGH,IAAI,CAACQ;EACpB,CAAC;EAEDC,QAAQ,EAAE;IACR,CAACN,SAAS,GAAIO,KAAK,IAAKV,IAAI,CAACW,MAAM,CAACD,KAAK,CAACE,MAAM,EAAEF,KAAK,CAACG,QAAQ,CAAC,CAACC;EACpE,CAAC;EAEDC,KAAK,EAAE;IACL;IACAF,QAAQ,EAAE,GAAG;IACb;AACJ;AACA;AACA;AACA;AACA;IACIG,OAAO,CAACC,CAAC,EAAEC,EAAE,EAAE;MACb,IAAI,OAAOD,CAAC,KAAK,QAAQ,EAAE;QACzB,OAAOhB,UAAU,CAACkB,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAED,EAAE,CAAC;MACxD;MAEA,IAAID,CAAC,GAAG,CAAC,IAAIA,CAAC,GAAG,GAAG,EAAE;QACpB,OAAOhB,UAAU,CAACkB,IAAI,CAAC,IAAI,EAAE,4BAA4B,EAAED,EAAE,CAAC;MAChE;MAEA,IAAI,CAACL,QAAQ,GAAGO,IAAI,CAACC,KAAK,CAACJ,CAAC,CAAC;MAE7B,IAAIf,aAAa,CAACgB,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/jpeg/index.d.ts b/project starter code/node_modules/@jimp/jpeg/index.d.ts
index 3423874d..94b86ba2 100644
--- a/project starter code/node_modules/@jimp/jpeg/index.d.ts
+++ b/project starter code/node_modules/@jimp/jpeg/index.d.ts
@@ -1,4 +1,4 @@
-import { DecoderFn, EncoderFn, ImageCallback } from '@jimp/core';
+import { DecoderFn, EncoderFn, ImageCallback } from "@jimp/core";
interface JpegClass {
_quality: number;
@@ -6,21 +6,21 @@ interface JpegClass {
}
interface Jpeg {
- mime: { 'image/jpeg': string[] },
+ mime: { "image/jpeg": string[] };
constants: {
- MIME_JPEG: 'image/jpeg';
- }
+ MIME_JPEG: "image/jpeg";
+ };
encoders: {
- 'image/jpeg': EncoderFn
- }
+ "image/jpeg": EncoderFn;
+ };
decoders: {
- 'image/jpeg': DecoderFn
- }
+ "image/jpeg": DecoderFn;
+ };
- class: JpegClass
+ class: JpegClass;
}
-export default function(): Jpeg;
+export default function (): Jpeg;
diff --git a/project starter code/node_modules/@jimp/jpeg/package.json b/project starter code/node_modules/@jimp/jpeg/package.json
index 199b613a..f02b8b56 100644
--- a/project starter code/node_modules/@jimp/jpeg/package.json
+++ b/project starter code/node_modules/@jimp/jpeg/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/jpeg",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Default Jimp jpeg encoder/decoder.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,19 +21,18 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
- "jpeg-js": "^0.4.2"
+ "@jimp/utils": "^0.22.12",
+ "jpeg-js": "^0.4.4"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/jpeg/src/index.js b/project starter code/node_modules/@jimp/jpeg/src/index.js
index a746a78b..489c8220 100644
--- a/project starter code/node_modules/@jimp/jpeg/src/index.js
+++ b/project starter code/node_modules/@jimp/jpeg/src/index.js
@@ -1,21 +1,21 @@
-import JPEG from 'jpeg-js';
-import { throwError, isNodePattern } from '@jimp/utils';
+import JPEG from "jpeg-js";
+import { throwError, isNodePattern } from "@jimp/utils";
-const MIME_TYPE = 'image/jpeg';
+const MIME_TYPE = "image/jpeg";
export default () => ({
- mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] },
+ mime: { [MIME_TYPE]: ["jpeg", "jpg", "jpe"] },
constants: {
- MIME_JPEG: MIME_TYPE
+ MIME_JPEG: MIME_TYPE,
},
decoders: {
- [MIME_TYPE]: JPEG.decode
+ [MIME_TYPE]: JPEG.decode,
},
encoders: {
- [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data
+ [MIME_TYPE]: (image) => JPEG.encode(image.bitmap, image._quality).data,
},
class: {
@@ -28,12 +28,12 @@ export default () => ({
* @returns {Jimp} this for chaining of methods
*/
quality(n, cb) {
- if (typeof n !== 'number') {
- return throwError.call(this, 'n must be a number', cb);
+ if (typeof n !== "number") {
+ return throwError.call(this, "n must be a number", cb);
}
if (n < 0 || n > 100) {
- return throwError.call(this, 'n must be a number 0 - 100', cb);
+ return throwError.call(this, "n must be a number 0 - 100", cb);
}
this._quality = Math.round(n);
@@ -43,6 +43,6 @@ export default () => ({
}
return this;
- }
- }
+ },
+ },
});
diff --git a/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js b/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js
index 480e8a1d..5abf22d8 100644
--- a/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js
+++ b/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js
@@ -1,48 +1,42 @@
-import { Jimp, getTestDir } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, getTestDir } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import expect from "@storybook/expect";
-import jpeg from '../src';
+import jpeg from "../src";
const jimp = configure({ types: [jpeg] }, Jimp);
-describe('JPEG', () => {
- const imagesDir = getTestDir(__dirname) + '/images';
+describe("JPEG", () => {
+ const imagesDir = getTestDir(__dirname) + "/images";
- it('load JPG', async () => {
- const image = await jimp.read(imagesDir + '/cops.jpg');
+ it("load JPG", async () => {
+ const image = await jimp.read(imagesDir + "/cops.jpg");
- image.getPixelColor(10, 10).should.be.equal(0x3f4a02ff);
- image.getPixelColor(220, 190).should.be.equal(0x5d94b6ff);
- image.getPixelColor(350, 130).should.be.equal(0xdf7944ff);
+ expect(image.getPixelColor(10, 10)).toBe(0x3f4a02ff);
+ expect(image.getPixelColor(220, 190)).toBe(0x5d94b6ff);
+ expect(image.getPixelColor(350, 130)).toBe(0xdf7944ff);
});
- it('load JPG with fill bytes', async () => {
- const image = await jimp.read(imagesDir + '/fillbytes.jpg');
+ it("load JPG with fill bytes", async () => {
+ const image = await jimp.read(imagesDir + "/fillbytes.jpg");
- image.getPixelColor(10, 10).should.be.equal(0xaeb8c3ff);
- image.getPixelColor(220, 190).should.be.equal(0x262b21ff);
- image.getPixelColor(350, 130).should.be.equal(0x4e5d30ff);
+ expect(image.getPixelColor(10, 10)).toBe(0xaeb8c3ff);
+ expect(image.getPixelColor(220, 190)).toBe(0x262b21ff);
+ expect(image.getPixelColor(350, 130)).toBe(0x4e5d30ff);
});
- it('export JPG', async () => {
+ it("export JPG", async () => {
const image = await jimp.read({
width: 3,
height: 3,
data: [
- 0xff0000ff,
- 0xff0080ff,
- 0xff00ffff,
- 0xff0080ff,
- 0xff00ffff,
- 0x8000ffff,
- 0xff00ffff,
- 0x8000ffff,
- 0x0000ffff
- ]
+ 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
+ 0xff00ffff, 0x8000ffff, 0x0000ffff,
+ ],
});
image.quality(50);
- const buffer = await image.getBufferAsync('image/jpeg');
+ const buffer = await image.getBufferAsync("image/jpeg");
- buffer.toString().should.match(/^.{3,9}JFIF\u0000/);
+ expect(buffer.toString()).toMatch(/^.{3,9}JFIF\u0000/);
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md
index 26394e0f..e2a54ff2 100644
--- a/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md
@@ -1,3 +1,66 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +75,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +83,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-blit/README.md b/project starter code/node_modules/@jimp/plugin-blit/README.md
index e7e7ee49..7ceb4815 100644
--- a/project starter code/node_modules/@jimp/plugin-blit/README.md
+++ b/project starter code/node_modules/@jimp/plugin-blit/README.md
@@ -21,11 +21,11 @@ Blits a source image on to this image
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
- const parrot = await jimp.read('test/party-parrot.png');
+ const image = await jimp.read("test/image.png");
+ const parrot = await jimp.read("test/party-parrot.png");
image.blit(parrot, x, y);
}
diff --git a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js b/project starter code/node_modules/@jimp/plugin-blit/dist/index.js
index 55717769..4eb1b67d 100644
--- a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-blit/dist/index.js
@@ -1,99 +1,87 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
+var _default = () => ({
+ /**
+ * Blits a source image on to this image
+ * @param {Jimp} src the source Jimp instance
+ * @param {number} x the x position to blit the image
+ * @param {number} y the y position to blit the image
+ * @param {number} srcx (optional) the x position from which to crop the source image
+ * @param {number} srcy (optional) the y position from which to crop the source image
+ * @param {number} srcw (optional) the width to which to crop the source image
+ * @param {number} srch (optional) the height to which to crop the source image
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ blit(src, x, y, srcx, srcy, srcw, srch, cb) {
+ if (!(src instanceof this.constructor)) {
+ return _utils.throwError.call(this, "The source must be a Jimp image", cb);
+ }
+ if (typeof x !== "number" || typeof y !== "number") {
+ return _utils.throwError.call(this, "x and y must be numbers", cb);
+ }
+ if (typeof srcx === "function") {
+ cb = srcx;
+ srcx = 0;
+ srcy = 0;
+ srcw = src.bitmap.width;
+ srch = src.bitmap.height;
+ } else if (typeof srcx === typeof srcy && typeof srcy === typeof srcw && typeof srcw === typeof srch) {
+ srcx = srcx || 0;
+ srcy = srcy || 0;
+ srcw = srcw || src.bitmap.width;
+ srch = srch || src.bitmap.height;
+ } else {
+ return _utils.throwError.call(this, "srcx, srcy, srcw, srch must be numbers", cb);
+ }
-var _default = function _default() {
- return {
- /**
- * Blits a source image on to this image
- * @param {Jimp} src the source Jimp instance
- * @param {number} x the x position to blit the image
- * @param {number} y the y position to blit the image
- * @param {number} srcx (optional) the x position from which to crop the source image
- * @param {number} srcy (optional) the y position from which to crop the source image
- * @param {number} srcw (optional) the width to which to crop the source image
- * @param {number} srch (optional) the height to which to crop the source image
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- blit: function blit(src, x, y, srcx, srcy, srcw, srch, cb) {
- if (!(src instanceof this.constructor)) {
- return _utils.throwError.call(this, 'The source must be a Jimp image', cb);
- }
-
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers', cb);
- }
-
- if (typeof srcx === 'function') {
- cb = srcx;
- srcx = 0;
- srcy = 0;
- srcw = src.bitmap.width;
- srch = src.bitmap.height;
- } else if ((0, _typeof2["default"])(srcx) === (0, _typeof2["default"])(srcy) && (0, _typeof2["default"])(srcy) === (0, _typeof2["default"])(srcw) && (0, _typeof2["default"])(srcw) === (0, _typeof2["default"])(srch)) {
- srcx = srcx || 0;
- srcy = srcy || 0;
- srcw = srcw || src.bitmap.width;
- srch = srch || src.bitmap.height;
- } else {
- return _utils.throwError.call(this, 'srcx, srcy, srcw, srch must be numbers', cb);
- } // round input
-
-
- x = Math.round(x);
- y = Math.round(y); // round input
-
- srcx = Math.round(srcx);
- srcy = Math.round(srcy);
- srcw = Math.round(srcw);
- srch = Math.round(srch);
- var maxWidth = this.bitmap.width;
- var maxHeight = this.bitmap.height;
- var baseImage = this;
- src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {
- var xOffset = x + sx - srcx;
- var yOffset = y + sy - srcy;
-
- if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) {
- var dstIdx = baseImage.getPixelIndex(xOffset, yOffset);
- var _src = {
- r: this.bitmap.data[idx],
- g: this.bitmap.data[idx + 1],
- b: this.bitmap.data[idx + 2],
- a: this.bitmap.data[idx + 3]
- };
- var dst = {
- r: baseImage.bitmap.data[dstIdx],
- g: baseImage.bitmap.data[dstIdx + 1],
- b: baseImage.bitmap.data[dstIdx + 2],
- a: baseImage.bitmap.data[dstIdx + 3]
- };
- baseImage.bitmap.data[dstIdx] = (_src.a * (_src.r - dst.r) - dst.r + 255 >> 8) + dst.r;
- baseImage.bitmap.data[dstIdx + 1] = (_src.a * (_src.g - dst.g) - dst.g + 255 >> 8) + dst.g;
- baseImage.bitmap.data[dstIdx + 2] = (_src.a * (_src.b - dst.b) - dst.b + 255 >> 8) + dst.b;
- baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + _src.a);
- }
- });
+ // round input
+ x = Math.round(x);
+ y = Math.round(y);
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ // round input
+ srcx = Math.round(srcx);
+ srcy = Math.round(srcy);
+ srcw = Math.round(srcw);
+ srch = Math.round(srch);
+ const maxWidth = this.bitmap.width;
+ const maxHeight = this.bitmap.height;
+ const baseImage = this;
+ src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {
+ const xOffset = x + sx - srcx;
+ const yOffset = y + sy - srcy;
+ if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) {
+ const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);
+ const src = {
+ r: this.bitmap.data[idx],
+ g: this.bitmap.data[idx + 1],
+ b: this.bitmap.data[idx + 2],
+ a: this.bitmap.data[idx + 3]
+ };
+ const dst = {
+ r: baseImage.bitmap.data[dstIdx],
+ g: baseImage.bitmap.data[dstIdx + 1],
+ b: baseImage.bitmap.data[dstIdx + 2],
+ a: baseImage.bitmap.data[dstIdx + 3]
+ };
+ baseImage.bitmap.data[dstIdx] = (src.a * (src.r - dst.r) - dst.r + 255 >> 8) + dst.r;
+ baseImage.bitmap.data[dstIdx + 1] = (src.a * (src.g - dst.g) - dst.g + 255 >> 8) + dst.g;
+ baseImage.bitmap.data[dstIdx + 2] = (src.a * (src.b - dst.b) - dst.b + 255 >> 8) + dst.b;
+ baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + src.a);
}
-
- return this;
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map
index 0c3d69b7..ebfe5554 100644
--- a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","throwError","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx","sy","idx","xOffset","yOffset","dstIdx","getPixelIndex","r","data","g","b","a","dst","limit255"],"mappings":";;;;;;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;;;;;;AAYAA,IAAAA,IAboB,gBAafC,GAbe,EAaVC,CAbU,EAaPC,CAbO,EAaJC,IAbI,EAaEC,IAbF,EAaQC,IAbR,EAacC,IAbd,EAaoBC,EAbpB,EAawB;AAC1C,UAAI,EAAEP,GAAG,YAAY,KAAKQ,WAAtB,CAAJ,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAON,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOO,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAED,UAAI,OAAOJ,IAAP,KAAgB,UAApB,EAAgC;AAC9BI,QAAAA,EAAE,GAAGJ,IAAL;AACAA,QAAAA,IAAI,GAAG,CAAP;AACAC,QAAAA,IAAI,GAAG,CAAP;AACAC,QAAAA,IAAI,GAAGL,GAAG,CAACW,MAAJ,CAAWC,KAAlB;AACAN,QAAAA,IAAI,GAAGN,GAAG,CAACW,MAAJ,CAAWE,MAAlB;AACD,OAND,MAMO,IACL,yBAAOV,IAAP,+BAAuBC,IAAvB,KACA,yBAAOA,IAAP,+BAAuBC,IAAvB,CADA,IAEA,yBAAOA,IAAP,+BAAuBC,IAAvB,CAHK,EAIL;AACAH,QAAAA,IAAI,GAAGA,IAAI,IAAI,CAAf;AACAC,QAAAA,IAAI,GAAGA,IAAI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AG,CAAC6B,CAAJ,GAAQG,GAAG,CAACH,CAArB,IAA0BG,GAAG,CAACH,CAA9B,GAAkC,GAAnC,IAA2C,CAA5C,IAAiDG,GAAG,CAACH,CADvD;AAEAX,UAAAA,SAAS,CAACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAM,GAAG,CAA/B,IACE,CAAEzB,IAAG,CAAC+B,CAAJ,IAAS/B,IAAG,CAAC8B,CAAJ,GAAQE,GAAG,CAACF,CAArB,IAA0BE,GAAG,CAACF,CAA9B,GAAkC,GAAnC,IAA2C,CAA5C,IAAiDE,GAAG,CAACF,CADvD;AAEAZ,UAAAA,SAAS,CAACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAM,GAAG,CAA/B,IAAoC,KAAKjB,WAAL,CAAiByB,QAAjB,CAClCD,GAAG,CAACD,CAAJ,GAAQ/B,IAAG,CAAC+B,CADsB,CAApC;AAGD;AACF,OAnCD;;AAqCA,UAAI,0BAAcxB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AArGmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof srcx === 'function') {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n 'srcx, srcy, srcw, srch must be numbers',\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function(sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3]\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3]\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","throwError","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx","sy","idx","xOffset","yOffset","dstIdx","getPixelIndex","r","data","g","b","a","dst","limit255","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n if (typeof srcx === \"function\") {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n \"srcx, srcy, srcw, srch must be numbers\",\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3],\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3],\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAAwD,eAEzC,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEA,IAAI,CAACC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,EAAE,EAAE;IAC1C,IAAI,EAAEP,GAAG,YAAY,IAAI,CAACQ,WAAW,CAAC,EAAE;MACtC,OAAOC,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEH,EAAE,CAAC;IACrE;IAEA,IAAI,OAAON,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOO,iBAAU,CAACC,IAA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AEzB,GAAG,CAAC+B,CAAC,IAAI/B,GAAG,CAAC2B,CAAC,GAAGK,GAAG,CAACL,CAAC,CAAC,GAAGK,GAAG,CAACL,CAAC,GAAG,GAAG,IAAK,CAAC,IAAIK,GAAG,CAACL,CAAC;QACxDT,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAC/B,CAAEzB,GAAG,CAAC+B,CAAC,IAAI/B,GAAG,CAAC6B,CAAC,GAAGG,GAAG,CAACH,CAAC,CAAC,GAAGG,GAAG,CAACH,CAAC,GAAG,GAAG,IAAK,CAAC,IAAIG,GAAG,CAACH,CAAC;QACxDX,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAC/B,CAAEzB,GAAG,CAAC+B,CAAC,IAAI/B,GAAG,CAAC8B,CAAC,GAAGE,GAAG,CAACF,CAAC,CAAC,GAAGE,GAAG,CAACF,CAAC,GAAG,GAAG,IAAK,CAAC,IAAIE,GAAG,CAACF,CAAC;QACxDZ,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAACjB,WAAW,CAACyB,QAAQ,CAC3DD,GAAG,CAACD,CAAC,GAAG/B,GAAG,CAAC+B,CAAC,CACd;MACH;IACF,CAAC,CAAC;IAEF,IAAI,IAAAG,oBAAa,EAAC3B,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blit/es/index.js b/project starter code/node_modules/@jimp/plugin-blit/es/index.js
index 0a6f8acf..a6b8134b 100644
--- a/project starter code/node_modules/@jimp/plugin-blit/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-blit/es/index.js
@@ -1,98 +1,78 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
-
-var _utils = require("@jimp/utils");
-
-var _default = function _default() {
- return {
- /**
- * Blits a source image on to this image
- * @param {Jimp} src the source Jimp instance
- * @param {number} x the x position to blit the image
- * @param {number} y the y position to blit the image
- * @param {number} srcx (optional) the x position from which to crop the source image
- * @param {number} srcy (optional) the y position from which to crop the source image
- * @param {number} srcw (optional) the width to which to crop the source image
- * @param {number} srch (optional) the height to which to crop the source image
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- blit: function blit(src, x, y, srcx, srcy, srcw, srch, cb) {
- if (!(src instanceof this.constructor)) {
- return _utils.throwError.call(this, 'The source must be a Jimp image', cb);
- }
-
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers', cb);
- }
-
- if (typeof srcx === 'function') {
- cb = srcx;
- srcx = 0;
- srcy = 0;
- srcw = src.bitmap.width;
- srch = src.bitmap.height;
- } else if ((0, _typeof2["default"])(srcx) === (0, _typeof2["default"])(srcy) && (0, _typeof2["default"])(srcy) === (0, _typeof2["default"])(srcw) && (0, _typeof2["default"])(srcw) === (0, _typeof2["default"])(srch)) {
- srcx = srcx || 0;
- srcy = srcy || 0;
- srcw = srcw || src.bitmap.width;
- srch = srch || src.bitmap.height;
- } else {
- return _utils.throwError.call(this, 'srcx, srcy, srcw, srch must be numbers', cb);
- } // round input
-
-
- x = Math.round(x);
- y = Math.round(y); // round input
-
- srcx = Math.round(srcx);
- srcy = Math.round(srcy);
- srcw = Math.round(srcw);
- srch = Math.round(srch);
- var maxWidth = this.bitmap.width;
- var maxHeight = this.bitmap.height;
- var baseImage = this;
- src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {
- var xOffset = x + sx - srcx;
- var yOffset = y + sy - srcy;
+import { throwError, isNodePattern } from "@jimp/utils";
+export default (() => ({
+ /**
+ * Blits a source image on to this image
+ * @param {Jimp} src the source Jimp instance
+ * @param {number} x the x position to blit the image
+ * @param {number} y the y position to blit the image
+ * @param {number} srcx (optional) the x position from which to crop the source image
+ * @param {number} srcy (optional) the y position from which to crop the source image
+ * @param {number} srcw (optional) the width to which to crop the source image
+ * @param {number} srch (optional) the height to which to crop the source image
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ blit(src, x, y, srcx, srcy, srcw, srch, cb) {
+ if (!(src instanceof this.constructor)) {
+ return throwError.call(this, "The source must be a Jimp image", cb);
+ }
+ if (typeof x !== "number" || typeof y !== "number") {
+ return throwError.call(this, "x and y must be numbers", cb);
+ }
+ if (typeof srcx === "function") {
+ cb = srcx;
+ srcx = 0;
+ srcy = 0;
+ srcw = src.bitmap.width;
+ srch = src.bitmap.height;
+ } else if (typeof srcx === typeof srcy && typeof srcy === typeof srcw && typeof srcw === typeof srch) {
+ srcx = srcx || 0;
+ srcy = srcy || 0;
+ srcw = srcw || src.bitmap.width;
+ srch = srch || src.bitmap.height;
+ } else {
+ return throwError.call(this, "srcx, srcy, srcw, srch must be numbers", cb);
+ }
- if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) {
- var dstIdx = baseImage.getPixelIndex(xOffset, yOffset);
- var _src = {
- r: this.bitmap.data[idx],
- g: this.bitmap.data[idx + 1],
- b: this.bitmap.data[idx + 2],
- a: this.bitmap.data[idx + 3]
- };
- var dst = {
- r: baseImage.bitmap.data[dstIdx],
- g: baseImage.bitmap.data[dstIdx + 1],
- b: baseImage.bitmap.data[dstIdx + 2],
- a: baseImage.bitmap.data[dstIdx + 3]
- };
- baseImage.bitmap.data[dstIdx] = (_src.a * (_src.r - dst.r) - dst.r + 255 >> 8) + dst.r;
- baseImage.bitmap.data[dstIdx + 1] = (_src.a * (_src.g - dst.g) - dst.g + 255 >> 8) + dst.g;
- baseImage.bitmap.data[dstIdx + 2] = (_src.a * (_src.b - dst.b) - dst.b + 255 >> 8) + dst.b;
- baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + _src.a);
- }
- });
+ // round input
+ x = Math.round(x);
+ y = Math.round(y);
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ // round input
+ srcx = Math.round(srcx);
+ srcy = Math.round(srcy);
+ srcw = Math.round(srcw);
+ srch = Math.round(srch);
+ const maxWidth = this.bitmap.width;
+ const maxHeight = this.bitmap.height;
+ const baseImage = this;
+ src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {
+ const xOffset = x + sx - srcx;
+ const yOffset = y + sy - srcy;
+ if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) {
+ const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);
+ const src = {
+ r: this.bitmap.data[idx],
+ g: this.bitmap.data[idx + 1],
+ b: this.bitmap.data[idx + 2],
+ a: this.bitmap.data[idx + 3]
+ };
+ const dst = {
+ r: baseImage.bitmap.data[dstIdx],
+ g: baseImage.bitmap.data[dstIdx + 1],
+ b: baseImage.bitmap.data[dstIdx + 2],
+ a: baseImage.bitmap.data[dstIdx + 3]
+ };
+ baseImage.bitmap.data[dstIdx] = (src.a * (src.r - dst.r) - dst.r + 255 >> 8) + dst.r;
+ baseImage.bitmap.data[dstIdx + 1] = (src.a * (src.g - dst.g) - dst.g + 255 >> 8) + dst.g;
+ baseImage.bitmap.data[dstIdx + 2] = (src.a * (src.b - dst.b) - dst.b + 255 >> 8) + dst.b;
+ baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + src.a);
}
-
- return this;
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map b/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map
index 0c3d69b7..43f3277c 100644
--- a/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","throwError","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx","sy","idx","xOffset","yOffset","dstIdx","getPixelIndex","r","data","g","b","a","dst","limit255"],"mappings":";;;;;;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;;;;;;AAYAA,IAAAA,IAboB,gBAafC,GAbe,EAaVC,CAbU,EAaPC,CAbO,EAaJC,IAbI,EAaEC,IAbF,EAaQC,IAbR,EAacC,IAbd,EAaoBC,EAbpB,EAawB;AAC1C,UAAI,EAAEP,GAAG,YAAY,KAAKQ,WAAtB,CAAJ,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAON,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOO,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAED,UAAI,OAAOJ,IAAP,KAAgB,UAApB,EAAgC;AAC9BI,QAAAA,EAAE,GAAGJ,IAAL;AACAA,QAAAA,IAAI,GAAG,CAAP;AACAC,QAAAA,IAAI,GAAG,CAAP;AACAC,QAAAA,IAAI,GAAGL,GAAG,CAACW,MAAJ,CAAWC,KAAlB;AACAN,QAAAA,IAAI,GAAGN,GAAG,CAACW,MAAJ,CAAWE,MAAlB;AACD,OAND,MAMO,IACL,yBAAOV,IAAP,+BAAuBC,IAAvB,KACA,yBAAOA,IAAP,+BAAuBC,I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,CAACL,CADvD;AAEAT,UAAAA,SAAS,CAACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAM,GAAG,CAA/B,IACE,CAAEzB,IAAG,CAAC+B,CAAJ,IAAS/B,IAAG,CAAC6B,CAAJ,GAAQG,GAAG,CAACH,CAArB,IAA0BG,GAAG,CAACH,CAA9B,GAAkC,GAAnC,IAA2C,CAA5C,IAAiDG,GAAG,CAACH,CADvD;AAEAX,UAAAA,SAAS,CAACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAM,GAAG,CAA/B,IACE,CAAEzB,IAAG,CAAC+B,CAAJ,IAAS/B,IAAG,CAAC8B,CAAJ,GAAQE,GAAG,CAACF,CAArB,IAA0BE,GAAG,CAACF,CAA9B,GAAkC,GAAnC,IAA2C,CAA5C,IAAiDE,GAAG,CAACF,CADvD;AAEAZ,UAAAA,SAAS,CAACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAM,GAAG,CAA/B,IAAoC,KAAKjB,WAAL,CAAiByB,QAAjB,CAClCD,GAAG,CAACD,CAAJ,GAAQ/B,IAAG,CAAC+B,CADsB,CAApC;AAGD;AACF,OAnCD;;AAqCA,UAAI,0BAAcxB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AArGmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof srcx === 'function') {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n 'srcx, srcy, srcw, srch must be numbers',\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function(sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3]\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3]\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["throwError","isNodePattern","blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx","sy","idx","xOffset","yOffset","dstIdx","getPixelIndex","r","data","g","b","a","dst","limit255"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n if (typeof srcx === \"function\") {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n \"srcx, srcy, srcw, srch must be numbers\",\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3],\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3],\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,gBAAe,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,IAAI,CAACC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,EAAE,EAAE;IAC1C,IAAI,EAAEP,GAAG,YAAY,IAAI,CAACQ,WAAW,CAAC,EAAE;MACtC,OAAOX,UAAU,CA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C,CAAC;UACpCM,CAAC,EAAEb,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC;QACrC,CAAC;QAEDP,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,CAAC,GAC3B,CAAExB,GAAG,CAAC8B,CAAC,IAAI9B,GAAG,CAAC0B,CAAC,GAAGK,GAAG,CAACL,CAAC,CAAC,GAAGK,GAAG,CAACL,CAAC,GAAG,GAAG,IAAK,CAAC,IAAIK,GAAG,CAACL,CAAC;QACxDT,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAC/B,CAAExB,GAAG,CAAC8B,CAAC,IAAI9B,GAAG,CAAC4B,CAAC,GAAGG,GAAG,CAACH,CAAC,CAAC,GAAGG,GAAG,CAACH,CAAC,GAAG,GAAG,IAAK,CAAC,IAAIG,GAAG,CAACH,CAAC;QACxDX,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAC/B,CAAExB,GAAG,CAAC8B,CAAC,IAAI9B,GAAG,CAAC6B,CAAC,GAAGE,GAAG,CAACF,CAAC,CAAC,GAAGE,GAAG,CAACF,CAAC,GAAG,GAAG,IAAK,CAAC,IAAIE,GAAG,CAACF,CAAC;QACxDZ,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAChB,WAAW,CAACwB,QAAQ,CAC3DD,GAAG,CAACD,CAAC,GAAG9B,GAAG,CAAC8B,CAAC,CACd;MACH;IACF,CAAC,CAAC;IAEF,IAAIhC,aAAa,CAACS,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blit/index.d.ts b/project starter code/node_modules/@jimp/plugin-blit/index.d.ts
index abe5ee2c..0caad70e 100644
--- a/project starter code/node_modules/@jimp/plugin-blit/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-blit/index.d.ts
@@ -1,4 +1,4 @@
-import { Jimp, ImageCallback } from '@jimp/core';
+import { Jimp, ImageCallback } from "@jimp/core";
interface Blit {
blit(src: Jimp, x: number, y: number, cb?: ImageCallback): this;
@@ -14,4 +14,4 @@ interface Blit {
): this;
}
-export default function(): Blit;
+export default function (): Blit;
diff --git a/project starter code/node_modules/@jimp/plugin-blit/package.json b/project starter code/node_modules/@jimp/plugin-blit/package.json
index 74cefc97..d349e12c 100644
--- a/project starter code/node_modules/@jimp/plugin-blit/package.json
+++ b/project starter code/node_modules/@jimp/plugin-blit/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-blit",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Blit an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,13 +21,12 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/jpeg": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/jpeg": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
@@ -34,5 +34,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-blit/src/index.js b/project starter code/node_modules/@jimp/plugin-blit/src/index.js
index 467bd314..133a5374 100644
--- a/project starter code/node_modules/@jimp/plugin-blit/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-blit/src/index.js
@@ -1,4 +1,4 @@
-import { throwError, isNodePattern } from '@jimp/utils';
+import { throwError, isNodePattern } from "@jimp/utils";
export default () => ({
/**
@@ -15,14 +15,14 @@ export default () => ({
*/
blit(src, x, y, srcx, srcy, srcw, srch, cb) {
if (!(src instanceof this.constructor)) {
- return throwError.call(this, 'The source must be a Jimp image', cb);
+ return throwError.call(this, "The source must be a Jimp image", cb);
}
- if (typeof x !== 'number' || typeof y !== 'number') {
- return throwError.call(this, 'x and y must be numbers', cb);
+ if (typeof x !== "number" || typeof y !== "number") {
+ return throwError.call(this, "x and y must be numbers", cb);
}
- if (typeof srcx === 'function') {
+ if (typeof srcx === "function") {
cb = srcx;
srcx = 0;
srcy = 0;
@@ -40,7 +40,7 @@ export default () => ({
} else {
return throwError.call(
this,
- 'srcx, srcy, srcw, srch must be numbers',
+ "srcx, srcy, srcw, srch must be numbers",
cb
);
}
@@ -59,7 +59,7 @@ export default () => ({
const maxHeight = this.bitmap.height;
const baseImage = this;
- src.scanQuiet(srcx, srcy, srcw, srch, function(sx, sy, idx) {
+ src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {
const xOffset = x + sx - srcx;
const yOffset = y + sy - srcy;
@@ -74,14 +74,14 @@ export default () => ({
r: this.bitmap.data[idx],
g: this.bitmap.data[idx + 1],
b: this.bitmap.data[idx + 2],
- a: this.bitmap.data[idx + 3]
+ a: this.bitmap.data[idx + 3],
};
const dst = {
r: baseImage.bitmap.data[dstIdx],
g: baseImage.bitmap.data[dstIdx + 1],
b: baseImage.bitmap.data[dstIdx + 2],
- a: baseImage.bitmap.data[dstIdx + 3]
+ a: baseImage.bitmap.data[dstIdx + 3],
};
baseImage.bitmap.data[dstIdx] =
@@ -101,5 +101,5 @@ export default () => ({
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js b/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js
index 94a372f7..a9b71cb0 100644
--- a/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js
+++ b/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js
@@ -1,41 +1,43 @@
-import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils';
-import jpeg from '@jimp/jpeg';
-import configure from '@jimp/custom';
+import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils";
+import jpeg from "@jimp/jpeg";
+import configure from "@jimp/custom";
+import expect from "@storybook/expect";
-import blit from '../src';
+import blit from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ types: [jpeg], plugins: [blit] }, Jimp);
const testDir = getTestDir(__dirname);
-describe('Blit over image', function() {
+describe("Blit over image", function () {
this.timeout(15000);
const targetJGD = mkJGD(
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆'
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆"
);
const srcJGD = mkJGD(
- '□□□□□□',
- '□▥▥▥▥□',
- '□▥■■▥□',
- '□▥■■▥□',
- '□▥▥▥▥□',
- '□□□□□□'
+ "□□□□□□",
+ "□▥▥▥▥□",
+ "□▥■■▥□",
+ "□▥■■▥□",
+ "□▥▥▥▥□",
+ "□□□□□□"
);
let targetImg;
let srcImg; // stores the Jimp instances of the JGD images above.
- before(done => {
+ before((done) => {
const img1 = jimp.read(targetJGD);
const img2 = jimp.read(srcJGD);
Promise.all([img1, img2])
- .then(images => {
+ .then((images) => {
targetImg = images[0];
srcImg = images[1];
done();
@@ -43,136 +45,116 @@ describe('Blit over image', function() {
.catch(done);
});
- it('blit on top, with no crop', () => {
- targetImg
- .clone()
- .blit(srcImg, 0, 0)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '□□□□□□▸▸',
- '□▥▥▥▥□▸▸',
- '□▥■■▥□▸▸',
- '□▥■■▥□▸▸',
- '□▥▥▥▥□◆◆',
- '□□□□□□◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆'
- )
- );
+ it("blit on top, with no crop", () => {
+ expectToBeJGD(
+ targetImg.clone().blit(srcImg, 0, 0).getJGDSync(),
+ mkJGD(
+ "□□□□□□▸▸",
+ "□▥▥▥▥□▸▸",
+ "□▥■■▥□▸▸",
+ "□▥■■▥□▸▸",
+ "□▥▥▥▥□◆◆",
+ "□□□□□□◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆"
+ )
+ );
});
- it('blit on middle, with no crop', () => {
- targetImg
- .clone()
- .blit(srcImg, 1, 1)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '▴▴▴▴▸▸▸▸',
- '▴□□□□□□▸',
- '▴□▥▥▥▥□▸',
- '▴□▥■■▥□▸',
- '▾□▥■■▥□◆',
- '▾□▥▥▥▥□◆',
- '▾□□□□□□◆',
- '▾▾▾▾◆◆◆◆'
- )
- );
+ it("blit on middle, with no crop", () => {
+ expectToBeJGD(
+ targetImg.clone().blit(srcImg, 1, 1).getJGDSync(),
+ mkJGD(
+ "▴▴▴▴▸▸▸▸",
+ "▴□□□□□□▸",
+ "▴□▥▥▥▥□▸",
+ "▴□▥■■▥□▸",
+ "▾□▥■■▥□◆",
+ "▾□▥▥▥▥□◆",
+ "▾□□□□□□◆",
+ "▾▾▾▾◆◆◆◆"
+ )
+ );
});
- it('blit on middle, with x,y crop', () => {
- targetImg
- .clone()
- .blit(srcImg, 2, 2, 1, 1, 5, 5)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▥▥▥▥□▸',
- '▴▴▥■■▥□▸',
- '▾▾▥■■▥□◆',
- '▾▾▥▥▥▥□◆',
- '▾▾□□□□□◆',
- '▾▾▾▾◆◆◆◆'
- )
- );
+ it("blit on middle, with x,y crop", () => {
+ expectToBeJGD(
+ targetImg.clone().blit(srcImg, 2, 2, 1, 1, 5, 5).getJGDSync(),
+ mkJGD(
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▥▥▥▥□▸",
+ "▴▴▥■■▥□▸",
+ "▾▾▥■■▥□◆",
+ "▾▾▥▥▥▥□◆",
+ "▾▾□□□□□◆",
+ "▾▾▾▾◆◆◆◆"
+ )
+ );
});
- it('blit on middle, with x,y,w,h crop', () => {
- targetImg
- .clone()
- .blit(srcImg, 2, 2, 1, 1, 4, 4)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▥▥▥▥▸▸',
- '▴▴▥■■▥▸▸',
- '▾▾▥■■▥◆◆',
- '▾▾▥▥▥▥◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆'
- )
- );
+ it("blit on middle, with x,y,w,h crop", () => {
+ expectToBeJGD(
+ targetImg.clone().blit(srcImg, 2, 2, 1, 1, 4, 4).getJGDSync(),
+ mkJGD(
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▥▥▥▥▸▸",
+ "▴▴▥■■▥▸▸",
+ "▾▾▥■■▥◆◆",
+ "▾▾▥▥▥▥◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆"
+ )
+ );
});
- it('blit partially out, on top-left', () => {
- targetImg
- .clone()
- .blit(srcImg, -1, -1)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '▥▥▥▥□▸▸▸',
- '▥■■▥□▸▸▸',
- '▥■■▥□▸▸▸',
- '▥▥▥▥□▸▸▸',
- '□□□□□◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆'
- )
- );
+ it("blit partially out, on top-left", () => {
+ expectToBeJGD(
+ targetImg.clone().blit(srcImg, -1, -1).getJGDSync(),
+ mkJGD(
+ "▥▥▥▥□▸▸▸",
+ "▥■■▥□▸▸▸",
+ "▥■■▥□▸▸▸",
+ "▥▥▥▥□▸▸▸",
+ "□□□□□◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆"
+ )
+ );
});
- it('blit partially out, on bottom-right', () => {
- targetImg
- .clone()
- .blit(srcImg, 3, 3)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴□□□□□',
- '▾▾▾□▥▥▥▥',
- '▾▾▾□▥■■▥',
- '▾▾▾□▥■■▥',
- '▾▾▾□▥▥▥▥'
- )
- );
+ it("blit partially out, on bottom-right", () => {
+ expectToBeJGD(
+ targetImg.clone().blit(srcImg, 3, 3).getJGDSync(),
+ mkJGD(
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴□□□□□",
+ "▾▾▾□▥▥▥▥",
+ "▾▾▾□▥■■▥",
+ "▾▾▾□▥■■▥",
+ "▾▾▾□▥▥▥▥"
+ )
+ );
});
- it('blit alpha', async () => {
- const expectedImg = await Jimp.read(testDir + '/images/blit-alpha.png');
- const dice = await Jimp.read(testDir + '/images/dice.png');
- const image = await Jimp.read(testDir + '/images/cops.jpg');
+ it("blit alpha", async () => {
+ const expectedImg = await Jimp.read(testDir + "/images/blit-alpha.png");
+ const dice = await Jimp.read(testDir + "/images/dice.png");
+ const image = await Jimp.read(testDir + "/images/cops.jpg");
- image
- .blit(dice, 0, 0)
- .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(image.blit(dice, 0, 0).bitmap.data).toEqual(expectedImg.bitmap.data);
});
async function createCat(catNum, len) {
- let imgHeight = 60;
+ const imgHeight = 60;
- const butt = await Jimp.read(testDir + '/images/cat_butt.png');
- const head = await Jimp.read(testDir + '/images/cat_head.png');
- const fuzz = await Jimp.read(testDir + '/images/cat_fuzz.png');
+ const butt = await Jimp.read(testDir + "/images/cat_butt.png");
+ const head = await Jimp.read(testDir + "/images/cat_head.png");
+ const fuzz = await Jimp.read(testDir + "/images/cat_fuzz.png");
let longCat = len;
longCat = longCat > 20 ? 20 : longCat;
@@ -213,23 +195,24 @@ describe('Blit over image', function() {
return newImage;
}
- it('uses src params correctly', async () => {
+ it("uses src params correctly", async () => {
const expectedSmall = await Jimp.read(
- testDir + '/images/cat-results/small-cat.png'
+ testDir + "/images/cat-results/small-cat.png"
);
const small = await createCat(0.3, 1);
- small.bitmap.data.should.be.deepEqual(expectedSmall.bitmap.data);
+
+ expect(small.bitmap.data).toEqual(expectedSmall.bitmap.data);
const expectedMedium = await Jimp.read(
- testDir + '/images/cat-results/medium-cat.png'
+ testDir + "/images/cat-results/medium-cat.png"
);
const medium = await createCat(0.6, 7);
- medium.bitmap.data.should.be.deepEqual(expectedMedium.bitmap.data);
+ expect(medium.bitmap.data).toEqual(expectedMedium.bitmap.data);
const expectedLarge = await Jimp.read(
- testDir + '/images/cat-results/large-cat.png'
+ testDir + "/images/cat-results/large-cat.png"
);
const large = await createCat(0.9, 20);
- large.bitmap.data.should.be.deepEqual(expectedLarge.bitmap.data);
+ expect(large.bitmap.data).toEqual(expectedLarge.bitmap.data);
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md
index 26394e0f..8d029143 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md
@@ -1,3 +1,51 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +60,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +68,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-blur/README.md b/project starter code/node_modules/@jimp/plugin-blur/README.md
index e0d47697..caa71583 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/README.md
+++ b/project starter code/node_modules/@jimp/plugin-blur/README.md
@@ -13,10 +13,10 @@ A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.blur(5);
}
diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js b/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js
index 6d31ea19..28393a6e 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js
+++ b/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.shgTable = exports.mulTable = void 0;
-var mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1];
+const mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1];
exports.mulTable = mulTable;
-var shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18];
+const shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18];
exports.shgTable = shgTable;
//# sourceMappingURL=blur-tables.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map b/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map
index 629f0a0f..484c6e19 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map
+++ b/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/blur-tables.js"],"names":["mulTable","shgTable"],"mappings":";;;;;;AAAO,IAAMA,QAAQ,GAAG,CACtB,CADsB,EAEtB,EAFsB,EAGtB,EAHsB,EAItB,EAJsB,EAKtB,GALsB,EAMtB,EANsB,EAOtB,EAPsB,EAQtB,EARsB,EAStB,GATsB,EAUtB,EAVsB,EAWtB,GAXsB,EAYtB,EAZsB,EAatB,GAbsB,EActB,EAdsB,EAetB,EAfsB,EAgBtB,GAhBsB,EAiBtB,GAjBsB,EAkBtB,GAlBsB,EAmBtB,CAnBsB,EAoBtB,GApBsB,EAqBtB,EArBsB,EAsBtB,EAtBsB,EAuBtB,EAvBsB,EAwBtB,GAxBsB,EAyBtB,GAzBsB,EA0BtB,GA1BsB,EA2BtB,GA3BsB,EA4BtB,EA5BsB,EA6BtB,EA7BsB,EA8BtB,GA9BsB,EA+BtB,GA/BsB,EAgCtB,GAhCsB,EAiCtB,GAjCsB,EAkCtB,GAlCsB,EAmCtB,GAnCsB,EAoCtB,GApCsB,EAqCtB,GArCsB,EAsCtB,GAtCsB,EAuCtB,GAvCsB,EAwCtB,GAxCsB,EAyCtB,CAzCsB,EA0CtB,GA1CsB,EA2CtB,EA3CsB,EA4CtB,GA5CsB,EA6CtB,GA7CsB,EA8CtB,GA9CsB,EA+CtB,GA/CsB,EAgDtB,GAhDsB,EAiDtB,GAjDsB,EAkDtB,GAlDsB,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EA+OtB,EA/OsB,EAgPtB,EAhPsB,EAiPtB,EAjPsB,EAkPtB,EAlPsB,EAmPtB,EAnPsB,EAoPtB,EApPsB,EAqPtB,EArPsB,EAsPtB,EAtPsB,EAuPtB,EAvPsB,EAwPtB,EAxPsB,EAyPtB,EAzPsB,EA0PtB,EA1PsB,EA2PtB,EA3PsB,EA4PtB,EA5PsB,EA6PtB,EA7PsB,EA8PtB,EA9PsB,EA+PtB,EA/PsB,EAgQtB,EAhQsB,EAiQtB,EAjQsB,CAAjB","sourcesContent":["export const mulTable = [\n 1,\n 57,\n 41,\n 21,\n 203,\n 34,\n 97,\n 73,\n 227,\n 91,\n 149,\n 62,\n 105,\n 45,\n 39,\n 137,\n 241,\n 107,\n 3,\n 173,\n 39,\n 71,\n 65,\n 238,\n 219,\n 101,\n 187,\n 87,\n 81,\n 151,\n 141,\n 133,\n 249,\n 117,\n 221,\n 209,\n 197,\n 187,\n 177,\n 169,\n 5,\n 153,\n 73,\n 139,\n 133,\n 127,\n 243,\n 233,\n 223,\n 107,\n 103,\n 99,\n 191,\n 23,\n 177,\n 171,\n 165,\n 159,\n 77,\n 149,\n 9,\n 139,\n 135,\n 131,\n 253,\n 245,\n 119,\n 231,\n 224,\n 109,\n 211,\n 103,\n 25,\n 195,\n 189,\n 23,\n 45,\n 175,\n 171,\n 83,\n 81,\n 79,\n 155,\n 151,\n 147,\n 9,\n 141,\n 137,\n 67,\n 131,\n 129,\n 251,\n 123,\n 30,\n 235,\n 115,\n 113,\n 221,\n 217,\n 53,\n 13,\n 51,\n 50,\n 49,\n 193,\n 189,\n 185,\n 91,\n 179,\n 175,\n 43,\n 169,\n 83,\n 163,\n 5,\n 79,\n 155,\n 19,\n 75,\n 147,\n 145,\n 143,\n 35,\n 69,\n 17,\n 67,\n 33,\n 65,\n 255,\n 251,\n 247,\n 243,\n 239,\n 59,\n 29,\n 229,\n 113,\n 111,\n 219,\n 27,\n 213,\n 105,\n 207,\n 51,\n 201,\n 199,\n 49,\n 193,\n 191,\n 47,\n 93,\n 183,\n 181,\n 179,\n 11,\n 87,\n 43,\n 85,\n 167,\n 165,\n 163,\n 161,\n 159,\n 157,\n 155,\n 77,\n 19,\n 75,\n 37,\n 73,\n 145,\n 143,\n 141,\n 35,\n 138,\n 137,\n 135,\n 67,\n 33,\n 131,\n 129,\n 255,\n 63,\n 250,\n 247,\n 61,\n 121,\n 239,\n 237,\n 117,\n 29,\n 229,\n 227,\n 225,\n 111,\n 55,\n 109,\n 216,\n 213,\n 211,\n 209,\n 207,\n 205,\n 203,\n 201,\n 199,\n 197,\n 195,\n 193,\n 48,\n 190,\n 47,\n 93,\n 185,\n 183,\n 181,\n 179,\n 178,\n 176,\n 175,\n 173,\n 171,\n 85,\n 21,\n 167,\n 165,\n 41,\n 163,\n 161,\n 5,\n 79,\n 157,\n 78,\n 154,\n 153,\n 19,\n 75,\n 149,\n 74,\n 147,\n 73,\n 144,\n 143,\n 71,\n 141,\n 140,\n 139,\n 137,\n 17,\n 135,\n 134,\n 133,\n 66,\n 131,\n 65,\n 129,\n 1\n];\n\nexport const shgTable = [\n 0,\n 9,\n 10,\n 10,\n 14,\n 12,\n 14,\n 14,\n 16,\n 15,\n 16,\n 15,\n 16,\n 15,\n 15,\n 17,\n 18,\n 17,\n 12,\n 18,\n 16,\n 17,\n 17,\n 19,\n 19,\n 18,\n 19,\n 18,\n 18,\n 19,\n 19,\n 19,\n 20,\n 19,\n 20,\n 20,\n 20,\n 20,\n 20,\n 20,\n 15,\n 20,\n 19,\n 20,\n 20,\n 20,\n 21,\n 21,\n 21,\n 20,\n 20,\n 20,\n 21,\n 18,\n 21,\n 21,\n 21,\n 21,\n 20,\n 21,\n 17,\n 21,\n 21,\n 21,\n 22,\n 22,\n 21,\n 22,\n 22,\n 21,\n 22,\n 21,\n 19,\n 22,\n 22,\n 19,\n 20,\n 22,\n 22,\n 21,\n 21,\n 21,\n 22,\n 22,\n 22,\n 18,\n 22,\n 22,\n 21,\n 22,\n 22,\n 23,\n 22,\n 20,\n 23,\n 22,\n 22,\n 23,\n 23,\n 21,\n 19,\n 21,\n 21,\n 21,\n 23,\n 23,\n 23,\n 22,\n 23,\n 23,\n 21,\n 23,\n 22,\n 23,\n 18,\n 22,\n 23,\n 20,\n 22,\n 23,\n 23,\n 23,\n 21,\n 22,\n 20,\n 22,\n 21,\n 22,\n 24,\n 24,\n 24,\n 24,\n 24,\n 22,\n 21,\n 24,\n 23,\n 23,\n 24,\n 21,\n 24,\n 23,\n 24,\n 22,\n 24,\n 24,\n 22,\n 24,\n 24,\n 22,\n 23,\n 24,\n 24,\n 24,\n 20,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 23,\n 21,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 22,\n 24,\n 24,\n 24,\n 23,\n 22,\n 24,\n 24,\n 25,\n 23,\n 25,\n 25,\n 23,\n 24,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 25,\n 24,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 23,\n 25,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 23,\n 25,\n 25,\n 20,\n 24,\n 25,\n 24,\n 25,\n 25,\n 22,\n 24,\n 25,\n 24,\n 25,\n 24,\n 25,\n 25,\n 24,\n 25,\n 25,\n 25,\n 25,\n 22,\n 25,\n 25,\n 25,\n 24,\n 25,\n 24,\n 25,\n 18\n];\n"],"file":"blur-tables.js"}
\ No newline at end of file
+{"version":3,"file":"blur-tables.js","names":["mulTable","shgTable"],"sources":["../src/blur-tables.js"],"sourcesContent":["export const mulTable = [\n 1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107,\n 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221,\n 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103,\n 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119,\n 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151,\n 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13,\n 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75,\n 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229,\n 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183,\n 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37,\n 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61,\n 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207,\n 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178,\n 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153,\n 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133,\n 66, 131, 65, 129, 1,\n];\n\nexport const shgTable = [\n 0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18,\n 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20,\n 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21,\n 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20,\n 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22,\n 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18,\n 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22,\n 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24,\n 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24,\n 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22,\n 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23,\n 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25,\n 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25,\n 22, 25, 25, 25, 24, 25, 24, 25, 18,\n];\n"],"mappings":";;;;;;AAAO,MAAMA,QAAQ,GAAG,CACtB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAC5E,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAC5E,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EA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EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CACnC;AAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js b/project starter code/node_modules/@jimp/plugin-blur/dist/index.js
index e522832f..e61d5ac7 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-blur/dist/index.js
@@ -3,12 +3,9 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
var _blurTables = require("./blur-tables");
-
/*
Superfast Blur (0.5)
http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js
@@ -36,147 +33,130 @@ var _blurTables = require("./blur-tables");
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
-var _default = function _default() {
- return {
- /**
- * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker
- * @param {number} r the pixel radius of the blur
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- blur: function blur(r, cb) {
- if (typeof r !== 'number') return _utils.throwError.call(this, 'r must be a number', cb);
- if (r < 1) return _utils.throwError.call(this, 'r must be greater than 0', cb);
- var rsum;
- var gsum;
- var bsum;
- var asum;
- var x;
- var y;
- var i;
- var p;
- var p1;
- var p2;
- var yp;
- var yi;
- var yw;
- var pa;
- var wm = this.bitmap.width - 1;
- var hm = this.bitmap.height - 1; // const wh = this.bitmap.width * this.bitmap.height;
-
- var rad1 = r + 1;
- var mulSum = _blurTables.mulTable[r];
- var shgSum = _blurTables.shgTable[r];
- var red = [];
- var green = [];
- var blue = [];
- var alpha = [];
- var vmin = [];
- var vmax = [];
- var iterations = 2;
-
- while (iterations-- > 0) {
- yi = 0;
- yw = 0;
-
- for (y = 0; y < this.bitmap.height; y++) {
- rsum = this.bitmap.data[yw] * rad1;
- gsum = this.bitmap.data[yw + 1] * rad1;
- bsum = this.bitmap.data[yw + 2] * rad1;
- asum = this.bitmap.data[yw + 3] * rad1;
-
- for (i = 1; i <= r; i++) {
- p = yw + ((i > wm ? wm : i) << 2);
- rsum += this.bitmap.data[p++];
- gsum += this.bitmap.data[p++];
- bsum += this.bitmap.data[p++];
- asum += this.bitmap.data[p];
- }
-
- for (x = 0; x < this.bitmap.width; x++) {
- red[yi] = rsum;
- green[yi] = gsum;
- blue[yi] = bsum;
- alpha[yi] = asum;
-
- if (y === 0) {
- vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;
- vmax[x] = (p = x - r) > 0 ? p << 2 : 0;
- }
-
- p1 = yw + vmin[x];
- p2 = yw + vmax[x];
- rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
- gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
- bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
- asum += this.bitmap.data[p1] - this.bitmap.data[p2];
- yi++;
- }
-
- yw += this.bitmap.width << 2;
+var _default = () => ({
+ /**
+ * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker
+ * @param {number} r the pixel radius of the blur
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ blur(r, cb) {
+ if (typeof r !== "number") return _utils.throwError.call(this, "r must be a number", cb);
+ if (r < 1) return _utils.throwError.call(this, "r must be greater than 0", cb);
+ let rsum;
+ let gsum;
+ let bsum;
+ let asum;
+ let x;
+ let y;
+ let i;
+ let p;
+ let p1;
+ let p2;
+ let yp;
+ let yi;
+ let yw;
+ let pa;
+ const wm = this.bitmap.width - 1;
+ const hm = this.bitmap.height - 1;
+ // const wh = this.bitmap.width * this.bitmap.height;
+ const rad1 = r + 1;
+ const mulSum = _blurTables.mulTable[r];
+ const shgSum = _blurTables.shgTable[r];
+ const red = [];
+ const green = [];
+ const blue = [];
+ const alpha = [];
+ const vmin = [];
+ const vmax = [];
+ let iterations = 2;
+ while (iterations-- > 0) {
+ yi = 0;
+ yw = 0;
+ for (y = 0; y < this.bitmap.height; y++) {
+ rsum = this.bitmap.data[yw] * rad1;
+ gsum = this.bitmap.data[yw + 1] * rad1;
+ bsum = this.bitmap.data[yw + 2] * rad1;
+ asum = this.bitmap.data[yw + 3] * rad1;
+ for (i = 1; i <= r; i++) {
+ p = yw + ((i > wm ? wm : i) << 2);
+ rsum += this.bitmap.data[p++];
+ gsum += this.bitmap.data[p++];
+ bsum += this.bitmap.data[p++];
+ asum += this.bitmap.data[p];
}
-
for (x = 0; x < this.bitmap.width; x++) {
- yp = x;
- rsum = red[yp] * rad1;
- gsum = green[yp] * rad1;
- bsum = blue[yp] * rad1;
- asum = alpha[yp] * rad1;
-
- for (i = 1; i <= r; i++) {
- yp += i > hm ? 0 : this.bitmap.width;
- rsum += red[yp];
- gsum += green[yp];
- bsum += blue[yp];
- asum += alpha[yp];
- }
-
- yi = x << 2;
-
- for (y = 0; y < this.bitmap.height; y++) {
- pa = asum * mulSum >>> shgSum;
- this.bitmap.data[yi + 3] = pa; // normalize alpha
-
- if (pa > 255) {
- this.bitmap.data[yi + 3] = 255;
- }
-
- if (pa > 0) {
- pa = 255 / pa;
- this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa;
- this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa;
- this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa;
- } else {
- this.bitmap.data[yi + 2] = 0;
- this.bitmap.data[yi + 1] = 0;
- this.bitmap.data[yi] = 0;
- }
-
- if (x === 0) {
- vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;
- vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;
- }
-
- p1 = x + vmin[y];
- p2 = x + vmax[y];
- rsum += red[p1] - red[p2];
- gsum += green[p1] - green[p2];
- bsum += blue[p1] - blue[p2];
- asum += alpha[p1] - alpha[p2];
- yi += this.bitmap.width << 2;
+ red[yi] = rsum;
+ green[yi] = gsum;
+ blue[yi] = bsum;
+ alpha[yi] = asum;
+ if (y === 0) {
+ vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;
+ vmax[x] = (p = x - r) > 0 ? p << 2 : 0;
}
+ p1 = yw + vmin[x];
+ p2 = yw + vmax[x];
+ rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
+ gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
+ bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
+ asum += this.bitmap.data[p1] - this.bitmap.data[p2];
+ yi++;
}
+ yw += this.bitmap.width << 2;
}
+ for (x = 0; x < this.bitmap.width; x++) {
+ yp = x;
+ rsum = red[yp] * rad1;
+ gsum = green[yp] * rad1;
+ bsum = blue[yp] * rad1;
+ asum = alpha[yp] * rad1;
+ for (i = 1; i <= r; i++) {
+ yp += i > hm ? 0 : this.bitmap.width;
+ rsum += red[yp];
+ gsum += green[yp];
+ bsum += blue[yp];
+ asum += alpha[yp];
+ }
+ yi = x << 2;
+ for (y = 0; y < this.bitmap.height; y++) {
+ pa = asum * mulSum >>> shgSum;
+ this.bitmap.data[yi + 3] = pa;
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ // normalize alpha
+ if (pa > 255) {
+ this.bitmap.data[yi + 3] = 255;
+ }
+ if (pa > 0) {
+ pa = 255 / pa;
+ this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa;
+ this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa;
+ this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa;
+ } else {
+ this.bitmap.data[yi + 2] = 0;
+ this.bitmap.data[yi + 1] = 0;
+ this.bitmap.data[yi] = 0;
+ }
+ if (x === 0) {
+ vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;
+ vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;
+ }
+ p1 = x + vmin[y];
+ p2 = x + vmax[y];
+ rsum += red[p1] - red[p2];
+ gsum += green[p1] - green[p2];
+ bsum += blue[p1] - blue[p2];
+ asum += alpha[p1] - alpha[p2];
+ yi += this.bitmap.width << 2;
+ }
}
-
- return this;
}
- };
-};
-
-exports["default"] = _default;
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map
index d1de6f15..7148f645 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["blur","r","cb","throwError","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","mulTable","shgSum","shgTable","red","green","blue","alpha","vmin","vmax","iterations","data"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4Be;AAAA,SAAO;AACpB;;;;;;AAMAA,IAAAA,IAPoB,gBAOfC,CAPe,EAOZC,EAPY,EAOR;AACV,UAAI,OAAOD,CAAP,KAAa,QAAjB,EACE,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACF,UAAID,CAAC,GAAG,CAAR,EAAW,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,0BAAtB,EAAkDF,EAAlD,CAAP;AAEX,UAAIG,IAAJ;AACA,UAAIC,IAAJ;AACA,UAAIC,IAAJ;AACA,UAAIC,IAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AAEA,UAAMC,EAAE,GAAG,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,CAA/B;AACA,UAAMC,EAAE,GAAG,KAAKF,MAAL,CAAYG,MAAZ,GAAqB,CAAhC,CArBU,CAsBV;;AACA,UAAMC,IAAI,GAAGvB,CAAC,GAAG,CAAjB;AAEA,UAAMwB,MAAM,GAAGC,qBAASzB,CAAT,CAAf;AACA,UAAM0B,MAAM,GAAGC,qBAAS3B,CAAT,CAAf;AAEA,UAAM4B,GAAG,GAAG,EAAZ;AACA,UAAMC,KAAK,GAAG,EAAd;AACA,UAAMC,IAAI,GAAG,EAAb;AACA,UAAMC,KAAK,GAAG,EAAd;AAEA,UAAMC,IAAI,GAAG,EAAb;AACA,UAAMC,I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KAAlC,GAA0C,CAApD;AACD;;AAEDR,YAAAA,EAAE,GAAGJ,CAAC,GAAGwB,IAAI,CAACvB,CAAD,CAAb;AACAI,YAAAA,EAAE,GAAGL,CAAC,GAAGyB,IAAI,CAACxB,CAAD,CAAb;AAEAL,YAAAA,IAAI,IAAIwB,GAAG,CAAChB,EAAD,CAAH,GAAUgB,GAAG,CAACf,EAAD,CAArB;AACAR,YAAAA,IAAI,IAAIwB,KAAK,CAACjB,EAAD,CAAL,GAAYiB,KAAK,CAAChB,EAAD,CAAzB;AACAP,YAAAA,IAAI,IAAIwB,IAAI,CAAClB,EAAD,CAAJ,GAAWkB,IAAI,CAACjB,EAAD,CAAvB;AACAN,YAAAA,IAAI,IAAIwB,KAAK,CAACnB,EAAD,CAAL,GAAYmB,KAAK,CAAClB,EAAD,CAAzB;AAEAE,YAAAA,EAAE,IAAI,KAAKI,MAAL,CAAYC,KAAZ,IAAqB,CAA3B;AACD;AACF;AACF;;AAED,UAAI,0BAAcnB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApJmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\nimport { mulTable, shgTable } from './blur-tables';\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== 'number')\n return throwError.call(this, 'r must be a number', cb);\n if (r < 1) return throwError.call(this, 'r must be greater than 0', cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["blur","r","cb","throwError","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","mulTable","shgSum","shgTable","red","green","blue","alpha","vmin","vmax","iterations","data","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\nimport { mulTable, shgTable } from \"./blur-tables\";\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== \"number\")\n return throwError.call(this, \"r must be a number\", cb);\n if (r < 1) return throwError.call(this, \"r must be greater than 0\", cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA,eA4Be,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;EACEA,IAAI,CAACC,CAAC,EAAEC,EAAE,EAAE;IACV,IAAI,OAAOD,CAAC,KAAK,QAAQ,EACvB,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MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js b/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js
index 6d31ea19..9b9b9f21 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js
+++ b/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js
@@ -1,11 +1,3 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.shgTable = exports.mulTable = void 0;
-var mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1];
-exports.mulTable = mulTable;
-var shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18];
-exports.shgTable = shgTable;
+export const mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1];
+export const shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18];
//# sourceMappingURL=blur-tables.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map b/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map
index 629f0a0f..38dcb085 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map
+++ b/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/blur-tables.js"],"names":["mulTable","shgTable"],"mappings":";;;;;;AAAO,IAAMA,QAAQ,GAAG,CACtB,CADsB,EAEtB,EAFsB,EAGtB,EAHsB,EAItB,EAJsB,EAKtB,GALsB,EAMtB,EANsB,EAOtB,EAPsB,EAQtB,EARsB,EAStB,GATsB,EAUtB,EAVsB,EAWtB,GAXsB,EAYtB,EAZsB,EAatB,GAbsB,EActB,EAdsB,EAetB,EAfsB,EAgBtB,GAhBsB,EAiBtB,GAjBsB,EAkBtB,GAlBsB,EAmBtB,CAnBsB,EAoBtB,GApBsB,EAqBtB,EArBsB,EAsBtB,EAtBsB,EAuBtB,EAvBsB,EAwBtB,GAxBsB,EAyBtB,GA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ArNsB,EAsNtB,EAtNsB,EAuNtB,EAvNsB,EAwNtB,EAxNsB,EAyNtB,EAzNsB,EA0NtB,EA1NsB,EA2NtB,EA3NsB,EA4NtB,EA5NsB,EA6NtB,EA7NsB,EA8NtB,EA9NsB,EA+NtB,EA/NsB,EAgOtB,EAhOsB,EAiOtB,EAjOsB,EAkOtB,EAlOsB,EAmOtB,EAnOsB,EAoOtB,EApOsB,EAqOtB,EArOsB,EAsOtB,EAtOsB,EAuOtB,EAvOsB,EAwOtB,EAxOsB,EAyOtB,EAzOsB,EA0OtB,EA1OsB,EA2OtB,EA3OsB,EA4OtB,EA5OsB,EA6OtB,EA7OsB,EA8OtB,EA9OsB,EA+OtB,EA/OsB,EAgPtB,EAhPsB,EAiPtB,EAjPsB,EAkPtB,EAlPsB,EAmPtB,EAnPsB,EAoPtB,EApPsB,EAqPtB,EArPsB,EAsPtB,EAtPsB,EAuPtB,EAvPsB,EAwPtB,EAxPsB,EAyPtB,EAzPsB,EA0PtB,EA1PsB,EA2PtB,EA3PsB,EA4PtB,EA5PsB,EA6PtB,EA7PsB,EA8PtB,EA9PsB,EA+PtB,EA/PsB,EAgQtB,EAhQsB,EAiQtB,EAjQsB,CAAjB","sourcesContent":["export const mulTable = [\n 1,\n 57,\n 41,\n 21,\n 203,\n 34,\n 97,\n 73,\n 227,\n 91,\n 149,\n 62,\n 105,\n 45,\n 39,\n 137,\n 241,\n 107,\n 3,\n 173,\n 39,\n 71,\n 65,\n 238,\n 219,\n 101,\n 187,\n 87,\n 81,\n 151,\n 141,\n 133,\n 249,\n 117,\n 221,\n 209,\n 197,\n 187,\n 177,\n 169,\n 5,\n 153,\n 73,\n 139,\n 133,\n 127,\n 243,\n 233,\n 223,\n 107,\n 103,\n 99,\n 191,\n 23,\n 177,\n 171,\n 165,\n 159,\n 77,\n 149,\n 9,\n 139,\n 135,\n 131,\n 253,\n 245,\n 119,\n 231,\n 224,\n 109,\n 211,\n 103,\n 25,\n 195,\n 189,\n 23,\n 45,\n 175,\n 171,\n 83,\n 81,\n 79,\n 155,\n 151,\n 147,\n 9,\n 141,\n 137,\n 67,\n 131,\n 129,\n 251,\n 123,\n 30,\n 235,\n 115,\n 113,\n 221,\n 217,\n 53,\n 13,\n 51,\n 50,\n 49,\n 193,\n 189,\n 185,\n 91,\n 179,\n 175,\n 43,\n 169,\n 83,\n 163,\n 5,\n 79,\n 155,\n 19,\n 75,\n 147,\n 145,\n 143,\n 35,\n 69,\n 17,\n 67,\n 33,\n 65,\n 255,\n 251,\n 247,\n 243,\n 239,\n 59,\n 29,\n 229,\n 113,\n 111,\n 219,\n 27,\n 213,\n 105,\n 207,\n 51,\n 201,\n 199,\n 49,\n 193,\n 191,\n 47,\n 93,\n 183,\n 181,\n 179,\n 11,\n 87,\n 43,\n 85,\n 167,\n 165,\n 163,\n 161,\n 159,\n 157,\n 155,\n 77,\n 19,\n 75,\n 37,\n 73,\n 145,\n 143,\n 141,\n 35,\n 138,\n 137,\n 135,\n 67,\n 33,\n 131,\n 129,\n 255,\n 63,\n 250,\n 247,\n 61,\n 121,\n 239,\n 237,\n 117,\n 29,\n 229,\n 227,\n 225,\n 111,\n 55,\n 109,\n 216,\n 213,\n 211,\n 209,\n 207,\n 205,\n 203,\n 201,\n 199,\n 197,\n 195,\n 193,\n 48,\n 190,\n 47,\n 93,\n 185,\n 183,\n 181,\n 179,\n 178,\n 176,\n 175,\n 173,\n 171,\n 85,\n 21,\n 167,\n 165,\n 41,\n 163,\n 161,\n 5,\n 79,\n 157,\n 78,\n 154,\n 153,\n 19,\n 75,\n 149,\n 74,\n 147,\n 73,\n 144,\n 143,\n 71,\n 141,\n 140,\n 139,\n 137,\n 17,\n 135,\n 134,\n 133,\n 66,\n 131,\n 65,\n 129,\n 1\n];\n\nexport const shgTable = [\n 0,\n 9,\n 10,\n 10,\n 14,\n 12,\n 14,\n 14,\n 16,\n 15,\n 16,\n 15,\n 16,\n 15,\n 15,\n 17,\n 18,\n 17,\n 12,\n 18,\n 16,\n 17,\n 17,\n 19,\n 19,\n 18,\n 19,\n 18,\n 18,\n 19,\n 19,\n 19,\n 20,\n 19,\n 20,\n 20,\n 20,\n 20,\n 20,\n 20,\n 15,\n 20,\n 19,\n 20,\n 20,\n 20,\n 21,\n 21,\n 21,\n 20,\n 20,\n 20,\n 21,\n 18,\n 21,\n 21,\n 21,\n 21,\n 20,\n 21,\n 17,\n 21,\n 21,\n 21,\n 22,\n 22,\n 21,\n 22,\n 22,\n 21,\n 22,\n 21,\n 19,\n 22,\n 22,\n 19,\n 20,\n 22,\n 22,\n 21,\n 21,\n 21,\n 22,\n 22,\n 22,\n 18,\n 22,\n 22,\n 21,\n 22,\n 22,\n 23,\n 22,\n 20,\n 23,\n 22,\n 22,\n 23,\n 23,\n 21,\n 19,\n 21,\n 21,\n 21,\n 23,\n 23,\n 23,\n 22,\n 23,\n 23,\n 21,\n 23,\n 22,\n 23,\n 18,\n 22,\n 23,\n 20,\n 22,\n 23,\n 23,\n 23,\n 21,\n 22,\n 20,\n 22,\n 21,\n 22,\n 24,\n 24,\n 24,\n 24,\n 24,\n 22,\n 21,\n 24,\n 23,\n 23,\n 24,\n 21,\n 24,\n 23,\n 24,\n 22,\n 24,\n 24,\n 22,\n 24,\n 24,\n 22,\n 23,\n 24,\n 24,\n 24,\n 20,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 23,\n 21,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 22,\n 24,\n 24,\n 24,\n 23,\n 22,\n 24,\n 24,\n 25,\n 23,\n 25,\n 25,\n 23,\n 24,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 25,\n 24,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 23,\n 25,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 23,\n 25,\n 25,\n 20,\n 24,\n 25,\n 24,\n 25,\n 25,\n 22,\n 24,\n 25,\n 24,\n 25,\n 24,\n 25,\n 25,\n 24,\n 25,\n 25,\n 25,\n 25,\n 22,\n 25,\n 25,\n 25,\n 24,\n 25,\n 24,\n 25,\n 18\n];\n"],"file":"blur-tables.js"}
\ No newline at end of file
+{"version":3,"file":"blur-tables.js","names":["mulTable","shgTable"],"sources":["../src/blur-tables.js"],"sourcesContent":["export const mulTable = [\n 1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107,\n 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221,\n 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103,\n 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119,\n 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151,\n 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13,\n 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75,\n 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229,\n 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183,\n 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37,\n 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61,\n 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207,\n 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178,\n 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153,\n 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133,\n 66, 131, 65, 129, 1,\n];\n\nexport const shgTable = [\n 0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18,\n 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20,\n 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21,\n 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20,\n 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22,\n 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18,\n 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22,\n 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24,\n 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24,\n 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22,\n 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23,\n 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25,\n 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25,\n 22, 25, 25, 25, 24, 25, 24, 25, 18,\n];\n"],"mappings":"AAAA,OAAO,MAAMA,QAAQ,GAAG,CACtB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,E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imp/plugin-blur/es/index.js
index 253aec80..2e198ecd 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-blur/es/index.js
@@ -1,13 +1,5 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
-
-var _blurTables = require("./blur-tables");
+import { throwError, isNodePattern } from "@jimp/utils";
+import { mulTable, shgTable } from "./blur-tables";
/*
Superfast Blur (0.5)
@@ -36,146 +28,128 @@ var _blurTables = require("./blur-tables");
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
-var _default = function _default() {
- return {
- /**
- * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker
- * @param {number} r the pixel radius of the blur
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- blur: function blur(r, cb) {
- if (typeof r !== 'number') return _utils.throwError.call(this, 'r must be a number', cb);
- if (r < 1) return _utils.throwError.call(this, 'r must be greater than 0', cb);
- var rsum;
- var gsum;
- var bsum;
- var asum;
- var x;
- var y;
- var i;
- var p;
- var p1;
- var p2;
- var yp;
- var yi;
- var yw;
- var pa;
- var wm = this.bitmap.width - 1;
- var hm = this.bitmap.height - 1; // const wh = this.bitmap.width * this.bitmap.height;
-
- var rad1 = r + 1;
- var mulSum = _blurTables.mulTable[r];
- var shgSum = _blurTables.shgTable[r];
- var red = [];
- var green = [];
- var blue = [];
- var alpha = [];
- var vmin = [];
- var vmax = [];
- var iterations = 2;
-
- while (iterations-- > 0) {
- yi = 0;
- yw = 0;
-
- for (y = 0; y < this.bitmap.height; y++) {
- rsum = this.bitmap.data[yw] * rad1;
- gsum = this.bitmap.data[yw + 1] * rad1;
- bsum = this.bitmap.data[yw + 2] * rad1;
- asum = this.bitmap.data[yw + 3] * rad1;
-
- for (i = 1; i <= r; i++) {
- p = yw + ((i > wm ? wm : i) << 2);
- rsum += this.bitmap.data[p++];
- gsum += this.bitmap.data[p++];
- bsum += this.bitmap.data[p++];
- asum += this.bitmap.data[p];
- }
-
- for (x = 0; x < this.bitmap.width; x++) {
- red[yi] = rsum;
- green[yi] = gsum;
- blue[yi] = bsum;
- alpha[yi] = asum;
-
- if (y === 0) {
- vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;
- vmax[x] = (p = x - r) > 0 ? p << 2 : 0;
- }
-
- p1 = yw + vmin[x];
- p2 = yw + vmax[x];
- rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
- gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
- bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
- asum += this.bitmap.data[p1] - this.bitmap.data[p2];
- yi++;
- }
- yw += this.bitmap.width << 2;
+export default (() => ({
+ /**
+ * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker
+ * @param {number} r the pixel radius of the blur
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ blur(r, cb) {
+ if (typeof r !== "number") return throwError.call(this, "r must be a number", cb);
+ if (r < 1) return throwError.call(this, "r must be greater than 0", cb);
+ let rsum;
+ let gsum;
+ let bsum;
+ let asum;
+ let x;
+ let y;
+ let i;
+ let p;
+ let p1;
+ let p2;
+ let yp;
+ let yi;
+ let yw;
+ let pa;
+ const wm = this.bitmap.width - 1;
+ const hm = this.bitmap.height - 1;
+ // const wh = this.bitmap.width * this.bitmap.height;
+ const rad1 = r + 1;
+ const mulSum = mulTable[r];
+ const shgSum = shgTable[r];
+ const red = [];
+ const green = [];
+ const blue = [];
+ const alpha = [];
+ const vmin = [];
+ const vmax = [];
+ let iterations = 2;
+ while (iterations-- > 0) {
+ yi = 0;
+ yw = 0;
+ for (y = 0; y < this.bitmap.height; y++) {
+ rsum = this.bitmap.data[yw] * rad1;
+ gsum = this.bitmap.data[yw + 1] * rad1;
+ bsum = this.bitmap.data[yw + 2] * rad1;
+ asum = this.bitmap.data[yw + 3] * rad1;
+ for (i = 1; i <= r; i++) {
+ p = yw + ((i > wm ? wm : i) << 2);
+ rsum += this.bitmap.data[p++];
+ gsum += this.bitmap.data[p++];
+ bsum += this.bitmap.data[p++];
+ asum += this.bitmap.data[p];
}
-
for (x = 0; x < this.bitmap.width; x++) {
- yp = x;
- rsum = red[yp] * rad1;
- gsum = green[yp] * rad1;
- bsum = blue[yp] * rad1;
- asum = alpha[yp] * rad1;
-
- for (i = 1; i <= r; i++) {
- yp += i > hm ? 0 : this.bitmap.width;
- rsum += red[yp];
- gsum += green[yp];
- bsum += blue[yp];
- asum += alpha[yp];
- }
-
- yi = x << 2;
-
- for (y = 0; y < this.bitmap.height; y++) {
- pa = asum * mulSum >>> shgSum;
- this.bitmap.data[yi + 3] = pa; // normalize alpha
-
- if (pa > 255) {
- this.bitmap.data[yi + 3] = 255;
- }
-
- if (pa > 0) {
- pa = 255 / pa;
- this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa;
- this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa;
- this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa;
- } else {
- this.bitmap.data[yi + 2] = 0;
- this.bitmap.data[yi + 1] = 0;
- this.bitmap.data[yi] = 0;
- }
-
- if (x === 0) {
- vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;
- vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;
- }
-
- p1 = x + vmin[y];
- p2 = x + vmax[y];
- rsum += red[p1] - red[p2];
- gsum += green[p1] - green[p2];
- bsum += blue[p1] - blue[p2];
- asum += alpha[p1] - alpha[p2];
- yi += this.bitmap.width << 2;
+ red[yi] = rsum;
+ green[yi] = gsum;
+ blue[yi] = bsum;
+ alpha[yi] = asum;
+ if (y === 0) {
+ vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;
+ vmax[x] = (p = x - r) > 0 ? p << 2 : 0;
}
+ p1 = yw + vmin[x];
+ p2 = yw + vmax[x];
+ rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
+ gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
+ bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];
+ asum += this.bitmap.data[p1] - this.bitmap.data[p2];
+ yi++;
}
+ yw += this.bitmap.width << 2;
}
+ for (x = 0; x < this.bitmap.width; x++) {
+ yp = x;
+ rsum = red[yp] * rad1;
+ gsum = green[yp] * rad1;
+ bsum = blue[yp] * rad1;
+ asum = alpha[yp] * rad1;
+ for (i = 1; i <= r; i++) {
+ yp += i > hm ? 0 : this.bitmap.width;
+ rsum += red[yp];
+ gsum += green[yp];
+ bsum += blue[yp];
+ asum += alpha[yp];
+ }
+ yi = x << 2;
+ for (y = 0; y < this.bitmap.height; y++) {
+ pa = asum * mulSum >>> shgSum;
+ this.bitmap.data[yi + 3] = pa;
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ // normalize alpha
+ if (pa > 255) {
+ this.bitmap.data[yi + 3] = 255;
+ }
+ if (pa > 0) {
+ pa = 255 / pa;
+ this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa;
+ this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa;
+ this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa;
+ } else {
+ this.bitmap.data[yi + 2] = 0;
+ this.bitmap.data[yi + 1] = 0;
+ this.bitmap.data[yi] = 0;
+ }
+ if (x === 0) {
+ vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;
+ vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;
+ }
+ p1 = x + vmin[y];
+ p2 = x + vmax[y];
+ rsum += red[p1] - red[p2];
+ gsum += green[p1] - green[p2];
+ bsum += blue[p1] - blue[p2];
+ asum += alpha[p1] - alpha[p2];
+ yi += this.bitmap.width << 2;
+ }
}
-
- return this;
}
- };
-};
-
-exports["default"] = _default;
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map b/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map
index d1de6f15..33a9a6aa 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["blur","r","cb","throwError","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","mulTable","shgSum","shgTable","red","green","blue","alpha","vmin","vmax","iterations","data"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4Be;AAAA,SAAO;AACpB;;;;;;AAMAA,IAAAA,IAPoB,gBAOfC,CAPe,EAOZC,EAPY,EAOR;AACV,UAAI,OAAOD,CAAP,KAAa,QAAjB,EACE,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACF,UAAID,CAAC,GAAG,CAAR,EAAW,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,0BAAtB,EAAkDF,EAAlD,CAAP;AAEX,UAAIG,IAAJ;AACA,UAAIC,IAAJ;AACA,UAAIC,IAAJ;AACA,UAAIC,IAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,CAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AACA,UAAIC,EAAJ;AAEA,UAAMC,EAAE,GAAG,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,CAA/B;AACA,UAAMC,EAAE,GAAG,KAAKF,MAAL,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ACD;;AAED,gBAAIP,CAAC,KAAK,CAAV,EAAa;AACXwB,cAAAA,IAAI,CAACvB,CAAD,CAAJ,GAAU,CAAC,CAACE,CAAC,GAAGF,CAAC,GAAGc,IAAT,IAAiBF,EAAjB,GAAsBV,CAAtB,GAA0BU,EAA3B,IAAiC,KAAKF,MAAL,CAAYC,KAAvD;AACAa,cAAAA,IAAI,CAACxB,CAAD,CAAJ,GAAU,CAACE,CAAC,GAAGF,CAAC,GAAGT,CAAT,IAAc,CAAd,GAAkBW,CAAC,GAAG,KAAKQ,MAAL,CAAYC,KAAlC,GAA0C,CAApD;AACD;;AAEDR,YAAAA,EAAE,GAAGJ,CAAC,GAAGwB,IAAI,CAACvB,CAAD,CAAb;AACAI,YAAAA,EAAE,GAAGL,CAAC,GAAGyB,IAAI,CAACxB,CAAD,CAAb;AAEAL,YAAAA,IAAI,IAAIwB,GAAG,CAAChB,EAAD,CAAH,GAAUgB,GAAG,CAACf,EAAD,CAArB;AACAR,YAAAA,IAAI,IAAIwB,KAAK,CAACjB,EAAD,CAAL,GAAYiB,KAAK,CAAChB,EAAD,CAAzB;AACAP,YAAAA,IAAI,IAAIwB,IAAI,CAAClB,EAAD,CAAJ,GAAWkB,IAAI,CAACjB,EAAD,CAAvB;AACAN,YAAAA,IAAI,IAAIwB,KAAK,CAACnB,EAAD,CAAL,GAAYmB,KAAK,CAAClB,EAAD,CAAzB;AAEAE,YAAAA,EAAE,IAAI,KAAKI,MAAL,CAAYC,KAAZ,IAAqB,CAA3B;AACD;AACF;AACF;;AAED,UAAI,0BAAcnB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApJmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\nimport { mulTable, shgTable } from './blur-tables';\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== 'number')\n return throwError.call(this, 'r must be a number', cb);\n if (r < 1) return throwError.call(this, 'r must be greater than 0', cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["throwError","isNodePattern","mulTable","shgTable","blur","r","cb","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","shgSum","red","green","blue","alpha","vmin","vmax","iterations","data"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\nimport { mulTable, shgTable } from \"./blur-tables\";\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== \"number\")\n return throwError.call(this, \"r must be a number\", cb);\n if (r < 1) return throwError.call(this, \"r must be greater than 0\", cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,aAAa,QAAQ,aAAa;AACvD,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,eAAe;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;EACEC,IAAI,CAACC,CAAC,EAAEC,EAAE,EAAE;IACV,IAAI,OAAOD,CAAC,KAAK,QAAQ,EACvB,OAAOL,UAAU,CAACO,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAED,EAAE,CAAC;IACxD,IAAID,CAAC,GAAG,CAAC,EAAE,OAAOL,UAAU,CAACO,IAAI,CAAC,IAAI,EAAE,0BAA0B,EAAED,EAAE,CAAC;IAEvE,IAAIE,IAAI;IACR,IAAIC,IAAI;IACR,IAAIC,IAAI;IACR,IAAIC,IAAI;IACR,IAAIC,CAAC;IACL,IAAIC,CAAC;IACL,IAAIC,CAAC;IACL,IAAIC,CAAC;IACL,IAAIC,EAAE;IACN,IAAIC,EAAE;IACN,IAAIC,EAAE;IACN,IAAIC,EAAE;IACN,IAAIC,EAAE;IACN,IAAIC,EAAE;IAEN,MAAMC,EAAE,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK,GAAG,CAAC;IAChC,MAAMC,EAAE,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM,GAAG,CAAC;IACjC;IACA,MAAMC,IAAI,GAAGtB,CAAC,GAAG,CAAC;IAElB,MAAMuB,MAAM,GAAG1B,QAAQ,CAACG,CAAC,CAAC;IAC1B,MAAMwB,MAAM,GAAG1B,QAAQ,CAACE,CAAC,CAAC;IAE1B,MAAMyB,GAAG,GAAG,EAAE;IACd,MAAMC,KAAK,GAAG,EAAE;IAChB,MAAMC,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AAE,CAAC;UACzBR,IAAI,IAAIsB,KAAK,CAACf,EAAE,CAAC,GAAGe,KAAK,CAACd,EAAE,CAAC;UAC7BP,IAAI,IAAIsB,IAAI,CAAChB,EAAE,CAAC,GAAGgB,IAAI,CAACf,EAAE,CAAC;UAC3BN,IAAI,IAAIsB,KAAK,CAACjB,EAAE,CAAC,GAAGiB,KAAK,CAAChB,EAAE,CAAC;UAE7BE,EAAE,IAAI,IAAI,CAACI,MAAM,CAACC,KAAK,IAAI,CAAC;QAC9B;MACF;IACF;IAEA,IAAIvB,aAAa,CAACK,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-blur/index.d.ts b/project starter code/node_modules/@jimp/plugin-blur/index.d.ts
index f2c1a84e..8e325774 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-blur/index.d.ts
@@ -1,7 +1,7 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Blur {
blur(r: number, cb?: ImageCallback): this;
}
-export default function(): Blur;
+export default function (): Blur;
diff --git a/project starter code/node_modules/@jimp/plugin-blur/package.json b/project starter code/node_modules/@jimp/plugin-blur/package.json
index c0b9190b..d8d9ce22 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/package.json
+++ b/project starter code/node_modules/@jimp/plugin-blur/package.json
@@ -1,9 +1,10 @@
{
"name": "@jimp/plugin-blur",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "blur an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
"build": "npm run build:node:production && npm run build:module",
@@ -17,8 +18,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
@@ -26,5 +26,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js b/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js
index 39b3d9a3..b6300145 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js
+++ b/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js
@@ -1,519 +1,35 @@
export const mulTable = [
- 1,
- 57,
- 41,
- 21,
- 203,
- 34,
- 97,
- 73,
- 227,
- 91,
- 149,
- 62,
- 105,
- 45,
- 39,
- 137,
- 241,
- 107,
- 3,
- 173,
- 39,
- 71,
- 65,
- 238,
- 219,
- 101,
- 187,
- 87,
- 81,
- 151,
- 141,
- 133,
- 249,
- 117,
- 221,
- 209,
- 197,
- 187,
- 177,
- 169,
- 5,
- 153,
- 73,
- 139,
- 133,
- 127,
- 243,
- 233,
- 223,
- 107,
- 103,
- 99,
- 191,
- 23,
- 177,
- 171,
- 165,
- 159,
- 77,
- 149,
- 9,
- 139,
- 135,
- 131,
- 253,
- 245,
- 119,
- 231,
- 224,
- 109,
- 211,
- 103,
- 25,
- 195,
- 189,
- 23,
- 45,
- 175,
- 171,
- 83,
- 81,
- 79,
- 155,
- 151,
- 147,
- 9,
- 141,
- 137,
- 67,
- 131,
- 129,
- 251,
- 123,
- 30,
- 235,
- 115,
- 113,
- 221,
- 217,
- 53,
- 13,
- 51,
- 50,
- 49,
- 193,
- 189,
- 185,
- 91,
- 179,
- 175,
- 43,
- 169,
- 83,
- 163,
- 5,
- 79,
- 155,
- 19,
- 75,
- 147,
- 145,
- 143,
- 35,
- 69,
- 17,
- 67,
- 33,
- 65,
- 255,
- 251,
- 247,
- 243,
- 239,
- 59,
- 29,
- 229,
- 113,
- 111,
- 219,
- 27,
- 213,
- 105,
- 207,
- 51,
- 201,
- 199,
- 49,
- 193,
- 191,
- 47,
- 93,
- 183,
- 181,
- 179,
- 11,
- 87,
- 43,
- 85,
- 167,
- 165,
- 163,
- 161,
- 159,
- 157,
- 155,
- 77,
- 19,
- 75,
- 37,
- 73,
- 145,
- 143,
- 141,
- 35,
- 138,
- 137,
- 135,
- 67,
- 33,
- 131,
- 129,
- 255,
- 63,
- 250,
- 247,
- 61,
- 121,
- 239,
- 237,
- 117,
- 29,
- 229,
- 227,
- 225,
- 111,
- 55,
- 109,
- 216,
- 213,
- 211,
- 209,
- 207,
- 205,
- 203,
- 201,
- 199,
- 197,
- 195,
- 193,
- 48,
- 190,
- 47,
- 93,
- 185,
- 183,
- 181,
- 179,
- 178,
- 176,
- 175,
- 173,
- 171,
- 85,
- 21,
- 167,
- 165,
- 41,
- 163,
- 161,
- 5,
- 79,
- 157,
- 78,
- 154,
- 153,
- 19,
- 75,
- 149,
- 74,
- 147,
- 73,
- 144,
- 143,
- 71,
- 141,
- 140,
- 139,
- 137,
- 17,
- 135,
- 134,
- 133,
- 66,
- 131,
- 65,
- 129,
- 1
+ 1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107,
+ 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221,
+ 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103,
+ 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119,
+ 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151,
+ 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13,
+ 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75,
+ 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229,
+ 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183,
+ 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37,
+ 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61,
+ 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207,
+ 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178,
+ 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153,
+ 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133,
+ 66, 131, 65, 129, 1,
];
export const shgTable = [
- 0,
- 9,
- 10,
- 10,
- 14,
- 12,
- 14,
- 14,
- 16,
- 15,
- 16,
- 15,
- 16,
- 15,
- 15,
- 17,
- 18,
- 17,
- 12,
- 18,
- 16,
- 17,
- 17,
- 19,
- 19,
- 18,
- 19,
- 18,
- 18,
- 19,
- 19,
- 19,
- 20,
- 19,
- 20,
- 20,
- 20,
- 20,
- 20,
- 20,
- 15,
- 20,
- 19,
- 20,
- 20,
- 20,
- 21,
- 21,
- 21,
- 20,
- 20,
- 20,
- 21,
- 18,
- 21,
- 21,
- 21,
- 21,
- 20,
- 21,
- 17,
- 21,
- 21,
- 21,
- 22,
- 22,
- 21,
- 22,
- 22,
- 21,
- 22,
- 21,
- 19,
- 22,
- 22,
- 19,
- 20,
- 22,
- 22,
- 21,
- 21,
- 21,
- 22,
- 22,
- 22,
- 18,
- 22,
- 22,
- 21,
- 22,
- 22,
- 23,
- 22,
- 20,
- 23,
- 22,
- 22,
- 23,
- 23,
- 21,
- 19,
- 21,
- 21,
- 21,
- 23,
- 23,
- 23,
- 22,
- 23,
- 23,
- 21,
- 23,
- 22,
- 23,
- 18,
- 22,
- 23,
- 20,
- 22,
- 23,
- 23,
- 23,
- 21,
- 22,
- 20,
- 22,
- 21,
- 22,
- 24,
- 24,
- 24,
- 24,
- 24,
- 22,
- 21,
- 24,
- 23,
- 23,
- 24,
- 21,
- 24,
- 23,
- 24,
- 22,
- 24,
- 24,
- 22,
- 24,
- 24,
- 22,
- 23,
- 24,
- 24,
- 24,
- 20,
- 23,
- 22,
- 23,
- 24,
- 24,
- 24,
- 24,
- 24,
- 24,
- 24,
- 23,
- 21,
- 23,
- 22,
- 23,
- 24,
- 24,
- 24,
- 22,
- 24,
- 24,
- 24,
- 23,
- 22,
- 24,
- 24,
- 25,
- 23,
- 25,
- 25,
- 23,
- 24,
- 25,
- 25,
- 24,
- 22,
- 25,
- 25,
- 25,
- 24,
- 23,
- 24,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 23,
- 25,
- 23,
- 24,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 25,
- 24,
- 22,
- 25,
- 25,
- 23,
- 25,
- 25,
- 20,
- 24,
- 25,
- 24,
- 25,
- 25,
- 22,
- 24,
- 25,
- 24,
- 25,
- 24,
- 25,
- 25,
- 24,
- 25,
- 25,
- 25,
- 25,
- 22,
- 25,
- 25,
- 25,
- 24,
- 25,
- 24,
- 25,
- 18
+ 0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18,
+ 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20,
+ 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21,
+ 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20,
+ 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22,
+ 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18,
+ 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22,
+ 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24,
+ 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24,
+ 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22,
+ 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23,
+ 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25,
+ 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25,
+ 22, 25, 25, 25, 24, 25, 24, 25, 18,
];
diff --git a/project starter code/node_modules/@jimp/plugin-blur/src/index.js b/project starter code/node_modules/@jimp/plugin-blur/src/index.js
index e5ab8ea9..d97ae3d6 100644
--- a/project starter code/node_modules/@jimp/plugin-blur/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-blur/src/index.js
@@ -1,5 +1,5 @@
-import { throwError, isNodePattern } from '@jimp/utils';
-import { mulTable, shgTable } from './blur-tables';
+import { throwError, isNodePattern } from "@jimp/utils";
+import { mulTable, shgTable } from "./blur-tables";
/*
Superfast Blur (0.5)
@@ -37,9 +37,9 @@ export default () => ({
* @returns {Jimp} this for chaining of methods
*/
blur(r, cb) {
- if (typeof r !== 'number')
- return throwError.call(this, 'r must be a number', cb);
- if (r < 1) return throwError.call(this, 'r must be greater than 0', cb);
+ if (typeof r !== "number")
+ return throwError.call(this, "r must be a number", cb);
+ if (r < 1) return throwError.call(this, "r must be greater than 0", cb);
let rsum;
let gsum;
@@ -177,5 +177,5 @@ export default () => ({
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md
index 26394e0f..3d839517 100644
--- a/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md
@@ -1,3 +1,65 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +74,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +82,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-circle/README.md b/project starter code/node_modules/@jimp/plugin-circle/README.md
index 5181828e..689b3ab8 100644
--- a/project starter code/node_modules/@jimp/plugin-circle/README.md
+++ b/project starter code/node_modules/@jimp/plugin-circle/README.md
@@ -11,10 +11,10 @@
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.circle();
// or
diff --git a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js b/project starter code/node_modules/@jimp/plugin-circle/dist/index.js
index 91489e42..554b26b4 100644
--- a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-circle/dist/index.js
@@ -3,51 +3,42 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Creates a circle out of an image.
* @param {function(Error, Jimp)} options (optional) radius, x, y
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- circle: function circle() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var cb = arguments.length > 1 ? arguments[1] : undefined;
-
- if (typeof options === 'function') {
- cb = options;
- options = {};
- }
-
- var radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2;
- var center = {
- x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,
- y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2
- };
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2));
-
- if (radius - curR <= 0.0) {
- this.bitmap.data[idx + 3] = 0;
- } else if (radius - curR < 1.0) {
- this.bitmap.data[idx + 3] = 255 * (radius - curR);
- }
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+var _default = () => ({
+ circle() {
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ let cb = arguments.length > 1 ? arguments[1] : undefined;
+ if (typeof options === "function") {
+ cb = options;
+ options = {};
+ }
+ const radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2;
+ const center = {
+ x: typeof options.x === "number" ? options.x : this.bitmap.width / 2,
+ y: typeof options.y === "number" ? options.y : this.bitmap.height / 2
+ };
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ const curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2));
+ if (radius - curR <= 0.0) {
+ this.bitmap.data[idx + 3] = 0;
+ } else if (radius - curR < 1.0) {
+ this.bitmap.data[idx + 3] = 255 * (radius - curR);
}
-
- return this;
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map
index 195824df..db694a53 100644
--- a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAED,UAAME,MAAM,GACVF,OAAO,CAACE,MAAR,IACA,CAAC,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAhC,GACG,KAAKF,MAAL,CAAYE,MADf,GAEG,KAAKF,MAAL,CAAYC,KAFhB,IAEyB,CAJ3B;AAMA,UAAME,MAAM,GAAG;AACbC,QAAAA,CAAC,EAAE,OAAOP,OAAO,CAACO,CAAf,KAAqB,QAArB,GAAgCP,OAAO,CAACO,CAAxC,GAA4C,KAAKJ,MAAL,CAAYC,KAAZ,GAAoB,CADtD;AAEbI,QAAAA,CAAC,EAAE,OAAOR,OAAO,CAACQ,CAAf,KAAqB,QAArB,GAAgCR,OAAO,CAACQ,CAAxC,GAA4C,KAAKL,MAAL,CAAYE,MAAZ,GAAqB;AAFvD,OAAf;AAKA,WAAKI,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKN,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DE,CAD0D,EAE1DC,CAF0D,EAG1DE,GAH0D,EAI1D;AACA,YAAMC,IAAI,GAAGC,IAAI,CAACC,IAAL,CACXD,IAAI,CAACE,GAAL,CAASP,CAAC,GAAGD,MAAM,CAACC,CAApB,EAAuB,CAAvB,IAA4BK,IAAI,CAACE,GAAL,CAASN,CAAC,GAAGF,MAAM,CAACE,CAApB,EAAuB,CAAvB,CADjB,CAAb;;AAIA,YAAIN,MAAM,GAAGS,IAAT,IAAiB,GAArB,EAA0B;AACxB,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,CAA5B;AACD,SAFD,MAEO,IAAIR,MAAM,GAAGS,IAAT,GAAgB,GAApB,EAAyB;AAC9B,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,OAAOR,MAAM,GAAGS,IAAhB,CAA5B;AACD;AACF,OAdD;;AAgBA,UAAI,0BAAcV,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACe,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAvCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,\n y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","isNodePattern","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === \"number\" ? options.x : this.bitmap.width / 2,\n y: typeof options.y === \"number\" ? options.y : this.bitmap.height / 2,\n };\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AALA,eAMe,OAAO;EACpBA,MAAM,GAAmB;IAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;IAAA,IAAEC,EAAE;IACrB,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;MACjCC,EAAE,GAAGD,OAAO;MACZA,OAAO,GAAG,CAAC,CAAC;IACd;IAEA,MAAME,MAAM,GACVF,OAAO,CAACE,MAAM,IACd,CAAC,IAAI,CAACC,MAAM,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACE,MAAM,GACnC,IAAI,CAACF,MAAM,CAACE,MAAM,GAClB,IAAI,CAACF,MAAM,CAACC,KAAK,IAAI,CAAC;IAE5B,MAAME,MAAM,GAAG;MACbC,CAAC,EAAE,OAAOP,OAAO,CAACO,CAAC,KAAK,QAAQ,GAAGP,OAAO,CAACO,CAAC,GAAG,IAAI,CAACJ,MAAM,CAACC,KAAK,GAAG,CAAC;MACpEI,CAAC,EAAE,OAAOR,OAAO,CAACQ,CAAC,KAAK,QAAQ,GAAGR,OAAO,CAACQ,CAAC,GAAG,IAAI,CAACL,MAAM,CAACE,MAAM,GAAG;IACtE,CAAC;IAED,IAAI,CAACI,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACN,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUE,CAAC,EAAEC,CAAC,EAAEE,GAAG,EAAE;MACnB,MAAMC,IAAI,GAAGC,IAAI,CAACC,IAAI,CACpBD,IAAI,CAACE,GAAG,CAACP,CAAC,GAAGD,MAAM,CAACC,CAAC,EAAE,CAAC,CAAC,GAAGK,IAAI,CAACE,GAAG,CAACN,CAAC,GAAGF,MAAM,CAACE,CAAC,EAAE,CAAC,CAAC,CACtD;MAED,IAAIN,MAAM,GAAGS,IAAI,IAAI,GAAG,EAAE;QACxB,IAAI,CAACR,MAAM,CAACY,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;MAC/B,CAAC,MAAM,IAAIR,MAAM,GAAGS,IAAI,GAAG,GAAG,EAAE;QAC9B,IAAI,CAACR,MAAM,CAACY,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,IAAIR,MAAM,GAAGS,IAAI,CAAC;MACnD;IACF,CAAC,CACF;IAED,IAAI,IAAAK,oBAAa,EAACf,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACgB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-circle/es/index.js b/project starter code/node_modules/@jimp/plugin-circle/es/index.js
index d710b6d5..94c8aa11 100644
--- a/project starter code/node_modules/@jimp/plugin-circle/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-circle/es/index.js
@@ -1,11 +1,4 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern } from "@jimp/utils";
/**
* Creates a circle out of an image.
@@ -13,40 +6,31 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- circle: function circle() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var cb = arguments.length > 1 ? arguments[1] : undefined;
-
- if (typeof options === 'function') {
- cb = options;
- options = {};
- }
-
- var radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2;
- var center = {
- x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,
- y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2
- };
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2));
-
- if (radius - curR <= 0.0) {
- this.bitmap.data[idx + 3] = 0;
- } else if (radius - curR < 1.0) {
- this.bitmap.data[idx + 3] = 255 * (radius - curR);
- }
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+export default (() => ({
+ circle() {
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ let cb = arguments.length > 1 ? arguments[1] : undefined;
+ if (typeof options === "function") {
+ cb = options;
+ options = {};
+ }
+ const radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2;
+ const center = {
+ x: typeof options.x === "number" ? options.x : this.bitmap.width / 2,
+ y: typeof options.y === "number" ? options.y : this.bitmap.height / 2
+ };
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ const curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2));
+ if (radius - curR <= 0.0) {
+ this.bitmap.data[idx + 3] = 0;
+ } else if (radius - curR < 1.0) {
+ this.bitmap.data[idx + 3] = 255 * (radius - curR);
}
-
- return this;
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map b/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map
index 195824df..89b8675e 100644
--- a/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","id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eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,CAA5B;AACD,SAFD,MAEO,IAAIR,MAAM,GAAGS,IAAT,GAAgB,GAApB,EAAyB;AAC9B,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,OAAOR,MAAM,GAAGS,IAAhB,CAA5B;AACD;AACF,OAdD;;AAgBA,UAAI,0BAAcV,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACe,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAvCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,\n y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === \"number\" ? options.x : this.bitmap.width / 2,\n y: typeof options.y === \"number\" ? options.y : this.bitmap.height / 2,\n };\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,MAAM,GAAmB;IAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;IAAA,IAAEC,EAAE;IACrB,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;MACjCC,EAAE,GAAGD,OAAO;MACZA,OAAO,GAAG,CAAC,CAAC;IACd;IAEA,MAAME,MAAM,GACVF,OAAO,CAACE,MAAM,IACd,CAAC,IAAI,CAACC,MAAM,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACE,MAAM,GACnC,IAAI,CAACF,MAAM,CAACE,MAAM,GAClB,IAAI,CAACF,MAAM,CAACC,KAAK,IAAI,CAAC;IAE5B,MAAME,MAAM,GAAG;MACbC,CAAC,EAAE,OAAOP,OAAO,CAACO,CAAC,KAAK,QAAQ,GAAGP,OAAO,CAACO,CAAC,GAAG,IAAI,CAACJ,MAAM,CAACC,KAAK,GAAG,CAAC;MACpEI,CAAC,EAAE,OAAOR,OAAO,CAACQ,CAAC,KAAK,QAAQ,GAAGR,OAAO,CAACQ,CAAC,GAAG,IAAI,CAACL,MAAM,CAACE,MAAM,GAAG;IACtE,CAAC;IAED,IAAI,CAACI,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACN,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUE,CAAC,EAAEC,CAAC,EAAEE,GAAG,EAAE;MACnB,MAAMC,IAAI,GAAGC,IAAI,CAACC,IAAI,CACpBD,IAAI,CAACE,GAAG,CAACP,CAAC,GAAGD,MAAM,CAACC,CAAC,EAAE,CAAC,CAAC,GAAGK,IAAI,CAACE,GAAG,CAACN,CAAC,GAAGF,MAAM,CAACE,CAAC,EAAE,CAAC,CAAC,CACtD;MAED,IAAIN,MAAM,GAAGS,IAAI,IAAI,GAAG,EAAE;QACxB,IAAI,CAACR,MAAM,CAACY,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;MAC/B,CAAC,MAAM,IAAIR,MAAM,GAAGS,IAAI,GAAG,GAAG,EAAE;QAC9B,IAAI,CAACR,MAAM,CAACY,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,IAAIR,MAAM,GAAGS,IAAI,CAAC;MACnD;IACF,CAAC,CACF;IAED,IAAIb,aAAa,CAACG,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACe,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-circle/index.d.ts b/project starter code/node_modules/@jimp/plugin-circle/index.d.ts
index 40f24935..302dda00 100644
--- a/project starter code/node_modules/@jimp/plugin-circle/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-circle/index.d.ts
@@ -1,12 +1,15 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Circle {
- circle(options?: {
- radius: number,
- x: number,
- y: number
- }, cb?: ImageCallback): this;
+ circle(
+ options?: {
+ radius: number;
+ x: number;
+ y: number;
+ },
+ cb?: ImageCallback
+ ): this;
circle(cb?: ImageCallback): this;
}
-export default function(): Circle;
+export default function (): Circle;
diff --git a/project starter code/node_modules/@jimp/plugin-circle/package.json b/project starter code/node_modules/@jimp/plugin-circle/package.json
index 56825de4..8e256cce 100644
--- a/project starter code/node_modules/@jimp/plugin-circle/package.json
+++ b/project starter code/node_modules/@jimp/plugin-circle/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-circle",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Creates a circle out of an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,18 +21,17 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-circle/src/index.js b/project starter code/node_modules/@jimp/plugin-circle/src/index.js
index d917ad1e..5d1a5c9c 100644
--- a/project starter code/node_modules/@jimp/plugin-circle/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-circle/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern } from '@jimp/utils';
+import { isNodePattern } from "@jimp/utils";
/**
* Creates a circle out of an image.
@@ -8,7 +8,7 @@ import { isNodePattern } from '@jimp/utils';
*/
export default () => ({
circle(options = {}, cb) {
- if (typeof options === 'function') {
+ if (typeof options === "function") {
cb = options;
options = {};
}
@@ -20,30 +20,32 @@ export default () => ({
: this.bitmap.width) / 2;
const center = {
- x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,
- y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2
+ x: typeof options.x === "number" ? options.x : this.bitmap.width / 2,
+ y: typeof options.y === "number" ? options.y : this.bitmap.height / 2,
};
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- const curR = Math.sqrt(
- Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)
- );
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ const curR = Math.sqrt(
+ Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)
+ );
- if (radius - curR <= 0.0) {
- this.bitmap.data[idx + 3] = 0;
- } else if (radius - curR < 1.0) {
- this.bitmap.data[idx + 3] = 255 * (radius - curR);
+ if (radius - curR <= 0.0) {
+ this.bitmap.data[idx + 3] = 0;
+ } else if (radius - curR < 1.0) {
+ this.bitmap.data[idx + 3] = 255 * (radius - curR);
+ }
}
- });
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js b/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js
index 6b42c73e..afeb6c6b 100644
--- a/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js
+++ b/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js
@@ -1,78 +1,79 @@
-import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import expect from "@storybook/expect";
-import circle from '../src';
+import circle from "../src";
const jimp = configure({ plugins: [circle] }, Jimp);
-describe('Circle', () => {
- it('makes a circle based on image height and width', async () => {
+describe("Circle", () => {
+ it("makes a circle based on image height and width", async () => {
const expectedImg = await Jimp.read(
- getTestDir(__dirname) + '/images/circled.png'
+ getTestDir(__dirname) + "/images/circled.png"
);
const imgSrc = await jimp.read(
mkJGD(
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦'
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦"
)
);
- imgSrc.circle().bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(imgSrc.circle().bitmap.data).toEqual(expectedImg.bitmap.data);
});
- it('makes a circle using provided radius', async () => {
+ it("makes a circle using provided radius", async () => {
const expectedImg = await Jimp.read(
- getTestDir(__dirname) + '/images/radius-3-circle.png'
+ getTestDir(__dirname) + "/images/radius-3-circle.png"
);
const imgSrc = await jimp.read(
mkJGD(
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦'
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦"
)
);
- imgSrc
- .circle({ radius: 3 })
- .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(imgSrc.circle({ radius: 3 }).bitmap.data).toEqual(
+ expectedImg.bitmap.data
+ );
});
- it('should ', async () => {
+ it("should ", async () => {
const expectedImg = await Jimp.read(
- getTestDir(__dirname) + '/images/x-y-circle.png'
+ getTestDir(__dirname) + "/images/x-y-circle.png"
);
const imgSrc = await jimp.read(
mkJGD(
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
- '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦'
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦",
+ "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦"
)
);
- imgSrc
- .circle({ radius: 5, x: 5, y: 5 })
- .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(imgSrc.circle({ radius: 5, x: 5, y: 5 }).bitmap.data).toEqual(
+ expectedImg.bitmap.data
+ );
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md
index 26394e0f..14f0ae49 100644
--- a/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md
@@ -1,3 +1,137 @@
+# v0.22.8 (Thu May 11 2023)
+
+#### 🚀 Enhancement
+
+- Fix: convolute not defaulting to 0, 0 as starting point [#1228](https://github.com/jimp-dev/jimp/pull/1228) ([@sjoerd108](https://github.com/sjoerd108))
+
+#### Authors: 1
+
+- Sjoerd ([@sjoerd108](https://github.com/sjoerd108))
+
+---
+
+# v0.22.6 (Fri Feb 24 2023)
+
+:tada: This release contains work from a new contributor! :tada:
+
+Thank you, Daniell ([@daniellwdb](https://github.com/daniellwdb)), for all your work!
+
+#### 🐛 Bug Fix
+
+- Export ColorActionName enum [#1205](https://github.com/jimp-dev/jimp/pull/1205) ([@daniellwdb](https://github.com/daniellwdb))
+
+#### Authors: 1
+
+- Daniell ([@daniellwdb](https://github.com/daniellwdb))
+
+---
+
+# v0.22.4 (Tue Feb 07 2023)
+
+#### 🚀 Enhancement
+
+- update tinycolor2 [#1187](https://github.com/jimp-dev/jimp/pull/1187) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.17.6 (Sat Feb 04 2023)
+
+#### 🐛 Bug Fix
+
+- Fix types not assignable to 'ColorActionName'. [#1086](https://github.com/jimp-dev/jimp/pull/1086) ([@lucyyyyyyy](https://github.com/lucyyyyyyy) [@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Lucy ([@lucyyyyyyy](https://github.com/lucyyyyyyy))
+
+---
+
+# v0.17.3 (Sat Feb 04 2023)
+
+#### 🐛 Bug Fix
+
+- Fix EDGE_WRAP overwriting X with Y when Y < 0 [#1135](https://github.com/jimp-dev/jimp/pull/1135) ([@sjoerd108](https://github.com/sjoerd108) [@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Sjoerd ([@sjoerd108](https://github.com/sjoerd108))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### 🐛 Bug Fix
+
+- Fix edgeHandling types [#1080](https://github.com/jimp-dev/jimp/pull/1080) ([@domdomegg](https://github.com/domdomegg))
+
+#### ⚠️ Pushed to `main`
+
+- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 2
+
+- Adam Jones ([@domdomegg](https://github.com/domdomegg))
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +146,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +154,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-color/README.md b/project starter code/node_modules/@jimp/plugin-color/README.md
index cad9c7e5..1b4c800f 100644
--- a/project starter code/node_modules/@jimp/plugin-color/README.md
+++ b/project starter code/node_modules/@jimp/plugin-color/README.md
@@ -15,12 +15,12 @@ Apply multiple color modification rules
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
- image.color([{ apply: 'red', params: [100] }]);
+ image.color([{ apply: "red", params: [100] }]);
}
main();
@@ -30,9 +30,9 @@ Jimp supports advanced colour manipulation using a single method as follows:
```js
image.color([
- { apply: 'hue', params: [-90] },
- { apply: 'lighten', params: [50] },
- { apply: 'xor', params: ['#06D'] }
+ { apply: "hue", params: [-90] },
+ { apply: "lighten", params: [50] },
+ { apply: "xor", params: ["#06D"] },
]);
```
@@ -64,10 +64,10 @@ Adjusts the brightness of the image
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.brightness(20);
}
@@ -83,10 +83,10 @@ Adjusts the contrast of the image
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.contrast(70);
}
@@ -102,10 +102,10 @@ Apply a posterize effect
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.posterize(5);
}
@@ -121,10 +121,10 @@ Multiplies the opacity of each pixel by a factor between 0 and 1
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.opacity(80);
}
@@ -139,10 +139,10 @@ Applies a sepia tone to the image
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.sepia();
}
@@ -158,10 +158,10 @@ Fades each pixel by a factor between 0 and 1
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.fade(0.7);
}
@@ -174,17 +174,23 @@ main();
Sum neighbor pixels weighted by the kernel matrix. You can find a nice explanation with examples at [GIMP's Convolution Matrix plugin](https://docs.gimp.org/2.6/en/plug-in-convmatrix.html)
- @param {array} kernel a matrix to weight the neighbors sum
-- @param {string} edgeHandling (optional) define how to sum pixels from outside the border
+- @param {number} edgeHandling (optional) define how to sum pixels from outside the border
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
-
- // make me better
- image.convolution(weights);
+ const image = await jimp.read("test/image.png");
+
+ image.convolution(
+ [
+ [-1, -1, -1],
+ [-1, 8, -1],
+ [-1, -1, -1],
+ ],
+ jimp.EDGE_EXTEND
+ );
}
main();
@@ -197,10 +203,10 @@ Set the alpha channel on every pixel to fully opaque
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.opaque();
}
@@ -220,10 +226,10 @@ Pixelates the image or a region
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.pixelate(10);
}
@@ -243,10 +249,10 @@ Applies a convolution kernel to the image or a region
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
// make me better
image.pixelate(kernal);
diff --git a/project starter code/node_modules/@jimp/plugin-color/dist/index.js b/project starter code/node_modules/@jimp/plugin-color/dist/index.js
index a4db2139..6be0fc4a 100644
--- a/project starter code/node_modules/@jimp/plugin-color/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-color/dist/index.js
@@ -1,567 +1,486 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
-
+exports.default = exports.ColorActionName = void 0;
var _tinycolor = _interopRequireDefault(require("tinycolor2"));
-
var _utils = require("@jimp/utils");
-
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function applyKernel(im, kernel, x, y) {
- var value = [0, 0, 0];
- var size = (kernel.length - 1) / 2;
-
- for (var kx = 0; kx < kernel.length; kx += 1) {
- for (var ky = 0; ky < kernel[kx].length; ky += 1) {
- var idx = im.getPixelIndex(x + kx - size, y + ky - size);
+ const value = [0, 0, 0];
+ const size = (kernel.length - 1) / 2;
+ for (let kx = 0; kx < kernel.length; kx += 1) {
+ for (let ky = 0; ky < kernel[kx].length; ky += 1) {
+ const idx = im.getPixelIndex(x + kx - size, y + ky - size);
value[0] += im.bitmap.data[idx] * kernel[kx][ky];
value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];
value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];
}
}
-
return value;
}
-
-var isDef = function isDef(v) {
- return typeof v !== 'undefined' && v !== null;
-};
-
+const isDef = v => typeof v !== "undefined" && v !== null;
function greyscale(cb) {
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10);
+ const grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10);
this.bitmap.data[idx] = grey;
this.bitmap.data[idx + 1] = grey;
this.bitmap.data[idx + 2] = grey;
});
-
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}
-
return this;
}
-
function mix(clr, clr2) {
- var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
+ let p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
return {
r: (clr2.r - clr.r) * (p / 100) + clr.r,
g: (clr2.g - clr.g) * (p / 100) + clr.g,
b: (clr2.b - clr.b) * (p / 100) + clr.b
};
}
-
function colorFn(actions, cb) {
- var _this = this;
-
if (!actions || !Array.isArray(actions)) {
- return _utils.throwError.call(this, 'actions must be an array', cb);
+ return _utils.throwError.call(this, "actions must be an array", cb);
}
-
- actions = actions.map(function (action) {
- if (action.apply === 'xor' || action.apply === 'mix') {
- action.params[0] = (0, _tinycolor["default"])(action.params[0]).toRgb();
+ actions = actions.map(action => {
+ if (action.apply === "xor" || action.apply === "mix") {
+ action.params[0] = (0, _tinycolor.default)(action.params[0]).toRgb();
}
-
return action;
});
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var clr = {
- r: _this.bitmap.data[idx],
- g: _this.bitmap.data[idx + 1],
- b: _this.bitmap.data[idx + 2]
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {
+ let clr = {
+ r: this.bitmap.data[idx],
+ g: this.bitmap.data[idx + 1],
+ b: this.bitmap.data[idx + 2]
};
-
- var colorModifier = function colorModifier(i, amount) {
- return _this.constructor.limit255(clr[i] + amount);
- };
-
- actions.forEach(function (action) {
- if (action.apply === 'mix') {
+ const colorModifier = (i, amount) => this.constructor.limit255(clr[i] + amount);
+ actions.forEach(action => {
+ if (action.apply === "mix") {
clr = mix(clr, action.params[0], action.params[1]);
- } else if (action.apply === 'tint') {
+ } else if (action.apply === "tint") {
clr = mix(clr, {
r: 255,
g: 255,
b: 255
}, action.params[0]);
- } else if (action.apply === 'shade') {
+ } else if (action.apply === "shade") {
clr = mix(clr, {
r: 0,
g: 0,
b: 0
}, action.params[0]);
- } else if (action.apply === 'xor') {
+ } else if (action.apply === "xor") {
clr = {
r: clr.r ^ action.params[0].r,
g: clr.g ^ action.params[0].g,
b: clr.b ^ action.params[0].b
};
- } else if (action.apply === 'red') {
- clr.r = colorModifier('r', action.params[0]);
- } else if (action.apply === 'green') {
- clr.g = colorModifier('g', action.params[0]);
- } else if (action.apply === 'blue') {
- clr.b = colorModifier('b', action.params[0]);
+ } else if (action.apply === "red") {
+ clr.r = colorModifier("r", action.params[0]);
+ } else if (action.apply === "green") {
+ clr.g = colorModifier("g", action.params[0]);
+ } else if (action.apply === "blue") {
+ clr.b = colorModifier("b", action.params[0]);
} else {
- var _clr;
-
- if (action.apply === 'hue') {
- action.apply = 'spin';
+ if (action.apply === "hue") {
+ action.apply = "spin";
}
-
- clr = (0, _tinycolor["default"])(clr);
-
+ clr = (0, _tinycolor.default)(clr);
if (!clr[action.apply]) {
- return _utils.throwError.call(_this, 'action ' + action.apply + ' not supported', cb);
+ return _utils.throwError.call(this, "action " + action.apply + " not supported", cb);
}
-
- clr = (_clr = clr)[action.apply].apply(_clr, (0, _toConsumableArray2["default"])(action.params)).toRgb();
+ clr = clr[action.apply](...action.params).toRgb();
}
});
- _this.bitmap.data[idx] = clr.r;
- _this.bitmap.data[idx + 1] = clr.g;
- _this.bitmap.data[idx + 2] = clr.b;
+ this.bitmap.data[idx] = clr.r;
+ this.bitmap.data[idx + 1] = clr.g;
+ this.bitmap.data[idx + 2] = clr.b;
});
-
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}
-
return this;
}
-
-var _default = function _default() {
- return {
- /**
- * Adjusts the brightness of the image
- * @param {number} val the amount to adjust the brightness, a number between -1 and +1
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- brightness: function brightness(val, cb) {
- if (typeof val !== 'number') {
- return _utils.throwError.call(this, 'val must be numbers', cb);
- }
-
- if (val < -1 || val > +1) {
- return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb);
+const ColorActionName = Object.freeze({
+ LIGHTEN: "lighten",
+ BRIGHTEN: "brighten",
+ DARKEN: "darken",
+ DESATURATE: "desaturate",
+ SATURATE: "saturate",
+ GREYSCALE: "greyscale",
+ SPIN: "spin",
+ HUE: "hue",
+ MIX: "mix",
+ TINT: "tint",
+ SHADE: "shade",
+ XOR: "xor",
+ RED: "red",
+ GREEN: "green",
+ BLUE: "blue"
+});
+exports.ColorActionName = ColorActionName;
+var _default = () => ({
+ /**
+ * Adjusts the brightness of the image
+ * @param {number} val the amount to adjust the brightness, a number between -1 and +1
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ brightness(val, cb) {
+ if (typeof val !== "number") {
+ return _utils.throwError.call(this, "val must be numbers", cb);
+ }
+ if (val < -1 || val > +1) {
+ return _utils.throwError.call(this, "val must be a number between -1 and +1", cb);
+ }
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ if (val < 0.0) {
+ this.bitmap.data[idx] *= 1 + val;
+ this.bitmap.data[idx + 1] *= 1 + val;
+ this.bitmap.data[idx + 2] *= 1 + val;
+ } else {
+ this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val;
+ this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val;
+ this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val;
}
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Adjusts the contrast of the image
+ * @param {number} val the amount to adjust the contrast, a number between -1 and +1
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ contrast(val, cb) {
+ if (typeof val !== "number") {
+ return _utils.throwError.call(this, "val must be numbers", cb);
+ }
+ if (val < -1 || val > +1) {
+ return _utils.throwError.call(this, "val must be a number between -1 and +1", cb);
+ }
+ const factor = (val + 1) / (1 - val);
+ function adjust(value) {
+ value = Math.floor(factor * (value - 127) + 127);
+ return value < 0 ? 0 : value > 255 ? 255 : value;
+ }
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);
+ this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);
+ this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Apply a posterize effect
+ * @param {number} n the amount to adjust the contrast, minimum threshold is two
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ posterize(n, cb) {
+ if (typeof n !== "number") {
+ return _utils.throwError.call(this, "n must be numbers", cb);
+ }
+ if (n < 2) {
+ n = 2;
+ } // minimum of 2 levels
+
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255;
+ this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255;
+ this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255;
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Removes colour from the image using ITU Rec 709 luminance values
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ greyscale,
+ // Alias of greyscale for our American friends
+ grayscale: greyscale,
+ /**
+ * Multiplies the opacity of each pixel by a factor between 0 and 1
+ * @param {number} f A number, the factor by which to multiply the opacity of each pixel
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ opacity(f, cb) {
+ if (typeof f !== "number") return _utils.throwError.call(this, "f must be a number", cb);
+ if (f < 0 || f > 1) return _utils.throwError.call(this, "f must be a number from 0 to 1", cb);
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ const v = this.bitmap.data[idx + 3] * f;
+ this.bitmap.data[idx + 3] = v;
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Applies a sepia tone to the image
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ sepia(cb) {
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ let red = this.bitmap.data[idx];
+ let green = this.bitmap.data[idx + 1];
+ let blue = this.bitmap.data[idx + 2];
+ red = red * 0.393 + green * 0.769 + blue * 0.189;
+ green = red * 0.349 + green * 0.686 + blue * 0.168;
+ blue = red * 0.272 + green * 0.534 + blue * 0.131;
+ this.bitmap.data[idx] = red < 255 ? red : 255;
+ this.bitmap.data[idx + 1] = green < 255 ? green : 255;
+ this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Fades each pixel by a factor between 0 and 1
+ * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ fade(f, cb) {
+ if (typeof f !== "number") {
+ return _utils.throwError.call(this, "f must be a number", cb);
+ }
+ if (f < 0 || f > 1) {
+ return _utils.throwError.call(this, "f must be a number from 0 to 1", cb);
+ }
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- if (val < 0.0) {
- this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val);
- this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val);
- this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val);
- } else {
- this.bitmap.data[idx] = this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val;
- this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val;
- this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val;
+ // this method is an alternative to opacity (which may be deprecated)
+ this.opacity(1 - f);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Adds each element of the image to its local neighbors, weighted by the kernel
+ * @param {array} kernel a matrix to weight the neighbors sum
+ * @param {number} edgeHandling (optional) define how to sum pixels from outside the border
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ convolution(kernel, edgeHandling, cb) {
+ if (typeof edgeHandling === "function" && typeof cb === "undefined") {
+ cb = edgeHandling;
+ edgeHandling = null;
+ }
+ if (!edgeHandling) {
+ edgeHandling = this.constructor.EDGE_EXTEND;
+ }
+ const newData = Buffer.from(this.bitmap.data);
+ const kRows = kernel.length;
+ const kCols = kernel[0].length;
+ const rowEnd = Math.floor(kRows / 2);
+ const colEnd = Math.floor(kCols / 2);
+ const rowIni = -rowEnd;
+ const colIni = -colEnd;
+ let weight;
+ let rSum;
+ let gSum;
+ let bSum;
+ let ri;
+ let gi;
+ let bi;
+ let xi;
+ let yi;
+ let idxi;
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ bSum = 0;
+ gSum = 0;
+ rSum = 0;
+ for (let row = rowIni; row <= rowEnd; row++) {
+ for (let col = colIni; col <= colEnd; col++) {
+ xi = x + col;
+ yi = y + row;
+ weight = kernel[row + rowEnd][col + colEnd];
+ idxi = this.getPixelIndex(xi, yi, edgeHandling);
+ if (idxi === -1) {
+ bi = 0;
+ gi = 0;
+ ri = 0;
+ } else {
+ ri = this.bitmap.data[idxi + 0];
+ gi = this.bitmap.data[idxi + 1];
+ bi = this.bitmap.data[idxi + 2];
+ }
+ rSum += weight * ri;
+ gSum += weight * gi;
+ bSum += weight * bi;
}
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Adjusts the contrast of the image
- * @param {number} val the amount to adjust the contrast, a number between -1 and +1
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- contrast: function contrast(val, cb) {
- if (typeof val !== 'number') {
- return _utils.throwError.call(this, 'val must be numbers', cb);
- }
-
- if (val < -1 || val > +1) {
- return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb);
}
-
- var factor = (val + 1) / (1 - val);
-
- function adjust(value) {
- value = Math.floor(factor * (value - 127) + 127);
- return value < 0 ? 0 : value > 255 ? 255 : value;
- }
-
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);
- this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);
- this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (rSum < 0) {
+ rSum = 0;
}
-
- return this;
- },
-
- /**
- * Apply a posterize effect
- * @param {number} n the amount to adjust the contrast, minimum threshold is two
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- posterize: function posterize(n, cb) {
- if (typeof n !== 'number') {
- return _utils.throwError.call(this, 'n must be numbers', cb);
+ if (gSum < 0) {
+ gSum = 0;
}
-
- if (n < 2) {
- n = 2;
- } // minimum of 2 levels
-
-
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255;
- this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255;
- this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255;
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (bSum < 0) {
+ bSum = 0;
}
-
- return this;
- },
-
- /**
- * Removes colour from the image using ITU Rec 709 luminance values
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- greyscale: greyscale,
- // Alias of greyscale for our American friends
- grayscale: greyscale,
-
- /**
- * Multiplies the opacity of each pixel by a factor between 0 and 1
- * @param {number} f A number, the factor by which to multiply the opacity of each pixel
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- opacity: function opacity(f, cb) {
- if (typeof f !== 'number') return _utils.throwError.call(this, 'f must be a number', cb);
- if (f < 0 || f > 1) return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb);
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var v = this.bitmap.data[idx + 3] * f;
- this.bitmap.data[idx + 3] = v;
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (rSum > 255) {
+ rSum = 255;
}
-
- return this;
- },
-
- /**
- * Applies a sepia tone to the image
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- sepia: function sepia(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var red = this.bitmap.data[idx];
- var green = this.bitmap.data[idx + 1];
- var blue = this.bitmap.data[idx + 2];
- red = red * 0.393 + green * 0.769 + blue * 0.189;
- green = red * 0.349 + green * 0.686 + blue * 0.168;
- blue = red * 0.272 + green * 0.534 + blue * 0.131;
- this.bitmap.data[idx] = red < 255 ? red : 255;
- this.bitmap.data[idx + 1] = green < 255 ? green : 255;
- this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (gSum > 255) {
+ gSum = 255;
}
-
- return this;
- },
-
- /**
- * Fades each pixel by a factor between 0 and 1
- * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- fade: function fade(f, cb) {
- if (typeof f !== 'number') {
- return _utils.throwError.call(this, 'f must be a number', cb);
+ if (bSum > 255) {
+ bSum = 255;
}
-
- if (f < 0 || f > 1) {
- return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb);
- } // this method is an alternative to opacity (which may be deprecated)
-
-
- this.opacity(1 - f);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ newData[idx + 0] = rSum;
+ newData[idx + 1] = gSum;
+ newData[idx + 2] = bSum;
+ });
+ this.bitmap.data = newData;
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Set the alpha channel on every pixel to fully opaque
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ opaque(cb) {
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ this.bitmap.data[idx + 3] = 255;
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Pixelates the image or a region
+ * @param {number} size the size of the pixels
+ * @param {number} x (optional) the x position of the region to pixelate
+ * @param {number} y (optional) the y position of the region to pixelate
+ * @param {number} w (optional) the width of the region to pixelate
+ * @param {number} h (optional) the height of the region to pixelate
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ pixelate(size, x, y, w, h, cb) {
+ if (typeof x === "function") {
+ cb = x;
+ h = null;
+ w = null;
+ y = null;
+ x = null;
+ } else {
+ if (typeof size !== "number") {
+ return _utils.throwError.call(this, "size must be a number", cb);
}
-
- return this;
- },
-
- /**
- * Adds each element of the image to its local neighbors, weighted by the kernel
- * @param {array} kernel a matrix to weight the neighbors sum
- * @param {string} edgeHandling (optional) define how to sum pixels from outside the border
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- convolution: function convolution(kernel, edgeHandling, cb) {
- if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {
- cb = edgeHandling;
- edgeHandling = null;
+ if (isDef(x) && typeof x !== "number") {
+ return _utils.throwError.call(this, "x must be a number", cb);
}
-
- if (!edgeHandling) {
- edgeHandling = this.constructor.EDGE_EXTEND;
+ if (isDef(y) && typeof y !== "number") {
+ return _utils.throwError.call(this, "y must be a number", cb);
}
-
- var newData = Buffer.from(this.bitmap.data);
- var kRows = kernel.length;
- var kCols = kernel[0].length;
- var rowEnd = Math.floor(kRows / 2);
- var colEnd = Math.floor(kCols / 2);
- var rowIni = -rowEnd;
- var colIni = -colEnd;
- var weight;
- var rSum;
- var gSum;
- var bSum;
- var ri;
- var gi;
- var bi;
- var xi;
- var yi;
- var idxi;
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- bSum = 0;
- gSum = 0;
- rSum = 0;
-
- for (var row = rowIni; row <= rowEnd; row++) {
- for (var col = colIni; col <= colEnd; col++) {
- xi = x + col;
- yi = y + row;
- weight = kernel[row + rowEnd][col + colEnd];
- idxi = this.getPixelIndex(xi, yi, edgeHandling);
-
- if (idxi === -1) {
- bi = 0;
- gi = 0;
- ri = 0;
- } else {
- ri = this.bitmap.data[idxi + 0];
- gi = this.bitmap.data[idxi + 1];
- bi = this.bitmap.data[idxi + 2];
- }
-
- rSum += weight * ri;
- gSum += weight * gi;
- bSum += weight * bi;
- }
- }
-
- if (rSum < 0) {
- rSum = 0;
- }
-
- if (gSum < 0) {
- gSum = 0;
- }
-
- if (bSum < 0) {
- bSum = 0;
- }
-
- if (rSum > 255) {
- rSum = 255;
- }
-
- if (gSum > 255) {
- gSum = 255;
- }
-
- if (bSum > 255) {
- bSum = 255;
- }
-
- newData[idx + 0] = rSum;
- newData[idx + 1] = gSum;
- newData[idx + 2] = bSum;
- });
- this.bitmap.data = newData;
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (isDef(w) && typeof w !== "number") {
+ return _utils.throwError.call(this, "w must be a number", cb);
}
-
- return this;
- },
-
- /**
- * Set the alpha channel on every pixel to fully opaque
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- opaque: function opaque(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- this.bitmap.data[idx + 3] = 255;
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (isDef(h) && typeof h !== "number") {
+ return _utils.throwError.call(this, "h must be a number", cb);
}
-
- return this;
- },
-
- /**
- * Pixelates the image or a region
- * @param {number} size the size of the pixels
- * @param {number} x (optional) the x position of the region to pixelate
- * @param {number} y (optional) the y position of the region to pixelate
- * @param {number} w (optional) the width of the region to pixelate
- * @param {number} h (optional) the height of the region to pixelate
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- pixelate: function pixelate(size, x, y, w, h, cb) {
- if (typeof x === 'function') {
- cb = x;
- h = null;
- w = null;
- y = null;
- x = null;
- } else {
- if (typeof size !== 'number') {
- return _utils.throwError.call(this, 'size must be a number', cb);
- }
-
- if (isDef(x) && typeof x !== 'number') {
- return _utils.throwError.call(this, 'x must be a number', cb);
- }
-
- if (isDef(y) && typeof y !== 'number') {
- return _utils.throwError.call(this, 'y must be a number', cb);
- }
-
- if (isDef(w) && typeof w !== 'number') {
- return _utils.throwError.call(this, 'w must be a number', cb);
- }
-
- if (isDef(h) && typeof h !== 'number') {
- return _utils.throwError.call(this, 'h must be a number', cb);
- }
+ }
+ const kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]];
+ x = x || 0;
+ y = y || 0;
+ w = isDef(w) ? w : this.bitmap.width - x;
+ h = isDef(h) ? h : this.bitmap.height - y;
+ const source = this.cloneQuiet();
+ this.scanQuiet(x, y, w, h, function (xx, yx, idx) {
+ xx = size * Math.floor(xx / size);
+ yx = size * Math.floor(yx / size);
+ const value = applyKernel(source, kernel, xx, yx);
+ this.bitmap.data[idx] = value[0];
+ this.bitmap.data[idx + 1] = value[1];
+ this.bitmap.data[idx + 2] = value[2];
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Applies a convolution kernel to the image or a region
+ * @param {array} kernel the convolution kernel
+ * @param {number} x (optional) the x position of the region to apply convolution to
+ * @param {number} y (optional) the y position of the region to apply convolution to
+ * @param {number} w (optional) the width of the region to apply convolution to
+ * @param {number} h (optional) the height of the region to apply convolution to
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ convolute(kernel, x, y, w, h, cb) {
+ if (!Array.isArray(kernel)) return _utils.throwError.call(this, "the kernel must be an array", cb);
+ if (typeof x === "function") {
+ cb = x;
+ x = null;
+ y = null;
+ w = null;
+ h = null;
+ } else {
+ if (isDef(x) && typeof x !== "number") {
+ return _utils.throwError.call(this, "x must be a number", cb);
}
-
- var kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]];
- x = x || 0;
- y = y || 0;
- w = isDef(w) ? w : this.bitmap.width - x;
- h = isDef(h) ? h : this.bitmap.height - y;
- var source = this.cloneQuiet();
- this.scanQuiet(x, y, w, h, function (xx, yx, idx) {
- xx = size * Math.floor(xx / size);
- yx = size * Math.floor(yx / size);
- var value = applyKernel(source, kernel, xx, yx);
- this.bitmap.data[idx] = value[0];
- this.bitmap.data[idx + 1] = value[1];
- this.bitmap.data[idx + 2] = value[2];
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (isDef(y) && typeof y !== "number") {
+ return _utils.throwError.call(this, "y must be a number", cb);
}
-
- return this;
- },
-
- /**
- * Applies a convolution kernel to the image or a region
- * @param {array} kernel the convolution kernel
- * @param {number} x (optional) the x position of the region to apply convolution to
- * @param {number} y (optional) the y position of the region to apply convolution to
- * @param {number} w (optional) the width of the region to apply convolution to
- * @param {number} h (optional) the height of the region to apply convolution to
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- convolute: function convolute(kernel, x, y, w, h, cb) {
- if (!Array.isArray(kernel)) return _utils.throwError.call(this, 'the kernel must be an array', cb);
-
- if (typeof x === 'function') {
- cb = x;
- x = null;
- y = null;
- w = null;
- h = null;
- } else {
- if (isDef(x) && typeof x !== 'number') {
- return _utils.throwError.call(this, 'x must be a number', cb);
- }
-
- if (isDef(y) && typeof y !== 'number') {
- return _utils.throwError.call(this, 'y must be a number', cb);
- }
-
- if (isDef(w) && typeof w !== 'number') {
- return _utils.throwError.call(this, 'w must be a number', cb);
- }
-
- if (isDef(h) && typeof h !== 'number') {
- return _utils.throwError.call(this, 'h must be a number', cb);
- }
+ if (isDef(w) && typeof w !== "number") {
+ return _utils.throwError.call(this, "w must be a number", cb);
}
-
- var ksize = (kernel.length - 1) / 2;
- x = isDef(x) ? x : ksize;
- y = isDef(y) ? y : ksize;
- w = isDef(w) ? w : this.bitmap.width - x;
- h = isDef(h) ? h : this.bitmap.height - y;
- var source = this.cloneQuiet();
- this.scanQuiet(x, y, w, h, function (xx, yx, idx) {
- var value = applyKernel(source, kernel, xx, yx);
- this.bitmap.data[idx] = this.constructor.limit255(value[0]);
- this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);
- this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (isDef(h) && typeof h !== "number") {
+ return _utils.throwError.call(this, "h must be a number", cb);
}
-
- return this;
- },
-
- /**
- * Apply multiple color modification rules
- * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- color: colorFn,
- colour: colorFn
- };
-};
-
-exports["default"] = _default;
-module.exports = exports.default;
+ }
+ x = isDef(x) ? x : 0;
+ y = isDef(y) ? y : 0;
+ w = isDef(w) ? w : this.bitmap.width - x;
+ h = isDef(h) ? h : this.bitmap.height - y;
+ const source = this.cloneQuiet();
+ this.scanQuiet(x, y, w, h, function (xx, yx, idx) {
+ const value = applyKernel(source, kernel, xx, yx);
+ this.bitmap.data[idx] = this.constructor.limit255(value[0]);
+ this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);
+ this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Apply multiple color modification rules
+ * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ color: colorFn,
+ colour: colorFn
+});
+exports.default = _default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map
index 00325b53..7eab365f 100644
--- a/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","throwError","map","action","apply","params","toRgb","colorModifier","i","amount","constructor","limit255","forEach","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","pixelate","w","h","source","cloneQuiet","xx","yx","convolute","ksize","color","colour"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,SAASA,WAAT,CAAqBC,EAArB,EAAyB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B,IAAwB,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAAxB;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACD,OAND;;AAQA,UAAI,0BAAcY,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACM,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD,KA9dmB;;AAgepB;;;;;;AAMA2E,IAAAA,KAAK,EAAEnE,OAtea;AAuepBoE,IAAAA,MAAM,EAAEpE;AAveY,GAAP;AAAA,C","sourcesContent":["import tinyColor from 'tinycolor2';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = v => typeof v !== 'undefined' && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, 'actions must be an array', cb);\n }\n\n actions = actions.map(action => {\n if (action.apply === 'xor' || action.apply === 'mix') {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2]\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach(action => {\n if (action.apply === 'mix') {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === 'tint') {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === 'shade') {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === 'xor') {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b\n };\n } else if (action.apply === 'red') {\n clr.r = colorModifier('r', action.params[0]);\n } else if (action.apply === 'green') {\n clr.g = colorModifier('g', action.params[0]);\n } else if (action.apply === 'blue') {\n clr.b = colorModifier('b', action.params[0]);\n } else {\n if (action.apply === 'hue') {\n action.apply = 'spin';\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n 'action ' + action.apply + ' not supported',\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n if (val < 0.0) {\n this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val);\n this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val);\n this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val);\n } else {\n this.bitmap.data[idx] =\n this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] =\n this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] =\n this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be numbers', cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== 'number')\n return throwError.call(this, 'f must be a number', cb);\n if (f < 0 || f > 1)\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n });\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx + 3] = 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === 'function') {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== 'number') {\n return throwError.call(this, 'size must be a number', cb);\n }\n\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16]\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, 'the kernel must be an array', cb);\n\n if (typeof x === 'function') {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const ksize = (kernel.length - 1) / 2;\n\n x = isDef(x) ? x : ksize;\n y = isDef(y) ? y : ksize;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","isNodePattern","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","throwError","map","action","apply","params","tinyColor","toRgb","colorModifier","i","amount","constructor","limit255","forEach","ColorActionName","Object","freeze","LIGHTEN","BRIGHTEN","DARKEN","DESATURATE","SATURATE","GREYSCALE","SPIN","HUE","MIX","TINT","SHADE","XOR","RED","GREEN","BLUE","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","pixelate","w","h","source","cloneQuiet","xx","yx","convolute","color","colour"],"sources":["../src/index.js"],"sourcesContent":["import tinyColor from \"tinycolor2\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = (v) => typeof v !== \"undefined\" && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b,\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, \"actions must be an array\", cb);\n }\n\n actions = actions.map((action) => {\n if (action.apply === \"xor\" || action.apply === \"mix\") {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach((action) => {\n if (action.apply === \"mix\") {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === \"tint\") {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === \"shade\") {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === \"xor\") {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b,\n };\n } else if (action.apply === \"red\") {\n clr.r = colorModifier(\"r\", action.params[0]);\n } else if (action.apply === \"green\") {\n clr.g = colorModifier(\"g\", action.params[0]);\n } else if (action.apply === \"blue\") {\n clr.b = colorModifier(\"b\", action.params[0]);\n } else {\n if (action.apply === \"hue\") {\n action.apply = \"spin\";\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n \"action \" + action.apply + \" not supported\",\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport const ColorActionName = Object.freeze({\n LIGHTEN: \"lighten\",\n BRIGHTEN: \"brighten\",\n DARKEN: \"darken\",\n DESATURATE: \"desaturate\",\n SATURATE: \"saturate\",\n GREYSCALE: \"greyscale\",\n SPIN: \"spin\",\n HUE: \"hue\",\n MIX: \"mix\",\n TINT: \"tint\",\n SHADE: \"shade\",\n XOR: \"xor\",\n RED: \"red\",\n GREEN: \"green\",\n BLUE: \"blue\",\n});\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n \"val must be a number between -1 and +1\",\n cb\n );\n }\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n if (val < 0.0) {\n this.bitmap.data[idx] *= 1 + val;\n this.bitmap.data[idx + 1] *= 1 + val;\n this.bitmap.data[idx + 2] *= 1 + val;\n } else {\n this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val;\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n \"val must be a number between -1 and +1\",\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be numbers\", cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== \"number\")\n return throwError.call(this, \"f must be a number\", cb);\n if (f < 0 || f > 1)\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n }\n );\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx + 3] = 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === \"function\") {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== \"number\") {\n return throwError.call(this, \"size must be a number\", cb);\n }\n\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16],\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, \"the kernel must be an array\", cb);\n\n if (typeof x === \"function\") {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n\n x = isDef(x) ? x : 0;\n y = isDef(y) ? y : 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n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AAC;IAC3B;IAEA,OAAO,IAAI;EACb,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACE6F,KAAK,EAAErF,OAAO;EACdsF,MAAM,EAAEtF;AACV,CAAC,CAAC;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-color/es/index.js b/project starter code/node_modules/@jimp/plugin-color/es/index.js
index 2992500a..a10ba164 100644
--- a/project starter code/node_modules/@jimp/plugin-color/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-color/es/index.js
@@ -1,566 +1,477 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
-
-var _tinycolor = _interopRequireDefault(require("tinycolor2"));
-
-var _utils = require("@jimp/utils");
-
+import tinyColor from "tinycolor2";
+import { throwError, isNodePattern } from "@jimp/utils";
function applyKernel(im, kernel, x, y) {
- var value = [0, 0, 0];
- var size = (kernel.length - 1) / 2;
-
- for (var kx = 0; kx < kernel.length; kx += 1) {
- for (var ky = 0; ky < kernel[kx].length; ky += 1) {
- var idx = im.getPixelIndex(x + kx - size, y + ky - size);
+ const value = [0, 0, 0];
+ const size = (kernel.length - 1) / 2;
+ for (let kx = 0; kx < kernel.length; kx += 1) {
+ for (let ky = 0; ky < kernel[kx].length; ky += 1) {
+ const idx = im.getPixelIndex(x + kx - size, y + ky - size);
value[0] += im.bitmap.data[idx] * kernel[kx][ky];
value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];
value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];
}
}
-
return value;
}
-
-var isDef = function isDef(v) {
- return typeof v !== 'undefined' && v !== null;
-};
-
+const isDef = v => typeof v !== "undefined" && v !== null;
function greyscale(cb) {
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10);
+ const grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10);
this.bitmap.data[idx] = grey;
this.bitmap.data[idx + 1] = grey;
this.bitmap.data[idx + 2] = grey;
});
-
- if ((0, _utils.isNodePattern)(cb)) {
+ if (isNodePattern(cb)) {
cb.call(this, null, this);
}
-
return this;
}
-
function mix(clr, clr2) {
- var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
+ let p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
return {
r: (clr2.r - clr.r) * (p / 100) + clr.r,
g: (clr2.g - clr.g) * (p / 100) + clr.g,
b: (clr2.b - clr.b) * (p / 100) + clr.b
};
}
-
function colorFn(actions, cb) {
- var _this = this;
-
if (!actions || !Array.isArray(actions)) {
- return _utils.throwError.call(this, 'actions must be an array', cb);
+ return throwError.call(this, "actions must be an array", cb);
}
-
- actions = actions.map(function (action) {
- if (action.apply === 'xor' || action.apply === 'mix') {
- action.params[0] = (0, _tinycolor["default"])(action.params[0]).toRgb();
+ actions = actions.map(action => {
+ if (action.apply === "xor" || action.apply === "mix") {
+ action.params[0] = tinyColor(action.params[0]).toRgb();
}
-
return action;
});
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var clr = {
- r: _this.bitmap.data[idx],
- g: _this.bitmap.data[idx + 1],
- b: _this.bitmap.data[idx + 2]
- };
-
- var colorModifier = function colorModifier(i, amount) {
- return _this.constructor.limit255(clr[i] + amount);
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {
+ let clr = {
+ r: this.bitmap.data[idx],
+ g: this.bitmap.data[idx + 1],
+ b: this.bitmap.data[idx + 2]
};
-
- actions.forEach(function (action) {
- if (action.apply === 'mix') {
+ const colorModifier = (i, amount) => this.constructor.limit255(clr[i] + amount);
+ actions.forEach(action => {
+ if (action.apply === "mix") {
clr = mix(clr, action.params[0], action.params[1]);
- } else if (action.apply === 'tint') {
+ } else if (action.apply === "tint") {
clr = mix(clr, {
r: 255,
g: 255,
b: 255
}, action.params[0]);
- } else if (action.apply === 'shade') {
+ } else if (action.apply === "shade") {
clr = mix(clr, {
r: 0,
g: 0,
b: 0
}, action.params[0]);
- } else if (action.apply === 'xor') {
+ } else if (action.apply === "xor") {
clr = {
r: clr.r ^ action.params[0].r,
g: clr.g ^ action.params[0].g,
b: clr.b ^ action.params[0].b
};
- } else if (action.apply === 'red') {
- clr.r = colorModifier('r', action.params[0]);
- } else if (action.apply === 'green') {
- clr.g = colorModifier('g', action.params[0]);
- } else if (action.apply === 'blue') {
- clr.b = colorModifier('b', action.params[0]);
+ } else if (action.apply === "red") {
+ clr.r = colorModifier("r", action.params[0]);
+ } else if (action.apply === "green") {
+ clr.g = colorModifier("g", action.params[0]);
+ } else if (action.apply === "blue") {
+ clr.b = colorModifier("b", action.params[0]);
} else {
- var _clr;
-
- if (action.apply === 'hue') {
- action.apply = 'spin';
+ if (action.apply === "hue") {
+ action.apply = "spin";
}
-
- clr = (0, _tinycolor["default"])(clr);
-
+ clr = tinyColor(clr);
if (!clr[action.apply]) {
- return _utils.throwError.call(_this, 'action ' + action.apply + ' not supported', cb);
+ return throwError.call(this, "action " + action.apply + " not supported", cb);
}
-
- clr = (_clr = clr)[action.apply].apply(_clr, (0, _toConsumableArray2["default"])(action.params)).toRgb();
+ clr = clr[action.apply](...action.params).toRgb();
}
});
- _this.bitmap.data[idx] = clr.r;
- _this.bitmap.data[idx + 1] = clr.g;
- _this.bitmap.data[idx + 2] = clr.b;
+ this.bitmap.data[idx] = clr.r;
+ this.bitmap.data[idx + 1] = clr.g;
+ this.bitmap.data[idx + 2] = clr.b;
});
-
- if ((0, _utils.isNodePattern)(cb)) {
+ if (isNodePattern(cb)) {
cb.call(this, null, this);
}
-
return this;
}
-
-var _default = function _default() {
- return {
- /**
- * Adjusts the brightness of the image
- * @param {number} val the amount to adjust the brightness, a number between -1 and +1
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- brightness: function brightness(val, cb) {
- if (typeof val !== 'number') {
- return _utils.throwError.call(this, 'val must be numbers', cb);
- }
-
- if (val < -1 || val > +1) {
- return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb);
+export const ColorActionName = Object.freeze({
+ LIGHTEN: "lighten",
+ BRIGHTEN: "brighten",
+ DARKEN: "darken",
+ DESATURATE: "desaturate",
+ SATURATE: "saturate",
+ GREYSCALE: "greyscale",
+ SPIN: "spin",
+ HUE: "hue",
+ MIX: "mix",
+ TINT: "tint",
+ SHADE: "shade",
+ XOR: "xor",
+ RED: "red",
+ GREEN: "green",
+ BLUE: "blue"
+});
+export default (() => ({
+ /**
+ * Adjusts the brightness of the image
+ * @param {number} val the amount to adjust the brightness, a number between -1 and +1
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ brightness(val, cb) {
+ if (typeof val !== "number") {
+ return throwError.call(this, "val must be numbers", cb);
+ }
+ if (val < -1 || val > +1) {
+ return throwError.call(this, "val must be a number between -1 and +1", cb);
+ }
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ if (val < 0.0) {
+ this.bitmap.data[idx] *= 1 + val;
+ this.bitmap.data[idx + 1] *= 1 + val;
+ this.bitmap.data[idx + 2] *= 1 + val;
+ } else {
+ this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val;
+ this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val;
+ this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val;
}
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Adjusts the contrast of the image
+ * @param {number} val the amount to adjust the contrast, a number between -1 and +1
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ contrast(val, cb) {
+ if (typeof val !== "number") {
+ return throwError.call(this, "val must be numbers", cb);
+ }
+ if (val < -1 || val > +1) {
+ return throwError.call(this, "val must be a number between -1 and +1", cb);
+ }
+ const factor = (val + 1) / (1 - val);
+ function adjust(value) {
+ value = Math.floor(factor * (value - 127) + 127);
+ return value < 0 ? 0 : value > 255 ? 255 : value;
+ }
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);
+ this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);
+ this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Apply a posterize effect
+ * @param {number} n the amount to adjust the contrast, minimum threshold is two
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ posterize(n, cb) {
+ if (typeof n !== "number") {
+ return throwError.call(this, "n must be numbers", cb);
+ }
+ if (n < 2) {
+ n = 2;
+ } // minimum of 2 levels
+
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255;
+ this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255;
+ this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255;
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Removes colour from the image using ITU Rec 709 luminance values
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ greyscale,
+ // Alias of greyscale for our American friends
+ grayscale: greyscale,
+ /**
+ * Multiplies the opacity of each pixel by a factor between 0 and 1
+ * @param {number} f A number, the factor by which to multiply the opacity of each pixel
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ opacity(f, cb) {
+ if (typeof f !== "number") return throwError.call(this, "f must be a number", cb);
+ if (f < 0 || f > 1) return throwError.call(this, "f must be a number from 0 to 1", cb);
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ const v = this.bitmap.data[idx + 3] * f;
+ this.bitmap.data[idx + 3] = v;
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Applies a sepia tone to the image
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ sepia(cb) {
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ let red = this.bitmap.data[idx];
+ let green = this.bitmap.data[idx + 1];
+ let blue = this.bitmap.data[idx + 2];
+ red = red * 0.393 + green * 0.769 + blue * 0.189;
+ green = red * 0.349 + green * 0.686 + blue * 0.168;
+ blue = red * 0.272 + green * 0.534 + blue * 0.131;
+ this.bitmap.data[idx] = red < 255 ? red : 255;
+ this.bitmap.data[idx + 1] = green < 255 ? green : 255;
+ this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Fades each pixel by a factor between 0 and 1
+ * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ fade(f, cb) {
+ if (typeof f !== "number") {
+ return throwError.call(this, "f must be a number", cb);
+ }
+ if (f < 0 || f > 1) {
+ return throwError.call(this, "f must be a number from 0 to 1", cb);
+ }
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- if (val < 0.0) {
- this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val);
- this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val);
- this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val);
- } else {
- this.bitmap.data[idx] = this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val;
- this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val;
- this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val;
+ // this method is an alternative to opacity (which may be deprecated)
+ this.opacity(1 - f);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Adds each element of the image to its local neighbors, weighted by the kernel
+ * @param {array} kernel a matrix to weight the neighbors sum
+ * @param {number} edgeHandling (optional) define how to sum pixels from outside the border
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ convolution(kernel, edgeHandling, cb) {
+ if (typeof edgeHandling === "function" && typeof cb === "undefined") {
+ cb = edgeHandling;
+ edgeHandling = null;
+ }
+ if (!edgeHandling) {
+ edgeHandling = this.constructor.EDGE_EXTEND;
+ }
+ const newData = Buffer.from(this.bitmap.data);
+ const kRows = kernel.length;
+ const kCols = kernel[0].length;
+ const rowEnd = Math.floor(kRows / 2);
+ const colEnd = Math.floor(kCols / 2);
+ const rowIni = -rowEnd;
+ const colIni = -colEnd;
+ let weight;
+ let rSum;
+ let gSum;
+ let bSum;
+ let ri;
+ let gi;
+ let bi;
+ let xi;
+ let yi;
+ let idxi;
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ bSum = 0;
+ gSum = 0;
+ rSum = 0;
+ for (let row = rowIni; row <= rowEnd; row++) {
+ for (let col = colIni; col <= colEnd; col++) {
+ xi = x + col;
+ yi = y + row;
+ weight = kernel[row + rowEnd][col + colEnd];
+ idxi = this.getPixelIndex(xi, yi, edgeHandling);
+ if (idxi === -1) {
+ bi = 0;
+ gi = 0;
+ ri = 0;
+ } else {
+ ri = this.bitmap.data[idxi + 0];
+ gi = this.bitmap.data[idxi + 1];
+ bi = this.bitmap.data[idxi + 2];
+ }
+ rSum += weight * ri;
+ gSum += weight * gi;
+ bSum += weight * bi;
}
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Adjusts the contrast of the image
- * @param {number} val the amount to adjust the contrast, a number between -1 and +1
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- contrast: function contrast(val, cb) {
- if (typeof val !== 'number') {
- return _utils.throwError.call(this, 'val must be numbers', cb);
}
-
- if (val < -1 || val > +1) {
- return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb);
+ if (rSum < 0) {
+ rSum = 0;
}
-
- var factor = (val + 1) / (1 - val);
-
- function adjust(value) {
- value = Math.floor(factor * (value - 127) + 127);
- return value < 0 ? 0 : value > 255 ? 255 : value;
+ if (gSum < 0) {
+ gSum = 0;
}
-
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);
- this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);
- this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (bSum < 0) {
+ bSum = 0;
}
-
- return this;
- },
-
- /**
- * Apply a posterize effect
- * @param {number} n the amount to adjust the contrast, minimum threshold is two
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- posterize: function posterize(n, cb) {
- if (typeof n !== 'number') {
- return _utils.throwError.call(this, 'n must be numbers', cb);
+ if (rSum > 255) {
+ rSum = 255;
}
-
- if (n < 2) {
- n = 2;
- } // minimum of 2 levels
-
-
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255;
- this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255;
- this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255;
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (gSum > 255) {
+ gSum = 255;
}
-
- return this;
- },
-
- /**
- * Removes colour from the image using ITU Rec 709 luminance values
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- greyscale: greyscale,
- // Alias of greyscale for our American friends
- grayscale: greyscale,
-
- /**
- * Multiplies the opacity of each pixel by a factor between 0 and 1
- * @param {number} f A number, the factor by which to multiply the opacity of each pixel
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- opacity: function opacity(f, cb) {
- if (typeof f !== 'number') return _utils.throwError.call(this, 'f must be a number', cb);
- if (f < 0 || f > 1) return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb);
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var v = this.bitmap.data[idx + 3] * f;
- this.bitmap.data[idx + 3] = v;
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (bSum > 255) {
+ bSum = 255;
}
-
- return this;
- },
-
- /**
- * Applies a sepia tone to the image
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- sepia: function sepia(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var red = this.bitmap.data[idx];
- var green = this.bitmap.data[idx + 1];
- var blue = this.bitmap.data[idx + 2];
- red = red * 0.393 + green * 0.769 + blue * 0.189;
- green = red * 0.349 + green * 0.686 + blue * 0.168;
- blue = red * 0.272 + green * 0.534 + blue * 0.131;
- this.bitmap.data[idx] = red < 255 ? red : 255;
- this.bitmap.data[idx + 1] = green < 255 ? green : 255;
- this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Fades each pixel by a factor between 0 and 1
- * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- fade: function fade(f, cb) {
- if (typeof f !== 'number') {
- return _utils.throwError.call(this, 'f must be a number', cb);
+ newData[idx + 0] = rSum;
+ newData[idx + 1] = gSum;
+ newData[idx + 2] = bSum;
+ });
+ this.bitmap.data = newData;
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Set the alpha channel on every pixel to fully opaque
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ opaque(cb) {
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ this.bitmap.data[idx + 3] = 255;
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Pixelates the image or a region
+ * @param {number} size the size of the pixels
+ * @param {number} x (optional) the x position of the region to pixelate
+ * @param {number} y (optional) the y position of the region to pixelate
+ * @param {number} w (optional) the width of the region to pixelate
+ * @param {number} h (optional) the height of the region to pixelate
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ pixelate(size, x, y, w, h, cb) {
+ if (typeof x === "function") {
+ cb = x;
+ h = null;
+ w = null;
+ y = null;
+ x = null;
+ } else {
+ if (typeof size !== "number") {
+ return throwError.call(this, "size must be a number", cb);
}
-
- if (f < 0 || f > 1) {
- return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb);
- } // this method is an alternative to opacity (which may be deprecated)
-
-
- this.opacity(1 - f);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (isDef(x) && typeof x !== "number") {
+ return throwError.call(this, "x must be a number", cb);
}
-
- return this;
- },
-
- /**
- * Adds each element of the image to its local neighbors, weighted by the kernel
- * @param {array} kernel a matrix to weight the neighbors sum
- * @param {string} edgeHandling (optional) define how to sum pixels from outside the border
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- convolution: function convolution(kernel, edgeHandling, cb) {
- if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {
- cb = edgeHandling;
- edgeHandling = null;
+ if (isDef(y) && typeof y !== "number") {
+ return throwError.call(this, "y must be a number", cb);
}
-
- if (!edgeHandling) {
- edgeHandling = this.constructor.EDGE_EXTEND;
+ if (isDef(w) && typeof w !== "number") {
+ return throwError.call(this, "w must be a number", cb);
}
-
- var newData = Buffer.from(this.bitmap.data);
- var kRows = kernel.length;
- var kCols = kernel[0].length;
- var rowEnd = Math.floor(kRows / 2);
- var colEnd = Math.floor(kCols / 2);
- var rowIni = -rowEnd;
- var colIni = -colEnd;
- var weight;
- var rSum;
- var gSum;
- var bSum;
- var ri;
- var gi;
- var bi;
- var xi;
- var yi;
- var idxi;
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- bSum = 0;
- gSum = 0;
- rSum = 0;
-
- for (var row = rowIni; row <= rowEnd; row++) {
- for (var col = colIni; col <= colEnd; col++) {
- xi = x + col;
- yi = y + row;
- weight = kernel[row + rowEnd][col + colEnd];
- idxi = this.getPixelIndex(xi, yi, edgeHandling);
-
- if (idxi === -1) {
- bi = 0;
- gi = 0;
- ri = 0;
- } else {
- ri = this.bitmap.data[idxi + 0];
- gi = this.bitmap.data[idxi + 1];
- bi = this.bitmap.data[idxi + 2];
- }
-
- rSum += weight * ri;
- gSum += weight * gi;
- bSum += weight * bi;
- }
- }
-
- if (rSum < 0) {
- rSum = 0;
- }
-
- if (gSum < 0) {
- gSum = 0;
- }
-
- if (bSum < 0) {
- bSum = 0;
- }
-
- if (rSum > 255) {
- rSum = 255;
- }
-
- if (gSum > 255) {
- gSum = 255;
- }
-
- if (bSum > 255) {
- bSum = 255;
- }
-
- newData[idx + 0] = rSum;
- newData[idx + 1] = gSum;
- newData[idx + 2] = bSum;
- });
- this.bitmap.data = newData;
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (isDef(h) && typeof h !== "number") {
+ return throwError.call(this, "h must be a number", cb);
}
-
- return this;
- },
-
- /**
- * Set the alpha channel on every pixel to fully opaque
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- opaque: function opaque(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- this.bitmap.data[idx + 3] = 255;
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ }
+ const kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]];
+ x = x || 0;
+ y = y || 0;
+ w = isDef(w) ? w : this.bitmap.width - x;
+ h = isDef(h) ? h : this.bitmap.height - y;
+ const source = this.cloneQuiet();
+ this.scanQuiet(x, y, w, h, function (xx, yx, idx) {
+ xx = size * Math.floor(xx / size);
+ yx = size * Math.floor(yx / size);
+ const value = applyKernel(source, kernel, xx, yx);
+ this.bitmap.data[idx] = value[0];
+ this.bitmap.data[idx + 1] = value[1];
+ this.bitmap.data[idx + 2] = value[2];
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Applies a convolution kernel to the image or a region
+ * @param {array} kernel the convolution kernel
+ * @param {number} x (optional) the x position of the region to apply convolution to
+ * @param {number} y (optional) the y position of the region to apply convolution to
+ * @param {number} w (optional) the width of the region to apply convolution to
+ * @param {number} h (optional) the height of the region to apply convolution to
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ convolute(kernel, x, y, w, h, cb) {
+ if (!Array.isArray(kernel)) return throwError.call(this, "the kernel must be an array", cb);
+ if (typeof x === "function") {
+ cb = x;
+ x = null;
+ y = null;
+ w = null;
+ h = null;
+ } else {
+ if (isDef(x) && typeof x !== "number") {
+ return throwError.call(this, "x must be a number", cb);
}
-
- return this;
- },
-
- /**
- * Pixelates the image or a region
- * @param {number} size the size of the pixels
- * @param {number} x (optional) the x position of the region to pixelate
- * @param {number} y (optional) the y position of the region to pixelate
- * @param {number} w (optional) the width of the region to pixelate
- * @param {number} h (optional) the height of the region to pixelate
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- pixelate: function pixelate(size, x, y, w, h, cb) {
- if (typeof x === 'function') {
- cb = x;
- h = null;
- w = null;
- y = null;
- x = null;
- } else {
- if (typeof size !== 'number') {
- return _utils.throwError.call(this, 'size must be a number', cb);
- }
-
- if (isDef(x) && typeof x !== 'number') {
- return _utils.throwError.call(this, 'x must be a number', cb);
- }
-
- if (isDef(y) && typeof y !== 'number') {
- return _utils.throwError.call(this, 'y must be a number', cb);
- }
-
- if (isDef(w) && typeof w !== 'number') {
- return _utils.throwError.call(this, 'w must be a number', cb);
- }
-
- if (isDef(h) && typeof h !== 'number') {
- return _utils.throwError.call(this, 'h must be a number', cb);
- }
+ if (isDef(y) && typeof y !== "number") {
+ return throwError.call(this, "y must be a number", cb);
}
-
- var kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]];
- x = x || 0;
- y = y || 0;
- w = isDef(w) ? w : this.bitmap.width - x;
- h = isDef(h) ? h : this.bitmap.height - y;
- var source = this.cloneQuiet();
- this.scanQuiet(x, y, w, h, function (xx, yx, idx) {
- xx = size * Math.floor(xx / size);
- yx = size * Math.floor(yx / size);
- var value = applyKernel(source, kernel, xx, yx);
- this.bitmap.data[idx] = value[0];
- this.bitmap.data[idx + 1] = value[1];
- this.bitmap.data[idx + 2] = value[2];
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ if (isDef(w) && typeof w !== "number") {
+ return throwError.call(this, "w must be a number", cb);
}
-
- return this;
- },
-
- /**
- * Applies a convolution kernel to the image or a region
- * @param {array} kernel the convolution kernel
- * @param {number} x (optional) the x position of the region to apply convolution to
- * @param {number} y (optional) the y position of the region to apply convolution to
- * @param {number} w (optional) the width of the region to apply convolution to
- * @param {number} h (optional) the height of the region to apply convolution to
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- convolute: function convolute(kernel, x, y, w, h, cb) {
- if (!Array.isArray(kernel)) return _utils.throwError.call(this, 'the kernel must be an array', cb);
-
- if (typeof x === 'function') {
- cb = x;
- x = null;
- y = null;
- w = null;
- h = null;
- } else {
- if (isDef(x) && typeof x !== 'number') {
- return _utils.throwError.call(this, 'x must be a number', cb);
- }
-
- if (isDef(y) && typeof y !== 'number') {
- return _utils.throwError.call(this, 'y must be a number', cb);
- }
-
- if (isDef(w) && typeof w !== 'number') {
- return _utils.throwError.call(this, 'w must be a number', cb);
- }
-
- if (isDef(h) && typeof h !== 'number') {
- return _utils.throwError.call(this, 'h must be a number', cb);
- }
+ if (isDef(h) && typeof h !== "number") {
+ return throwError.call(this, "h must be a number", cb);
}
-
- var ksize = (kernel.length - 1) / 2;
- x = isDef(x) ? x : ksize;
- y = isDef(y) ? y : ksize;
- w = isDef(w) ? w : this.bitmap.width - x;
- h = isDef(h) ? h : this.bitmap.height - y;
- var source = this.cloneQuiet();
- this.scanQuiet(x, y, w, h, function (xx, yx, idx) {
- var value = applyKernel(source, kernel, xx, yx);
- this.bitmap.data[idx] = this.constructor.limit255(value[0]);
- this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);
- this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Apply multiple color modification rules
- * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
- */
- color: colorFn,
- colour: colorFn
- };
-};
-
-exports["default"] = _default;
+ }
+ x = isDef(x) ? x : 0;
+ y = isDef(y) ? y : 0;
+ w = isDef(w) ? w : this.bitmap.width - x;
+ h = isDef(h) ? h : this.bitmap.height - y;
+ const source = this.cloneQuiet();
+ this.scanQuiet(x, y, w, h, function (xx, yx, idx) {
+ const value = applyKernel(source, kernel, xx, yx);
+ this.bitmap.data[idx] = this.constructor.limit255(value[0]);
+ this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);
+ this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Apply multiple color modification rules
+ * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp }this for chaining of methods
+ */
+ color: colorFn,
+ colour: colorFn
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-color/es/index.js.map b/project starter code/node_modules/@jimp/plugin-color/es/index.js.map
index 00325b53..6af0367a 100644
--- a/project starter code/node_modules/@jimp/plugin-color/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-color/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","throwError","map","action","apply","params","toRgb","colorModifier","i","amount","constructor","limit255","forEach","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","pixelate","w","h","source","cloneQuiet","xx","yx","convolute","ksize","color","colour"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,SAASA,WAAT,CAAqBC,EAArB,EAAyBC,MAAzB,EAAiCC,CAAjC,EAAoCC,CAApC,EAAuC;AACrC,MAAMC,KAAK,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAd;AACA,MAAMC,IAAI,GAAG,CAACJ,MAAM,CAACK,MAAP,GAAgB,CAAjB,IAAsB,CAAnC;;AAEA,OAAK,IAAIC,EAAE,GAAG,CAAd,EAAiBA,EAAE,GAAGN,MAAM,CAACK,MAA7B,EAAqCC,EAAE,IAAI,CAA3C,EAA8C;AAC5C,SAAK,IAAIC,EAAE,GAAG,CAAd,EAAiBA,EAAE,GAAGP,MAAM,CAACM,EAAD,CAAN,CAAWD,MAAjC,EAAyCE,EAAE,IAAI,CAA/C,EAAkD;AAChD,UAAMC,GAAG,GAAGT,EAAE,CAACU,aAAH,CAAiBR,CAAC,GAAGK,EAAJ,GAASF,IAA1B,EAAgCF,CAAC,GAAGK,EAAJ,GAASH,IAAzC,CAAZ;AAEAD,MAAAA,KAAK,CAAC,CAAD,CAAL,IAAYJ,EAAE,CAACW,MAAH,CAAUC,IAAV,CAAeH,GAAf,IAAsBR,MAAM,CAACM,EAAD,CAAN,CAAWC,EAAX,CAAlC;AACAJ,MAAAA,KAAK,CAAC,CAAD,CAAL,IAAYJ,EAAE,CAACW,MA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AwF,MAAAA,CAAC,GAAG7E,KAAK,CAAC6E,CAAD,CAAL,GAAWA,CAAX,GAAe,KAAK/E,MAAL,CAAYQ,MAAZ,GAAqBhB,CAAxC;AAEA,UAAMwF,MAAM,GAAG,KAAKC,UAAL,EAAf;AAEA,WAAK3E,SAAL,CAAef,CAAf,EAAkBC,CAAlB,EAAqBsF,CAArB,EAAwBC,CAAxB,EAA2B,UAASG,EAAT,EAAaC,EAAb,EAAiBrF,GAAjB,EAAsB;AAC/C,YAAML,KAAK,GAAGL,WAAW,CAAC4F,MAAD,EAAS1F,MAAT,EAAiB4F,EAAjB,EAAqBC,EAArB,CAAzB;AAEA,aAAKnF,MAAL,CAAYC,IAAZ,CAAiBH,GAAjB,IAAwB,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAAxB;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACD,OAND;;AAQA,UAAI,0BAAcY,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACM,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD,KA9dmB;;AAgepB;;;;;;AAMA2E,IAAAA,KAAK,EAAEnE,OAtea;AAuepBoE,IAAAA,MAAM,EAAEpE;AAveY,GAAP;AAAA,C","sourcesContent":["import tinyColor from 'tinycolor2';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = v => typeof v !== 'undefined' && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, 'actions must be an array', cb);\n }\n\n actions = actions.map(action => {\n if (action.apply === 'xor' || action.apply === 'mix') {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2]\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach(action => {\n if (action.apply === 'mix') {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === 'tint') {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === 'shade') {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === 'xor') {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b\n };\n } else if (action.apply === 'red') {\n clr.r = colorModifier('r', action.params[0]);\n } else if (action.apply === 'green') {\n clr.g = colorModifier('g', action.params[0]);\n } else if (action.apply === 'blue') {\n clr.b = colorModifier('b', action.params[0]);\n } else {\n if (action.apply === 'hue') {\n action.apply = 'spin';\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n 'action ' + action.apply + ' not supported',\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n if (val < 0.0) {\n this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val);\n this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val);\n this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val);\n } else {\n this.bitmap.data[idx] =\n this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] =\n this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] =\n this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be numbers', cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== 'number')\n return throwError.call(this, 'f must be a number', cb);\n if (f < 0 || f > 1)\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n });\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx + 3] = 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === 'function') {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== 'number') {\n return throwError.call(this, 'size must be a number', cb);\n }\n\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16]\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, 'the kernel must be an array', cb);\n\n if (typeof x === 'function') {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const ksize = (kernel.length - 1) / 2;\n\n x = isDef(x) ? x : ksize;\n y = isDef(y) ? y : ksize;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["tinyColor","throwError","isNodePattern","applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","map","action","apply","params","toRgb","colorModifier","i","amount","constructor","limit255","forEach","ColorActionName","Object","freeze","LIGHTEN","BRIGHTEN","DARKEN","DESATURATE","SATURATE","GREYSCALE","SPIN","HUE","MIX","TINT","SHADE","XOR","RED","GREEN","BLUE","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","pixelate","w","h","source","cloneQuiet","xx","yx","convolute","color","colour"],"sources":["../src/index.js"],"sourcesContent":["import tinyColor from \"tinycolor2\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = (v) => typeof v !== \"undefined\" && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b,\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, \"actions must be an array\", cb);\n }\n\n actions = actions.map((action) => {\n if (action.apply === \"xor\" || action.apply === \"mix\") {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach((action) => {\n if (action.apply === \"mix\") {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === \"tint\") {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === \"shade\") {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === \"xor\") {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b,\n };\n } else if (action.apply === \"red\") {\n clr.r = colorModifier(\"r\", action.params[0]);\n } else if (action.apply === \"green\") {\n clr.g = colorModifier(\"g\", action.params[0]);\n } else if (action.apply === \"blue\") {\n clr.b = colorModifier(\"b\", action.params[0]);\n } else {\n if (action.apply === \"hue\") {\n action.apply = \"spin\";\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n \"action \" + action.apply + \" not supported\",\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport const ColorActionName = Object.freeze({\n LIGHTEN: \"lighten\",\n BRIGHTEN: \"brighten\",\n DARKEN: \"darken\",\n DESATURATE: \"desaturate\",\n SATURATE: \"saturate\",\n GREYSCALE: \"greyscale\",\n SPIN: \"spin\",\n HUE: \"hue\",\n MIX: \"mix\",\n TINT: \"tint\",\n SHADE: \"shade\",\n XOR: \"xor\",\n RED: \"red\",\n GREEN: \"green\",\n BLUE: \"blue\",\n});\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n \"val must be a number between -1 and +1\",\n cb\n );\n }\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n if (val < 0.0) {\n this.bitmap.data[idx] *= 1 + val;\n this.bitmap.data[idx + 1] *= 1 + val;\n this.bitmap.data[idx + 2] *= 1 + val;\n } else {\n this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val;\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n \"val must be a number between -1 and +1\",\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be numbers\", cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== \"number\")\n return throwError.call(this, \"f must be a number\", cb);\n if (f < 0 || f > 1)\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n }\n );\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx + 3] = 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === \"function\") {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== \"number\") {\n return throwError.call(this, \"size must be a number\", cb);\n }\n\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16],\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, \"the kernel must be an array\", cb);\n\n if (typeof x === \"function\") {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n\n x = isDef(x) ? x : 0;\n y = isDef(y) ? y : 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn,\n});\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,SAASC,WAAW,CAACC,EAAE,EAAEC,MAAM,EAAEC,CAAC,EAAEC,CAAC,EAAE;EACrC,MAAMC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACvB,MAAMC,IAAI,GAAG,CAACJ,MAAM,CAACK,MAAM,GAAG,CAAC,IAAI,CAAC;EAEpC,KAAK,IAAIC,EAAE,GAAG,CAAC,EAAEA,EAAE,GAAGN,MAAM,CAACK,MAAM,EAAEC,EAAE,IAAI,CAAC,EAAE;IAC5C,KAAK,IAAIC,EAAE,GAAG,CAAC,EAAEA,EAAE,GAAGP,MAAM,CAACM,EAAE,CAAC,CAACD,MAAM,EAAEE,EAAE,IAAI,CAAC,EAAE;MAChD,MAAMC,GAAG,GAAGT,EAAE,CAACU,aAAa,CAACR,CAAC,GAAGK,EAAE,GAAGF,IAAI,EAAEF,CAAC,GAAGK,EAAE,GAAGH,IAAI,CAAC;MAE1DD,KAAK,CAAC,CAAC,CAAC,IAAIJ,EAAE,CAACW,MAAM,CA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,CAACO,MAAM,CAACC,IAAI,CAACH,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAACiC,WAAW,CAACC,QAAQ,CAACvC,KAAK,CAAC,CAAC,CAAC,CAAC;MAC/D,IAAI,CAACO,MAAM,CAACC,IAAI,CAACH,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAACiC,WAAW,CAACC,QAAQ,CAACvC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC;IAEF,IAAIN,aAAa,CAACkB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACE2F,KAAK,EAAEnF,OAAO;EACdoF,MAAM,EAAEpF;AACV,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-color/index.d.ts b/project starter code/node_modules/@jimp/plugin-color/index.d.ts
index c2f897a3..bdf6b3f7 100644
--- a/project starter code/node_modules/@jimp/plugin-color/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-color/index.d.ts
@@ -1,14 +1,22 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
-type ColorActionName =
- | 'mix'
- | 'tint'
- | 'shade'
- | 'xor'
- | 'red'
- | 'green'
- | 'blue'
- | 'hue';
+export enum ColorActionName {
+ LIGHTEN = "lighten",
+ BRIGHTEN = "brighten",
+ DARKEN = "darken",
+ DESATURATE = "desaturate",
+ SATURATE = "saturate",
+ GREYSCALE = "greyscale",
+ SPIN = "spin",
+ HUE = "hue",
+ MIX = "mix",
+ TINT = "tint",
+ SHADE = "shade",
+ XOR = "xor",
+ RED = "red",
+ GREEN = "green",
+ BLUE = "blue",
+}
type ColorAction = {
apply: ColorActionName;
@@ -27,7 +35,7 @@ interface Color {
convolution(kernel: number[][], cb?: ImageCallback): this;
convolution(
kernel: number[][],
- edgeHandling: string,
+ edgeHandling: number,
cb?: ImageCallback
): this;
opaque(cb?: ImageCallback): this;
@@ -53,4 +61,4 @@ interface Color {
colour(actions: ColorAction[], cb?: ImageCallback): this;
}
-export default function(): Color;
+export default function (): Color;
diff --git a/project starter code/node_modules/@jimp/plugin-color/package.json b/project starter code/node_modules/@jimp/plugin-color/package.json
index 100c3b31..e31bb123 100644
--- a/project starter code/node_modules/@jimp/plugin-color/package.json
+++ b/project starter code/node_modules/@jimp/plugin-color/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-color",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Bitmap manipulation to adjust the color in an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,14 +21,13 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
- "tinycolor2": "^1.4.1"
+ "@jimp/utils": "^0.22.12",
+ "tinycolor2": "^1.6.0"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2",
- "@jimp/types": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12",
+ "@jimp/types": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
@@ -35,5 +35,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-color/src/index.js b/project starter code/node_modules/@jimp/plugin-color/src/index.js
index faec203b..451bf2ce 100644
--- a/project starter code/node_modules/@jimp/plugin-color/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-color/src/index.js
@@ -1,5 +1,5 @@
-import tinyColor from 'tinycolor2';
-import { throwError, isNodePattern } from '@jimp/utils';
+import tinyColor from "tinycolor2";
+import { throwError, isNodePattern } from "@jimp/utils";
function applyKernel(im, kernel, x, y) {
const value = [0, 0, 0];
@@ -18,25 +18,27 @@ function applyKernel(im, kernel, x, y) {
return value;
}
-const isDef = v => typeof v !== 'undefined' && v !== null;
+const isDef = (v) => typeof v !== "undefined" && v !== null;
function greyscale(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- const grey = parseInt(
- 0.2126 * this.bitmap.data[idx] +
- 0.7152 * this.bitmap.data[idx + 1] +
- 0.0722 * this.bitmap.data[idx + 2],
- 10
- );
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ const grey = parseInt(
+ 0.2126 * this.bitmap.data[idx] +
+ 0.7152 * this.bitmap.data[idx + 1] +
+ 0.0722 * this.bitmap.data[idx + 2],
+ 10
+ );
- this.bitmap.data[idx] = grey;
- this.bitmap.data[idx + 1] = grey;
- this.bitmap.data[idx + 2] = grey;
- });
+ this.bitmap.data[idx] = grey;
+ this.bitmap.data[idx + 1] = grey;
+ this.bitmap.data[idx + 2] = grey;
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
@@ -49,17 +51,17 @@ function mix(clr, clr2, p = 50) {
return {
r: (clr2.r - clr.r) * (p / 100) + clr.r,
g: (clr2.g - clr.g) * (p / 100) + clr.g,
- b: (clr2.b - clr.b) * (p / 100) + clr.b
+ b: (clr2.b - clr.b) * (p / 100) + clr.b,
};
}
function colorFn(actions, cb) {
if (!actions || !Array.isArray(actions)) {
- return throwError.call(this, 'actions must be an array', cb);
+ return throwError.call(this, "actions must be an array", cb);
}
- actions = actions.map(action => {
- if (action.apply === 'xor' || action.apply === 'mix') {
+ actions = actions.map((action) => {
+ if (action.apply === "xor" || action.apply === "mix") {
action.params[0] = tinyColor(action.params[0]).toRgb();
}
@@ -70,34 +72,34 @@ function colorFn(actions, cb) {
let clr = {
r: this.bitmap.data[idx],
g: this.bitmap.data[idx + 1],
- b: this.bitmap.data[idx + 2]
+ b: this.bitmap.data[idx + 2],
};
const colorModifier = (i, amount) =>
this.constructor.limit255(clr[i] + amount);
- actions.forEach(action => {
- if (action.apply === 'mix') {
+ actions.forEach((action) => {
+ if (action.apply === "mix") {
clr = mix(clr, action.params[0], action.params[1]);
- } else if (action.apply === 'tint') {
+ } else if (action.apply === "tint") {
clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);
- } else if (action.apply === 'shade') {
+ } else if (action.apply === "shade") {
clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);
- } else if (action.apply === 'xor') {
+ } else if (action.apply === "xor") {
clr = {
r: clr.r ^ action.params[0].r,
g: clr.g ^ action.params[0].g,
- b: clr.b ^ action.params[0].b
+ b: clr.b ^ action.params[0].b,
};
- } else if (action.apply === 'red') {
- clr.r = colorModifier('r', action.params[0]);
- } else if (action.apply === 'green') {
- clr.g = colorModifier('g', action.params[0]);
- } else if (action.apply === 'blue') {
- clr.b = colorModifier('b', action.params[0]);
+ } else if (action.apply === "red") {
+ clr.r = colorModifier("r", action.params[0]);
+ } else if (action.apply === "green") {
+ clr.g = colorModifier("g", action.params[0]);
+ } else if (action.apply === "blue") {
+ clr.b = colorModifier("b", action.params[0]);
} else {
- if (action.apply === 'hue') {
- action.apply = 'spin';
+ if (action.apply === "hue") {
+ action.apply = "spin";
}
clr = tinyColor(clr);
@@ -105,7 +107,7 @@ function colorFn(actions, cb) {
if (!clr[action.apply]) {
return throwError.call(
this,
- 'action ' + action.apply + ' not supported',
+ "action " + action.apply + " not supported",
cb
);
}
@@ -126,6 +128,24 @@ function colorFn(actions, cb) {
return this;
}
+export const ColorActionName = Object.freeze({
+ LIGHTEN: "lighten",
+ BRIGHTEN: "brighten",
+ DARKEN: "darken",
+ DESATURATE: "desaturate",
+ SATURATE: "saturate",
+ GREYSCALE: "greyscale",
+ SPIN: "spin",
+ HUE: "hue",
+ MIX: "mix",
+ TINT: "tint",
+ SHADE: "shade",
+ XOR: "xor",
+ RED: "red",
+ GREEN: "green",
+ BLUE: "blue",
+});
+
export default () => ({
/**
* Adjusts the brightness of the image
@@ -134,36 +154,35 @@ export default () => ({
* @returns {Jimp }this for chaining of methods
*/
brightness(val, cb) {
- if (typeof val !== 'number') {
- return throwError.call(this, 'val must be numbers', cb);
+ if (typeof val !== "number") {
+ return throwError.call(this, "val must be numbers", cb);
}
if (val < -1 || val > +1) {
return throwError.call(
this,
- 'val must be a number between -1 and +1',
+ "val must be a number between -1 and +1",
cb
);
}
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- if (val < 0.0) {
- this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val);
- this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val);
- this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val);
- } else {
- this.bitmap.data[idx] =
- this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val;
- this.bitmap.data[idx + 1] =
- this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val;
- this.bitmap.data[idx + 2] =
- this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val;
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ if (val < 0.0) {
+ this.bitmap.data[idx] *= 1 + val;
+ this.bitmap.data[idx + 1] *= 1 + val;
+ this.bitmap.data[idx + 2] *= 1 + val;
+ } else {
+ this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val;
+ this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val;
+ this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val;
+ }
}
- });
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
@@ -179,14 +198,14 @@ export default () => ({
* @returns {Jimp }this for chaining of methods
*/
contrast(val, cb) {
- if (typeof val !== 'number') {
- return throwError.call(this, 'val must be numbers', cb);
+ if (typeof val !== "number") {
+ return throwError.call(this, "val must be numbers", cb);
}
if (val < -1 || val > +1) {
return throwError.call(
this,
- 'val must be a number between -1 and +1',
+ "val must be a number between -1 and +1",
cb
);
}
@@ -199,15 +218,17 @@ export default () => ({
return value < 0 ? 0 : value > 255 ? 255 : value;
}
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);
- this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);
- this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);
- });
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);
+ this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);
+ this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
@@ -223,28 +244,30 @@ export default () => ({
* @returns {Jimp }this for chaining of methods
*/
posterize(n, cb) {
- if (typeof n !== 'number') {
- return throwError.call(this, 'n must be numbers', cb);
+ if (typeof n !== "number") {
+ return throwError.call(this, "n must be numbers", cb);
}
if (n < 2) {
n = 2;
} // minimum of 2 levels
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- this.bitmap.data[idx] =
- (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;
- this.bitmap.data[idx + 1] =
- (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *
- 255;
- this.bitmap.data[idx + 2] =
- (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *
- 255;
- });
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ this.bitmap.data[idx] =
+ (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;
+ this.bitmap.data[idx + 1] =
+ (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *
+ 255;
+ this.bitmap.data[idx + 2] =
+ (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *
+ 255;
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
@@ -270,19 +293,21 @@ export default () => ({
* @returns {Jimp }this for chaining of methods
*/
opacity(f, cb) {
- if (typeof f !== 'number')
- return throwError.call(this, 'f must be a number', cb);
+ if (typeof f !== "number")
+ return throwError.call(this, "f must be a number", cb);
if (f < 0 || f > 1)
- return throwError.call(this, 'f must be a number from 0 to 1', cb);
-
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- const v = this.bitmap.data[idx + 3] * f;
- this.bitmap.data[idx + 3] = v;
- });
+ return throwError.call(this, "f must be a number from 0 to 1", cb);
+
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ const v = this.bitmap.data[idx + 3] * f;
+ this.bitmap.data[idx + 3] = v;
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
@@ -297,23 +322,25 @@ export default () => ({
* @returns {Jimp }this for chaining of methods
*/
sepia(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- let red = this.bitmap.data[idx];
- let green = this.bitmap.data[idx + 1];
- let blue = this.bitmap.data[idx + 2];
-
- red = red * 0.393 + green * 0.769 + blue * 0.189;
- green = red * 0.349 + green * 0.686 + blue * 0.168;
- blue = red * 0.272 + green * 0.534 + blue * 0.131;
-
- this.bitmap.data[idx] = red < 255 ? red : 255;
- this.bitmap.data[idx + 1] = green < 255 ? green : 255;
- this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;
- });
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ let red = this.bitmap.data[idx];
+ let green = this.bitmap.data[idx + 1];
+ let blue = this.bitmap.data[idx + 2];
+
+ red = red * 0.393 + green * 0.769 + blue * 0.189;
+ green = red * 0.349 + green * 0.686 + blue * 0.168;
+ blue = red * 0.272 + green * 0.534 + blue * 0.131;
+
+ this.bitmap.data[idx] = red < 255 ? red : 255;
+ this.bitmap.data[idx + 1] = green < 255 ? green : 255;
+ this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
@@ -329,12 +356,12 @@ export default () => ({
* @returns {Jimp }this for chaining of methods
*/
fade(f, cb) {
- if (typeof f !== 'number') {
- return throwError.call(this, 'f must be a number', cb);
+ if (typeof f !== "number") {
+ return throwError.call(this, "f must be a number", cb);
}
if (f < 0 || f > 1) {
- return throwError.call(this, 'f must be a number from 0 to 1', cb);
+ return throwError.call(this, "f must be a number from 0 to 1", cb);
}
// this method is an alternative to opacity (which may be deprecated)
@@ -350,12 +377,12 @@ export default () => ({
/**
* Adds each element of the image to its local neighbors, weighted by the kernel
* @param {array} kernel a matrix to weight the neighbors sum
- * @param {string} edgeHandling (optional) define how to sum pixels from outside the border
+ * @param {number} edgeHandling (optional) define how to sum pixels from outside the border
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp }this for chaining of methods
*/
convolution(kernel, edgeHandling, cb) {
- if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {
+ if (typeof edgeHandling === "function" && typeof cb === "undefined") {
cb = edgeHandling;
edgeHandling = null;
}
@@ -383,66 +410,68 @@ export default () => ({
let yi;
let idxi;
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- bSum = 0;
- gSum = 0;
- rSum = 0;
-
- for (let row = rowIni; row <= rowEnd; row++) {
- for (let col = colIni; col <= colEnd; col++) {
- xi = x + col;
- yi = y + row;
- weight = kernel[row + rowEnd][col + colEnd];
- idxi = this.getPixelIndex(xi, yi, edgeHandling);
-
- if (idxi === -1) {
- bi = 0;
- gi = 0;
- ri = 0;
- } else {
- ri = this.bitmap.data[idxi + 0];
- gi = this.bitmap.data[idxi + 1];
- bi = this.bitmap.data[idxi + 2];
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ bSum = 0;
+ gSum = 0;
+ rSum = 0;
+
+ for (let row = rowIni; row <= rowEnd; row++) {
+ for (let col = colIni; col <= colEnd; col++) {
+ xi = x + col;
+ yi = y + row;
+ weight = kernel[row + rowEnd][col + colEnd];
+ idxi = this.getPixelIndex(xi, yi, edgeHandling);
+
+ if (idxi === -1) {
+ bi = 0;
+ gi = 0;
+ ri = 0;
+ } else {
+ ri = this.bitmap.data[idxi + 0];
+ gi = this.bitmap.data[idxi + 1];
+ bi = this.bitmap.data[idxi + 2];
+ }
+
+ rSum += weight * ri;
+ gSum += weight * gi;
+ bSum += weight * bi;
}
+ }
- rSum += weight * ri;
- gSum += weight * gi;
- bSum += weight * bi;
+ if (rSum < 0) {
+ rSum = 0;
}
- }
- if (rSum < 0) {
- rSum = 0;
- }
+ if (gSum < 0) {
+ gSum = 0;
+ }
- if (gSum < 0) {
- gSum = 0;
- }
+ if (bSum < 0) {
+ bSum = 0;
+ }
- if (bSum < 0) {
- bSum = 0;
- }
+ if (rSum > 255) {
+ rSum = 255;
+ }
- if (rSum > 255) {
- rSum = 255;
- }
+ if (gSum > 255) {
+ gSum = 255;
+ }
- if (gSum > 255) {
- gSum = 255;
- }
+ if (bSum > 255) {
+ bSum = 255;
+ }
- if (bSum > 255) {
- bSum = 255;
+ newData[idx + 0] = rSum;
+ newData[idx + 1] = gSum;
+ newData[idx + 2] = bSum;
}
-
- newData[idx + 0] = rSum;
- newData[idx + 1] = gSum;
- newData[idx + 2] = bSum;
- });
+ );
this.bitmap.data = newData;
@@ -459,13 +488,15 @@ export default () => ({
* @returns {Jimp }this for chaining of methods
*/
opaque(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- this.bitmap.data[idx + 3] = 255;
- });
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ this.bitmap.data[idx + 3] = 255;
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
@@ -485,38 +516,38 @@ export default () => ({
* @returns {Jimp }this for chaining of methods
*/
pixelate(size, x, y, w, h, cb) {
- if (typeof x === 'function') {
+ if (typeof x === "function") {
cb = x;
h = null;
w = null;
y = null;
x = null;
} else {
- if (typeof size !== 'number') {
- return throwError.call(this, 'size must be a number', cb);
+ if (typeof size !== "number") {
+ return throwError.call(this, "size must be a number", cb);
}
- if (isDef(x) && typeof x !== 'number') {
- return throwError.call(this, 'x must be a number', cb);
+ if (isDef(x) && typeof x !== "number") {
+ return throwError.call(this, "x must be a number", cb);
}
- if (isDef(y) && typeof y !== 'number') {
- return throwError.call(this, 'y must be a number', cb);
+ if (isDef(y) && typeof y !== "number") {
+ return throwError.call(this, "y must be a number", cb);
}
- if (isDef(w) && typeof w !== 'number') {
- return throwError.call(this, 'w must be a number', cb);
+ if (isDef(w) && typeof w !== "number") {
+ return throwError.call(this, "w must be a number", cb);
}
- if (isDef(h) && typeof h !== 'number') {
- return throwError.call(this, 'h must be a number', cb);
+ if (isDef(h) && typeof h !== "number") {
+ return throwError.call(this, "h must be a number", cb);
}
}
const kernel = [
[1 / 16, 2 / 16, 1 / 16],
[2 / 16, 4 / 16, 2 / 16],
- [1 / 16, 2 / 16, 1 / 16]
+ [1 / 16, 2 / 16, 1 / 16],
];
x = x || 0;
@@ -526,7 +557,7 @@ export default () => ({
const source = this.cloneQuiet();
- this.scanQuiet(x, y, w, h, function(xx, yx, idx) {
+ this.scanQuiet(x, y, w, h, function (xx, yx, idx) {
xx = size * Math.floor(xx / size);
yx = size * Math.floor(yx / size);
@@ -552,46 +583,44 @@ export default () => ({
* @param {number} w (optional) the width of the region to apply convolution to
* @param {number} h (optional) the height of the region to apply convolution to
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp }this for chaining of methods
+ * @returns {Jimp} this for chaining of methods
*/
convolute(kernel, x, y, w, h, cb) {
if (!Array.isArray(kernel))
- return throwError.call(this, 'the kernel must be an array', cb);
+ return throwError.call(this, "the kernel must be an array", cb);
- if (typeof x === 'function') {
+ if (typeof x === "function") {
cb = x;
x = null;
y = null;
w = null;
h = null;
} else {
- if (isDef(x) && typeof x !== 'number') {
- return throwError.call(this, 'x must be a number', cb);
+ if (isDef(x) && typeof x !== "number") {
+ return throwError.call(this, "x must be a number", cb);
}
- if (isDef(y) && typeof y !== 'number') {
- return throwError.call(this, 'y must be a number', cb);
+ if (isDef(y) && typeof y !== "number") {
+ return throwError.call(this, "y must be a number", cb);
}
- if (isDef(w) && typeof w !== 'number') {
- return throwError.call(this, 'w must be a number', cb);
+ if (isDef(w) && typeof w !== "number") {
+ return throwError.call(this, "w must be a number", cb);
}
- if (isDef(h) && typeof h !== 'number') {
- return throwError.call(this, 'h must be a number', cb);
+ if (isDef(h) && typeof h !== "number") {
+ return throwError.call(this, "h must be a number", cb);
}
}
- const ksize = (kernel.length - 1) / 2;
-
- x = isDef(x) ? x : ksize;
- y = isDef(y) ? y : ksize;
+ x = isDef(x) ? x : 0;
+ y = isDef(y) ? y : 0;
w = isDef(w) ? w : this.bitmap.width - x;
h = isDef(h) ? h : this.bitmap.height - y;
const source = this.cloneQuiet();
- this.scanQuiet(x, y, w, h, function(xx, yx, idx) {
+ this.scanQuiet(x, y, w, h, function (xx, yx, idx) {
const value = applyKernel(source, kernel, xx, yx);
this.bitmap.data[idx] = this.constructor.limit255(value[0]);
@@ -613,5 +642,5 @@ export default () => ({
* @returns {Jimp }this for chaining of methods
*/
color: colorFn,
- colour: colorFn
+ colour: colorFn,
});
diff --git a/project starter code/node_modules/@jimp/plugin-color/test/color.test.js b/project starter code/node_modules/@jimp/plugin-color/test/color.test.js
index 8a396f0d..f7d91e52 100644
--- a/project starter code/node_modules/@jimp/plugin-color/test/color.test.js
+++ b/project starter code/node_modules/@jimp/plugin-color/test/color.test.js
@@ -1,49 +1,50 @@
-import { Jimp, donutJGD } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, donutJGD } from "@jimp/test-utils";
+import configure from "@jimp/custom";
-import color from '../src';
+import color from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [color] }, Jimp);
-describe('canvas color transformation', () => {
+describe("canvas color transformation", () => {
const redDonutJGD = donutJGD(0x00000000, 0xff000088, 0xff0000ff);
- it('can apply more than one color transformation', async () => {
+ it("can apply more than one color transformation", async () => {
const image = await jimp.read(redDonutJGD);
const newJGD = image
.color([
- { apply: 'hue', params: [-180] },
- { apply: 'lighten', params: [25] }
+ { apply: "hue", params: [-180] },
+ { apply: "lighten", params: [25] },
])
.getJGDSync();
- newJGD.should.be.sameJGD(donutJGD(0x40404000, 0x80ffff88, 0x80ffffff));
+ expectToBeJGD(newJGD, donutJGD(0x40404000, 0x80ffff88, 0x80ffffff));
});
- it('lighten', async () => {
+ it("lighten", async () => {
const image = await jimp.read(redDonutJGD);
- image
- .color([{ apply: 'lighten', params: [25] }])
- .getJGDSync()
- .should.be.sameJGD(donutJGD(0x40404000, 0xff808088, 0xff8080ff));
+ expectToBeJGD(
+ image.color([{ apply: "lighten", params: [25] }]).getJGDSync(),
+ donutJGD(0x40404000, 0xff808088, 0xff8080ff)
+ );
});
- it('brighten', async () => {
+ it("brighten", async () => {
const image = await jimp.read(redDonutJGD);
- image
- .color([{ apply: 'brighten', params: [25] }])
- .getJGDSync()
- .should.be.sameJGD(donutJGD(0x40404000, 0xff404088, 0xff4040ff));
+ expectToBeJGD(
+ image.color([{ apply: "brighten", params: [25] }]).getJGDSync(),
+ donutJGD(0x40404000, 0xff404088, 0xff4040ff)
+ );
});
- it('spin hue', async () => {
+ it("spin hue", async () => {
const image = await jimp.read(redDonutJGD);
- image
- .color([{ apply: 'hue', params: [150] }])
- .getJGDSync()
- .should.be.sameJGD(donutJGD(0x00000000, 0x00ff8088, 0x00ff80ff));
+ expectToBeJGD(
+ image.color([{ apply: "hue", params: [150] }]).getJGDSync(),
+ donutJGD(0x00000000, 0x00ff8088, 0x00ff80ff)
+ );
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js b/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js
index e9e8dd63..e7abca10 100644
--- a/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js
+++ b/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js
@@ -1,47 +1,49 @@
-import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils';
-import configure from '@jimp/custom';
-import types from '@jimp/types';
+import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import types from "@jimp/types";
+import expect from "@storybook/expect";
-import color from '../src';
+import color from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ types: [types], plugins: [color] }, Jimp);
-describe('Convolution', function() {
+describe("Convolution", function () {
this.timeout(15000);
const imgs = [
jimp.read(
mkJGD(
- '22222222',
- '22222222',
- '22888822',
- '22888822',
- '22888822',
- '22888822',
- '22222222',
- '22222222'
+ "22222222",
+ "22222222",
+ "22888822",
+ "22888822",
+ "22888822",
+ "22888822",
+ "22222222",
+ "22222222"
)
),
jimp.read(
mkJGD(
- '88222222',
- '88222222',
- '22222222',
- '22222222',
- '22222222',
- '22222222',
- '22222222',
- '22222222'
+ "88222222",
+ "88222222",
+ "22222222",
+ "22222222",
+ "22222222",
+ "22222222",
+ "22222222",
+ "22222222"
)
- )
+ ),
];
let imgMid;
let imgTopLeft; // stores the Jimp instances of the JGD images above.
- before(done => {
+ before((done) => {
Promise.all(imgs)
- .then(imgs => {
+ .then((imgs) => {
imgMid = imgs[0];
imgTopLeft = imgs[1];
done();
@@ -49,136 +51,135 @@ describe('Convolution', function() {
.catch(done);
});
- const sharpM = [[-1, -1, 0], [-1, 1, 1], [0, 1, 1]];
-
- it('3x3 sharp matrix on EDGE_EXTEND', done => {
- imgMid
- .clone()
- .convolution(sharpM)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '22222222',
- '28EEE822',
- '2EFFF802',
- '2EF88002',
- '2EF88002',
- '28800002',
- '22000002',
- '22222222'
- ),
- 'Mid light block'
- );
- imgTopLeft
- .clone()
- .convolution(sharpM)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '80022222',
- '00022222',
- '00022222',
- '22222222',
- '22222222',
- '22222222',
- '22222222',
- '22222222'
- ),
- 'Top left light block'
- );
+ const sharpM = [
+ [-1, -1, 0],
+ [-1, 1, 1],
+ [0, 1, 1],
+ ];
+
+ const blurM = [
+ [1 / 9, 1 / 9, 1 / 9],
+ [1 / 9, 1 / 9, 1 / 9],
+ [1 / 9, 1 / 9, 1 / 9],
+ ];
+
+ it("3x3 sharp matrix on EDGE_EXTEND", (done) => {
+ expectToBeJGD(
+ imgMid.clone().convolution(sharpM).getJGDSync(),
+ mkJGD(
+ "22222222",
+ "28EEE822",
+ "2EFFF802",
+ "2EF88002",
+ "2EF88002",
+ "28800002",
+ "22000002",
+ "22222222"
+ )
+ );
+
+ expectToBeJGD(
+ imgTopLeft.clone().convolution(sharpM).getJGDSync(),
+ mkJGD(
+ "80022222",
+ "00022222",
+ "00022222",
+ "22222222",
+ "22222222",
+ "22222222",
+ "22222222",
+ "22222222"
+ )
+ );
done();
});
- it('3x3 sharp matrix on EDGE_WRAP', done => {
- imgMid
- .clone()
- .convolution(sharpM, jimp.EDGE_WRAP)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '66666666',
- '28EEE822',
- '2EFFF802',
- '2EF88002',
- '2EF88002',
- '28800002',
- '22000002',
- '22222222'
- ),
- 'Mid light block'
- );
- imgTopLeft
- .clone()
- .convolution(sharpM, jimp.EDGE_WRAP)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- 'FC06666F',
- '80022228',
- '00022222',
- '22222222',
- '22222222',
- '22222222',
- '22222222',
- 'E8222228'
- ),
- 'Top left light block'
- );
+ it("3x3 sharp matrix on EDGE_WRAP", (done) => {
+ expectToBeJGD(
+ imgMid.clone().convolution(sharpM, jimp.EDGE_WRAP).getJGDSync(),
+ mkJGD(
+ "22222222",
+ "28EEE822",
+ "2EFFF802",
+ "2EF88002",
+ "2EF88002",
+ "28800002",
+ "22000002",
+ "22222222"
+ )
+ );
+
+ expectToBeJGD(
+ imgTopLeft.clone().convolution(sharpM, jimp.EDGE_WRAP).getJGDSync(),
+ mkJGD(
+ "F802222E",
+ "80022228",
+ "00022222",
+ "22222222",
+ "22222222",
+ "22222222",
+ "22222222",
+ "E8222228"
+ )
+ );
done();
});
- it('3x3 sharp matrix on EDGE_CROP', done => {
- imgMid
- .clone()
- .convolution(sharpM, jimp.EDGE_CROP)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '86666662',
- '68EEE820',
- '6EFFF800',
- '6EF88000',
- '6EF88000',
- '68800000',
- '62000000',
- '20000000'
- ),
- 'Mid light block'
- );
- imgTopLeft
- .clone()
- .convolution(sharpM, jimp.EDGE_CROP)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- 'FC066662',
- 'C0022220',
- '00022220',
- '62222220',
- '62222220',
- '62222220',
- '62222220',
- '20000000'
- ),
- 'Top left light block'
- );
+ it("3x3 sharp matrix on EDGE_CROP", (done) => {
+ expectToBeJGD(
+ imgMid.clone().convolution(sharpM, jimp.EDGE_CROP).getJGDSync(),
+ mkJGD(
+ "86666662",
+ "68EEE820",
+ "6EFFF800",
+ "6EF88000",
+ "6EF88000",
+ "68800000",
+ "62000000",
+ "20000000"
+ )
+ );
+
+ expectToBeJGD(
+ imgTopLeft.clone().convolution(sharpM, jimp.EDGE_CROP).getJGDSync(),
+ mkJGD(
+ "FC066662",
+ "C0022220",
+ "00022220",
+ "62222220",
+ "62222220",
+ "62222220",
+ "62222220",
+ "20000000"
+ )
+ );
done();
});
- it('new pixel value is greater than 255', async () => {
+ it("3x3 box blur matrix using convolute", async () => {
+ const expectedImg = await jimp.read(
+ getTestDir(__dirname) + "/images/tiles-blurred.png"
+ );
+
+ const image = await jimp.read(getTestDir(__dirname) + "/images/tiles.jpg");
+
+ expect(image.convolute(blurM).bitmap.data).toEqual(expectedImg.bitmap.data);
+ });
+
+ it("new pixel value is greater than 255", async () => {
const expectedImg = await jimp.read(
- getTestDir(__dirname) + '/images/qr-convoluted.png'
+ getTestDir(__dirname) + "/images/qr-convoluted.png"
);
- const image = await jimp.read(getTestDir(__dirname) + '/images/qr.jpg');
+ const image = await jimp.read(getTestDir(__dirname) + "/images/qr.jpg");
- image
- .convolution([
+ expect(
+ image.convolution([
[0, 0, 0, 0, 0],
[0, 1, 1, 1, 0],
[0, 1, 0, 1, 0],
[0, 1, 1, 1, 0],
- [0, 0, 0, 0, 0]
- ])
- .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ [0, 0, 0, 0, 0],
+ ]).bitmap.data
+ ).toEqual(expectedImg.bitmap.data);
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-color/test/images/tiles-blurred.png b/project starter code/node_modules/@jimp/plugin-color/test/images/tiles-blurred.png
new file mode 100644
index 00000000..5b3da9b6
Binary files /dev/null and b/project starter code/node_modules/@jimp/plugin-color/test/images/tiles-blurred.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-color/test/images/tiles.jpg b/project starter code/node_modules/@jimp/plugin-color/test/images/tiles.jpg
new file mode 100644
index 00000000..538c77e4
Binary files /dev/null and b/project starter code/node_modules/@jimp/plugin-color/test/images/tiles.jpg differ
diff --git a/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md
index 26394e0f..3d839517 100644
--- a/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md
@@ -1,3 +1,65 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +74,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +82,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-contain/README.md b/project starter code/node_modules/@jimp/plugin-contain/README.md
index 6613e4dd..187cdc75 100644
--- a/project starter code/node_modules/@jimp/plugin-contain/README.md
+++ b/project starter code/node_modules/@jimp/plugin-contain/README.md
@@ -16,10 +16,10 @@ Scale the image to the given width and height keeping the aspect ratio. Some par
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.contain(150, 100);
}
diff --git a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js b/project starter code/node_modules/@jimp/plugin-contain/dist/index.js
index ff05a1a7..33da2966 100644
--- a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-contain/dist/index.js
@@ -3,10 +3,8 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.
* @param {number} w the width to resize the image to
@@ -16,60 +14,52 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- contain: function contain(w, h, alignBits, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers', cb);
- } // permit any sort of optional parameters combination
-
-
- if (typeof alignBits === 'string') {
- if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode;
- mode = alignBits;
- alignBits = null;
- }
-
- if (typeof alignBits === 'function') {
- if (typeof cb === 'undefined') cb = alignBits;
- mode = null;
- alignBits = null;
- }
-
- if (typeof mode === 'function' && typeof cb === 'undefined') {
- cb = mode;
- mode = null;
- }
-
- alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE;
- var hbits = alignBits & (1 << 3) - 1;
- var vbits = alignBits >> 3; // check if more flags than one is in the bit sets
-
- if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) {
- return _utils.throwError.call(this, 'only use one flag per alignment direction', cb);
- }
-
- var alignH = hbits >> 1; // 0, 1, 2
-
- var alignV = vbits >> 1; // 0, 1, 2
-
- var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width;
- var c = this.cloneQuiet().scale(f, mode);
- this.resize(w, h, mode);
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- this.bitmap.data.writeUInt32BE(this._background, idx);
- });
- this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV);
+var _default = () => ({
+ contain(w, h, alignBits, mode, cb) {
+ if (typeof w !== "number" || typeof h !== "number") {
+ return _utils.throwError.call(this, "w and h must be numbers", cb);
+ }
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
+ // permit any sort of optional parameters combination
+ if (typeof alignBits === "string") {
+ if (typeof mode === "function" && typeof cb === "undefined") cb = mode;
+ mode = alignBits;
+ alignBits = null;
+ }
+ if (typeof alignBits === "function") {
+ if (typeof cb === "undefined") cb = alignBits;
+ mode = null;
+ alignBits = null;
+ }
+ if (typeof mode === "function" && typeof cb === "undefined") {
+ cb = mode;
+ mode = null;
+ }
+ alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE;
+ const hbits = alignBits & (1 << 3) - 1;
+ const vbits = alignBits >> 3;
- return this;
+ // check if more flags than one is in the bit sets
+ if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) {
+ return _utils.throwError.call(this, "only use one flag per alignment direction", cb);
}
- };
-};
+ const alignH = hbits >> 1; // 0, 1, 2
+ const alignV = vbits >> 1; // 0, 1, 2
-exports["default"] = _default;
+ const f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width;
+ const c = this.cloneQuiet().scale(f, mode);
+ this.resize(w, h, mode);
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ this.bitmap.data.writeUInt32BE(this._background, idx);
+ });
+ this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map
index 62c5b292..2975ecb4 100644
--- a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["contain","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,OADoB,mBACZC,CADY,EACTC,CADS,EACNC,SADM,EACKC,IADL,EACWC,EADX,EACe;AACjC,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD,OAHgC,CAKjC;;;AACA,UAAI,OAAOF,SAAP,KAAqB,QAAzB,EAAmC;AACjC,YAAI,OAAOC,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6DA,EAAE,GAAGD,IAAL;AAC7DA,QAAAA,IAAI,GAAGD,SAAP;AACAA,QAAAA,SAAS,GAAG,IAAZ;AACD;;AAED,UAAI,OAAOA,SAAP,KAAqB,UAAzB,EAAqC;AACnC,YAAI,OAAOE,EAAP,KAAc,WAAlB,EAA+BA,EAAE,GA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AAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKP,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DM,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,aAAKV,MAAL,CAAYW,IAAZ,CAAiBC,aAAjB,CAA+B,KAAKC,WAApC,EAAiDH,GAAjD;AACD,OAND;AAOA,WAAKI,IAAL,CACEX,CADF,EAEG,CAAC,KAAKH,MAAL,CAAYC,KAAZ,GAAoBE,CAAC,CAACH,MAAF,CAASC,KAA9B,IAAuC,CAAxC,GAA6CJ,MAF/C,EAGG,CAAC,KAAKG,MAAL,CAAYE,MAAZ,GAAqBC,CAAC,CAACH,MAAF,CAASE,MAA/B,IAAyC,CAA1C,GAA+CJ,MAHjD;;AAMA,UAAI,0BAAcT,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAzEmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === 'string') {\n if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === 'function') {\n if (typeof cb === 'undefined') cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["contain","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === \"string\") {\n if (typeof mode === \"function\" && typeof cb === \"undefined\") cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === \"function\") {\n if (typeof cb === \"undefined\") cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n \"only use one flag per alignment direction\",\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n }\n );\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,e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at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-contain/es/index.js b/project starter code/node_modules/@jimp/plugin-contain/es/index.js
index 998bf540..837d35d4 100644
--- a/project starter code/node_modules/@jimp/plugin-contain/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-contain/es/index.js
@@ -1,11 +1,4 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.
@@ -16,59 +9,49 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- contain: function contain(w, h, alignBits, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers', cb);
- } // permit any sort of optional parameters combination
-
-
- if (typeof alignBits === 'string') {
- if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode;
- mode = alignBits;
- alignBits = null;
- }
-
- if (typeof alignBits === 'function') {
- if (typeof cb === 'undefined') cb = alignBits;
- mode = null;
- alignBits = null;
- }
-
- if (typeof mode === 'function' && typeof cb === 'undefined') {
- cb = mode;
- mode = null;
- }
-
- alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE;
- var hbits = alignBits & (1 << 3) - 1;
- var vbits = alignBits >> 3; // check if more flags than one is in the bit sets
-
- if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) {
- return _utils.throwError.call(this, 'only use one flag per alignment direction', cb);
- }
-
- var alignH = hbits >> 1; // 0, 1, 2
-
- var alignV = vbits >> 1; // 0, 1, 2
-
- var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width;
- var c = this.cloneQuiet().scale(f, mode);
- this.resize(w, h, mode);
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- this.bitmap.data.writeUInt32BE(this._background, idx);
- });
- this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
+export default (() => ({
+ contain(w, h, alignBits, mode, cb) {
+ if (typeof w !== "number" || typeof h !== "number") {
+ return throwError.call(this, "w and h must be numbers", cb);
+ }
- return this;
+ // permit any sort of optional parameters combination
+ if (typeof alignBits === "string") {
+ if (typeof mode === "function" && typeof cb === "undefined") cb = mode;
+ mode = alignBits;
+ alignBits = null;
}
- };
-};
+ if (typeof alignBits === "function") {
+ if (typeof cb === "undefined") cb = alignBits;
+ mode = null;
+ alignBits = null;
+ }
+ if (typeof mode === "function" && typeof cb === "undefined") {
+ cb = mode;
+ mode = null;
+ }
+ alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE;
+ const hbits = alignBits & (1 << 3) - 1;
+ const vbits = alignBits >> 3;
-exports["default"] = _default;
+ // check if more flags than one is in the bit sets
+ if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) {
+ return throwError.call(this, "only use one flag per alignment direction", cb);
+ }
+ const alignH = hbits >> 1; // 0, 1, 2
+ const alignV = vbits >> 1; // 0, 1, 2
+
+ const f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width;
+ const c = this.cloneQuiet().scale(f, mode);
+ this.resize(w, h, mode);
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ this.bitmap.data.writeUInt32BE(this._background, idx);
+ });
+ this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map b/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map
index 62c5b292..9107a9a5 100644
--- a/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["contain","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,OADoB,mBACZC,CADY,EACTC,CADS,EACNC,SADM,EACKC,IADL,EACWC,EADX,EACe;AACjC,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD,OAHgC,CAKjC;;;AACA,UAAI,OAAOF,SAAP,KAAqB,QAAzB,EAAmC;AACjC,YAAI,OAAOC,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6DA,EAAE,GAAGD,IAAL;AAC7DA,QAAAA,IAAI,GAAGD,SAAP;AACAA,QAAAA,SAAS,GAAG,IAAZ;AACD;;AAED,UAAI,OAAOA,SAAP,KAAqB,UAAzB,EAAqC;AACnC,YAAI,OAAOE,EAAP,KAAc,WAAlB,EAA+BA,EAAE,GAAGF,SAAL;AAC/BC,QAAAA,IAAI,GAAG,IAAP;AACAD,QAAAA,SAAS,GAAG,IAAZ;AACD;;AAED,UAAI,OAAOC,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAA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,GAH0D,EAI1D;AACA,aAAKV,MAAL,CAAYW,IAAZ,CAAiBC,aAAjB,CAA+B,KAAKC,WAApC,EAAiDH,GAAjD;AACD,OAND;AAOA,WAAKI,IAAL,CACEX,CADF,EAEG,CAAC,KAAKH,MAAL,CAAYC,KAAZ,GAAoBE,CAAC,CAACH,MAAF,CAASC,KAA9B,IAAuC,CAAxC,GAA6CJ,MAF/C,EAGG,CAAC,KAAKG,MAAL,CAAYE,MAAZ,GAAqBC,CAAC,CAACH,MAAF,CAASE,MAA/B,IAAyC,CAA1C,GAA+CJ,MAHjD;;AAMA,UAAI,0BAAcT,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAzEmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === 'string') {\n if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === 'function') {\n if (typeof cb === 'undefined') cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","throwError","contain","w","h","alignBits","mode","cb","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === \"string\") {\n if (typeof mode === \"function\" && typeof cb === \"undefined\") cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === \"function\") {\n if (typeof cb === \"undefined\") cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n \"only use one flag per alignment direction\",\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n }\n );\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,OAAO,CAACC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAEC,IAAI,EAAEC,EAAE,EAAE;IACjC,IA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AAC,CAAC,CAAC;;IAE3B,MAAMG,CAAC,GACLb,CAAC,GAAGC,CAAC,GAAG,IAAI,CAACa,MAAM,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACE,MAAM,GAC1Cf,CAAC,GAAG,IAAI,CAACa,MAAM,CAACE,MAAM,GACtBhB,CAAC,GAAG,IAAI,CAACc,MAAM,CAACC,KAAK;IAC3B,MAAME,CAAC,GAAG,IAAI,CAACC,UAAU,EAAE,CAACC,KAAK,CAACN,CAAC,EAAEV,IAAI,CAAC;IAE1C,IAAI,CAACiB,MAAM,CAACpB,CAAC,EAAEC,CAAC,EAAEE,IAAI,CAAC;IACvB,IAAI,CAACkB,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACP,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUM,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;MACnB,IAAI,CAACV,MAAM,CAACW,IAAI,CAACC,aAAa,CAAC,IAAI,CAACC,WAAW,EAAEH,GAAG,CAAC;IACvD,CAAC,CACF;IACD,IAAI,CAACI,IAAI,CACPX,CAAC,EACA,CAAC,IAAI,CAACH,MAAM,CAACC,KAAK,GAAGE,CAAC,CAACH,MAAM,CAACC,KAAK,IAAI,CAAC,GAAIJ,MAAM,EAClD,CAAC,IAAI,CAACG,MAAM,CAACE,MAAM,GAAGC,CAAC,CAACH,MAAM,CAACE,MAAM,IAAI,CAAC,GAAIJ,MAAM,CACtD;IAED,IAAIf,aAAa,CAACO,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-contain/index.d.ts b/project starter code/node_modules/@jimp/plugin-contain/index.d.ts
index 7c5e34b0..8c3306d3 100644
--- a/project starter code/node_modules/@jimp/plugin-contain/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-contain/index.d.ts
@@ -1,9 +1,14 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Contain {
contain(w: number, h: number, cb?: ImageCallback): this;
contain(w: number, h: number, mode?: string, cb?: ImageCallback): this;
- contain(w: number, h: number, alignBits?: number, cb?: ImageCallback): this;
+ contain(
+ w: number,
+ h: number,
+ alignBits?: number,
+ cb?: ImageCallback
+ ): this;
contain(
w: number,
h: number,
@@ -13,4 +18,4 @@ interface Contain {
): this;
}
-export default function(): Contain;
+export default function (): Contain;
diff --git a/project starter code/node_modules/@jimp/plugin-contain/package.json b/project starter code/node_modules/@jimp/plugin-contain/package.json
index 6ccbc365..7f4048fc 100644
--- a/project starter code/node_modules/@jimp/plugin-contain/package.json
+++ b/project starter code/node_modules/@jimp/plugin-contain/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-contain",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "contain an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,8 +21,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -30,14 +30,14 @@
"@jimp/plugin-scale": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/plugin-blit": "^0.16.2",
- "@jimp/plugin-resize": "^0.16.2",
- "@jimp/plugin-scale": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/plugin-blit": "^0.22.12",
+ "@jimp/plugin-resize": "^0.22.12",
+ "@jimp/plugin-scale": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-contain/src/index.js b/project starter code/node_modules/@jimp/plugin-contain/src/index.js
index 68ea54b3..1736343c 100644
--- a/project starter code/node_modules/@jimp/plugin-contain/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-contain/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern, throwError } from '@jimp/utils';
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.
@@ -11,24 +11,24 @@ import { isNodePattern, throwError } from '@jimp/utils';
*/
export default () => ({
contain(w, h, alignBits, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return throwError.call(this, 'w and h must be numbers', cb);
+ if (typeof w !== "number" || typeof h !== "number") {
+ return throwError.call(this, "w and h must be numbers", cb);
}
// permit any sort of optional parameters combination
- if (typeof alignBits === 'string') {
- if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode;
+ if (typeof alignBits === "string") {
+ if (typeof mode === "function" && typeof cb === "undefined") cb = mode;
mode = alignBits;
alignBits = null;
}
- if (typeof alignBits === 'function') {
- if (typeof cb === 'undefined') cb = alignBits;
+ if (typeof alignBits === "function") {
+ if (typeof cb === "undefined") cb = alignBits;
mode = null;
alignBits = null;
}
- if (typeof mode === 'function' && typeof cb === 'undefined') {
+ if (typeof mode === "function" && typeof cb === "undefined") {
cb = mode;
mode = null;
}
@@ -49,7 +49,7 @@ export default () => ({
) {
return throwError.call(
this,
- 'only use one flag per alignment direction',
+ "only use one flag per alignment direction",
cb
);
}
@@ -64,13 +64,15 @@ export default () => ({
const c = this.cloneQuiet().scale(f, mode);
this.resize(w, h, mode);
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- this.bitmap.data.writeUInt32BE(this._background, idx);
- });
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ this.bitmap.data.writeUInt32BE(this._background, idx);
+ }
+ );
this.blit(
c,
((this.bitmap.width - c.bitmap.width) / 2) * alignH,
@@ -82,5 +84,5 @@ export default () => ({
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js b/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js
index 154ee358..43e0fb42 100644
--- a/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js
+++ b/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js
@@ -1,48 +1,49 @@
-import { Jimp, mkJGD, hasOwnProp } from '@jimp/test-utils';
-import configure from '@jimp/custom';
-import blit from '@jimp/plugin-blit';
-import resize from '@jimp/plugin-resize';
-import scale from '@jimp/plugin-scale';
+import { Jimp, mkJGD, hasOwnProp } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import blit from "@jimp/plugin-blit";
+import resize from "@jimp/plugin-resize";
+import scale from "@jimp/plugin-scale";
-import contain from '../src';
+import contain from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [scale, resize, blit, contain] }, Jimp);
-describe('All align combinations for contain', () => {
+describe("All align combinations for contain", () => {
const verticalJGD = mkJGD(
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆'
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆"
);
const horizontalJGD = mkJGD(
- '▴▴▴▴▴▴▸▸▸▸▸▸',
- '▴▴▴▴▴▴▸▸▸▸▸▸',
- '▴▴▴▴▴▴▸▸▸▸▸▸',
- '▴▴▴▴▴▴▸▸▸▸▸▸',
- '▾▾▾▾▾▾◆◆◆◆◆◆',
- '▾▾▾▾▾▾◆◆◆◆◆◆',
- '▾▾▾▾▾▾◆◆◆◆◆◆',
- '▾▾▾▾▾▾◆◆◆◆◆◆'
+ "▴▴▴▴▴▴▸▸▸▸▸▸",
+ "▴▴▴▴▴▴▸▸▸▸▸▸",
+ "▴▴▴▴▴▴▸▸▸▸▸▸",
+ "▴▴▴▴▴▴▸▸▸▸▸▸",
+ "▾▾▾▾▾▾◆◆◆◆◆◆",
+ "▾▾▾▾▾▾◆◆◆◆◆◆",
+ "▾▾▾▾▾▾◆◆◆◆◆◆",
+ "▾▾▾▾▾▾◆◆◆◆◆◆"
);
let vertical;
let horizontal; // stores the Jimp instances of the JGD images above.
- before(done => {
+ before((done) => {
const img1 = jimp.read(verticalJGD);
const img2 = jimp.read(horizontalJGD);
Promise.all([img1, img2])
- .then(images => {
+ .then((images) => {
vertical = images[0];
horizontal = images[1];
done();
@@ -51,79 +52,77 @@ describe('All align combinations for contain', () => {
});
const tests = {}; // Stores the expected result for each alignment combination.
- tests['LEFT TOP'] = {
+ tests["LEFT TOP"] = {
contain: {
- verti: mkJGD('▴▴▸▸ ', '▴▴▸▸ ', '▴▴▸▸ ', '▾▾◆◆ ', '▾▾◆◆ ', '▾▾◆◆ '),
- horiz: mkJGD('▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ', ' ')
- }
+ verti: mkJGD("▴▴▸▸ ", "▴▴▸▸ ", "▴▴▸▸ ", "▾▾◆◆ ", "▾▾◆◆ ", "▾▾◆◆ "),
+ horiz: mkJGD("▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " ", " "),
+ },
};
- tests['CENTER TOP'] = {
+ tests["CENTER TOP"] = {
contain: {
- verti: mkJGD(' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▾▾◆◆ ', ' ▾▾◆◆ ', ' ▾▾◆◆ '),
- horiz: mkJGD('▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ', ' ')
- }
+ verti: mkJGD(" ▴▴▸▸ ", " ▴▴▸▸ ", " ▴▴▸▸ ", " ▾▾◆◆ ", " ▾▾◆◆ ", " ▾▾◆◆ "),
+ horiz: mkJGD("▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " ", " "),
+ },
};
- tests['RIGHT TOP'] = {
+ tests["RIGHT TOP"] = {
contain: {
- verti: mkJGD(' ▴▴▸▸', ' ▴▴▸▸', ' ▴▴▸▸', ' ▾▾◆◆', ' ▾▾◆◆', ' ▾▾◆◆'),
- horiz: mkJGD('▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ', ' ')
- }
+ verti: mkJGD(" ▴▴▸▸", " ▴▴▸▸", " ▴▴▸▸", " ▾▾◆◆", " ▾▾◆◆", " ▾▾◆◆"),
+ horiz: mkJGD("▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " ", " "),
+ },
};
- tests['LEFT MIDDLE'] = {
+ tests["LEFT MIDDLE"] = {
contain: {
- verti: mkJGD('▴▴▸▸ ', '▴▴▸▸ ', '▴▴▸▸ ', '▾▾◆◆ ', '▾▾◆◆ ', '▾▾◆◆ '),
- horiz: mkJGD(' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ')
- }
+ verti: mkJGD("▴▴▸▸ ", "▴▴▸▸ ", "▴▴▸▸ ", "▾▾◆◆ ", "▾▾◆◆ ", "▾▾◆◆ "),
+ horiz: mkJGD(" ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " "),
+ },
};
- tests['CENTER MIDDLE'] = {
+ tests["CENTER MIDDLE"] = {
contain: {
- verti: mkJGD(' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▾▾◆◆ ', ' ▾▾◆◆ ', ' ▾▾◆◆ '),
- horiz: mkJGD(' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ')
- }
+ verti: mkJGD(" ▴▴▸▸ ", " ▴▴▸▸ ", " ▴▴▸▸ ", " ▾▾◆◆ ", " ▾▾◆◆ ", " ▾▾◆◆ "),
+ horiz: mkJGD(" ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " "),
+ },
};
- tests['RIGHT MIDDLE'] = {
+ tests["RIGHT MIDDLE"] = {
contain: {
- verti: mkJGD(' ▴▴▸▸', ' ▴▴▸▸', ' ▴▴▸▸', ' ▾▾◆◆', ' ▾▾◆◆', ' ▾▾◆◆'),
- horiz: mkJGD(' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ')
- }
+ verti: mkJGD(" ▴▴▸▸", " ▴▴▸▸", " ▴▴▸▸", " ▾▾◆◆", " ▾▾◆◆", " ▾▾◆◆"),
+ horiz: mkJGD(" ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " "),
+ },
};
- tests['LEFT BOTTOM'] = {
+ tests["LEFT BOTTOM"] = {
contain: {
- verti: mkJGD('▴▴▸▸ ', '▴▴▸▸ ', '▴▴▸▸ ', '▾▾◆◆ ', '▾▾◆◆ ', '▾▾◆◆ '),
- horiz: mkJGD(' ', ' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆')
- }
+ verti: mkJGD("▴▴▸▸ ", "▴▴▸▸ ", "▴▴▸▸ ", "▾▾◆◆ ", "▾▾◆◆ ", "▾▾◆◆ "),
+ horiz: mkJGD(" ", " ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆"),
+ },
};
- tests['CENTER BOTTOM'] = {
+ tests["CENTER BOTTOM"] = {
contain: {
- verti: mkJGD(' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▾▾◆◆ ', ' ▾▾◆◆ ', ' ▾▾◆◆ '),
- horiz: mkJGD(' ', ' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆')
- }
+ verti: mkJGD(" ▴▴▸▸ ", " ▴▴▸▸ ", " ▴▴▸▸ ", " ▾▾◆◆ ", " ▾▾◆◆ ", " ▾▾◆◆ "),
+ horiz: mkJGD(" ", " ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆"),
+ },
};
- tests['RIGHT BOTTOM'] = {
+ tests["RIGHT BOTTOM"] = {
contain: {
- verti: mkJGD(' ▴▴▸▸', ' ▴▴▸▸', ' ▴▴▸▸', ' ▾▾◆◆', ' ▾▾◆◆', ' ▾▾◆◆'),
- horiz: mkJGD(' ', ' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆')
- }
+ verti: mkJGD(" ▴▴▸▸", " ▴▴▸▸", " ▴▴▸▸", " ▾▾◆◆", " ▾▾◆◆", " ▾▾◆◆"),
+ horiz: mkJGD(" ", " ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆"),
+ },
};
function runAlignTest(align) {
const jgdContainV = tests[align].contain.verti;
const jgdContainH = tests[align].contain.horiz;
- let a = align.split(' ');
- a = Jimp['HORIZONTAL_ALIGN_' + a[0]] | Jimp['VERTICAL_ALIGN_' + a[1]];
- it('contain aligned to ' + align, () => {
- vertical
- .clone()
- .contain(6, 6, a)
- .getJGDSync()
- .should.be.sameJGD(jgdContainV, 'Vertical image');
- horizontal
- .clone()
- .contain(6, 6, a)
- .getJGDSync()
- .should.be.sameJGD(jgdContainH, 'Horizontal image');
+ let a = align.split(" ");
+ a = Jimp["HORIZONTAL_ALIGN_" + a[0]] | Jimp["VERTICAL_ALIGN_" + a[1]];
+ it("contain aligned to " + align, () => {
+ expectToBeJGD(
+ vertical.clone().contain(6, 6, a).getJGDSync(),
+ jgdContainV
+ );
+ expectToBeJGD(
+ horizontal.clone().contain(6, 6, a).getJGDSync(),
+ jgdContainH
+ );
});
}
diff --git a/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md
index 26394e0f..3d839517 100644
--- a/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md
@@ -1,3 +1,65 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +74,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +82,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-cover/README.md b/project starter code/node_modules/@jimp/plugin-cover/README.md
index 22d2ae07..8313aa2c 100644
--- a/project starter code/node_modules/@jimp/plugin-cover/README.md
+++ b/project starter code/node_modules/@jimp/plugin-cover/README.md
@@ -15,10 +15,10 @@ Scale the image so the given width and height keeping the aspect ratio. Some par
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.cover(150, 100);
}
diff --git a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js b/project starter code/node_modules/@jimp/plugin-cover/dist/index.js
index b64d9e5e..18461721 100644
--- a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-cover/dist/index.js
@@ -3,10 +3,8 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.
* @param {number} w the width to resize the image to
@@ -16,44 +14,38 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- cover: function cover(w, h, alignBits, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers', cb);
- }
-
- if (alignBits && typeof alignBits === 'function' && typeof cb === 'undefined') {
- cb = alignBits;
- alignBits = null;
- mode = null;
- } else if (typeof mode === 'function' && typeof cb === 'undefined') {
- cb = mode;
- mode = null;
- }
-
- alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE;
- var hbits = alignBits & (1 << 3) - 1;
- var vbits = alignBits >> 3; // check if more flags than one is in the bit sets
-
- if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, 'only use one flag per alignment direction', cb);
- var alignH = hbits >> 1; // 0, 1, 2
-
- var alignV = vbits >> 1; // 0, 1, 2
-
- var f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height;
- this.scale(f, mode);
- this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+var _default = () => ({
+ cover(w, h, alignBits, mode, cb) {
+ if (typeof w !== "number" || typeof h !== "number") {
+ return _utils.throwError.call(this, "w and h must be numbers", cb);
}
- };
-};
-
-exports["default"] = _default;
+ if (alignBits && typeof alignBits === "function" && typeof cb === "undefined") {
+ cb = alignBits;
+ alignBits = null;
+ mode = null;
+ } else if (typeof mode === "function" && typeof cb === "undefined") {
+ cb = mode;
+ mode = null;
+ }
+ alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE;
+ const hbits = alignBits & (1 << 3) - 1;
+ const vbits = alignBits >> 3;
+
+ // check if more flags than one is in the bit sets
+ if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, "only use one flag per alignment direction", cb);
+ const alignH = hbits >> 1; // 0, 1, 2
+ const alignV = vbits >> 1; // 0, 1, 2
+
+ const f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height;
+ this.scale(f, mode);
+ this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map
index 3e6c688f..8d2bc8d8 100644
--- a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["cover","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","scale","crop"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,KADoB,iBACdC,CADc,EACXC,CADW,EACRC,SADQ,EACGC,IADH,EACSC,EADT,EACa;AAC/B,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,UACEF,SAAS,IACT,OAAOA,SAAP,KAAqB,UADrB,IAEA,OAAOE,EAAP,KAAc,WAHhB,EAIE;AACAA,QAAAA,EAAE,GAAGF,SAAL;AACAA,QAAAA,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A2B,CAA5B,GAAiCY,MAFnC,EAGEb,CAHF,EAIEC,CAJF;;AAOA,UAAI,0BAAcG,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA3DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === 'function' &&\n typeof cb === 'undefined'\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["cover","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","scale","crop","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === \"function\" &&\n typeof cb === \"undefined\"\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n \"only use one flag per alignment direction\",\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,eASe,OAAO;EACpBA,KAAK,CAACC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAEC,IAAI,EAAEC,EAAE,EAAE;IAC/B,IAAI,OAAOJ,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOI,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;IAC7D;IAEA,IACEF,SAAS,IACT,OAAOA,SAAS,KAAK,UAAU,IAC/B,OAAOE,EAAE,KAAK,WAAW,EACzB;MACAA,EAAE,GAAGF,SAAS;MACdA,SAAS,GAAG,IAAI;MAChBC,IAAI,GAAG,IAAI;IACb,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;MAClEA,EAAE,GAAGD,IAAI;MACTA,IAAI,GAAG,IAAI;IACb;IAEAD,SAAS,GACPA,SAAS,IACT,IAAI,CAACK,WAAW,CAACC,uBAAuB,GACtC,IAAI,CAACD,WAAW,CAACE,qBAAqB;IAC1C,MAAMC,KAAK,GAAGR,SAAS,GAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAE;IACxC,MAAMS,KAAK,GAAGT,SAAS,IAAI,CAAC;;IAE5B;IACA,IACE,EACGQ,KAAK,KAAK,CAAC,IAAI,EAAEA,KAAK,GAAIA,KAAK,GAAG,CAAE,CAAC,IACrCC,KAAK,KAAK,CAAC,IAAI,EAAEA,KAAK,GAAIA,KAAK,GAAG,CAAE,CAAE,CACxC,EAED,OAAON,iBAAU,CAACC,IAAI,CACpB,IAAI,EACJ,2CAA2C,EAC3CF,EAAE,CACH;IAEH,MAAMQ,MAAM,GAAGF,KAAK,IAAI,CAAC,CAAC,CAAC;IAC3B,MAAMG,MAAM,GAAGF,KAAK,IAAI,CAAC,CAAC,CAAC;;IAE3B,MAAMG,CAAC,GACLd,CAAC,GAAGC,CAAC,GAAG,IAAI,CAACc,MAAM,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACE,MAAM,GAC1CjB,CAAC,GAAG,IAAI,CAACe,MAAM,CAACC,KAAK,GACrBf,CAAC,GAAG,IAAI,CAACc,MAAM,CAACE,MAAM;IAC5B,IAAI,CAACC,KAAK,CAACJ,CAAC,EAAEX,IAAI,CAAC;IACnB,IAAI,CAACgB,IAAI,CACN,CAAC,IAAI,CAACJ,MAAM,CAACC,KAAK,GAAGhB,CAAC,IAAI,CAAC,GAAIY,MAAM,EACrC,CAAC,IAAI,CAACG,MAAM,CAACE,MAAM,GAAGhB,CAAC,IAAI,CAAC,GAAIY,MAAM,EACvCb,CAAC,EACDC,CAAC,CACF;IAED,IAAI,IAAAmB,oBAAa,EAAChB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-cover/es/index.js b/project starter code/node_modules/@jimp/plugin-cover/es/index.js
index ffae0743..165d9178 100644
--- a/project starter code/node_modules/@jimp/plugin-cover/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-cover/es/index.js
@@ -1,11 +1,4 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.
@@ -16,43 +9,35 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- cover: function cover(w, h, alignBits, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers', cb);
- }
-
- if (alignBits && typeof alignBits === 'function' && typeof cb === 'undefined') {
- cb = alignBits;
- alignBits = null;
- mode = null;
- } else if (typeof mode === 'function' && typeof cb === 'undefined') {
- cb = mode;
- mode = null;
- }
-
- alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE;
- var hbits = alignBits & (1 << 3) - 1;
- var vbits = alignBits >> 3; // check if more flags than one is in the bit sets
-
- if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, 'only use one flag per alignment direction', cb);
- var alignH = hbits >> 1; // 0, 1, 2
-
- var alignV = vbits >> 1; // 0, 1, 2
-
- var f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height;
- this.scale(f, mode);
- this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+export default (() => ({
+ cover(w, h, alignBits, mode, cb) {
+ if (typeof w !== "number" || typeof h !== "number") {
+ return throwError.call(this, "w and h must be numbers", cb);
}
- };
-};
-
-exports["default"] = _default;
+ if (alignBits && typeof alignBits === "function" && typeof cb === "undefined") {
+ cb = alignBits;
+ alignBits = null;
+ mode = null;
+ } else if (typeof mode === "function" && typeof cb === "undefined") {
+ cb = mode;
+ mode = null;
+ }
+ alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE;
+ const hbits = alignBits & (1 << 3) - 1;
+ const vbits = alignBits >> 3;
+
+ // check if more flags than one is in the bit sets
+ if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return throwError.call(this, "only use one flag per alignment direction", cb);
+ const alignH = hbits >> 1; // 0, 1, 2
+ const alignV = vbits >> 1; // 0, 1, 2
+
+ const f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height;
+ this.scale(f, mode);
+ this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map b/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map
index 3e6c688f..edc1c548 100644
--- a/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["cover","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","scale","crop"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,KADoB,iBACdC,CADc,EACXC,CADW,EACRC,SADQ,EACGC,IADH,EACSC,EADT,EACa;AAC/B,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,UACEF,SAAS,IACT,OAAOA,SAAP,KAAqB,UADrB,IAEA,OAAOE,EAAP,KAAc,WAHhB,EAIE;AACAA,QAAAA,EAAE,GAAGF,SAAL;AACAA,QAAAA,SAAS,GAAG,IAAZ;AACAC,QAAAA,IAAI,GAAG,IAAP;AAC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;;AAOA,UAAI,0BAAcG,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA3DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === 'function' &&\n typeof cb === 'undefined'\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","throwError","cover","w","h","alignBits","mode","cb","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","scale","crop"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === \"function\" &&\n typeof cb === \"undefined\"\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n \"only use one flag per alignment direction\",\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,KAAK,CAACC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAEC,IAAI,EAAEC,EAAE,EAAE;IAC/B,IAAI,OAAOJ,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOH,UAAU,CAACO,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAED,EAAE,CAAC;IAC7D;IAEA,IACEF,SAAS,IACT,OAAOA,SAAS,KAAK,UAAU,IAC/B,OAAOE,EAAE,KAAK,WAAW,EACzB;MACAA,EAAE,GAAGF,SAAS;MACdA,SAAS,GAAG,IAAI;MAChBC,IAAI,GAAG,IAAI;IACb,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;MAClEA,EAAE,GAAGD,IAAI;MACTA,IAAI,GAAG,IAAI;IACb;IAEAD,SAAS,GACPA,SAAS,IACT,IAAI,CAACI,WAAW,CAACC,uBAAuB,GACtC,IAAI,CAACD,WAAW,CAACE,qBAAqB;IAC1C,MAAMC,KAAK,GAAGP,SAAS,GAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAE;IACxC,MAAMQ,KAAK,GAAGR,SAAS,IAAI,CAAC;;IAE5B;IACA,IACE,EACGO,KAAK,KAAK,CAAC,IAAI,EAAEA,KAAK,GAAIA,KAAK,GAAG,CAAE,CAAC,IACrCC,KAAK,KAAK,CAAC,IAAI,EAAEA,KAAK,GAAIA,KAAK,GAAG,CAAE,CAAE,CACxC,EAED,OAAOZ,UAAU,CAACO,IAAI,CACpB,IAAI,EACJ,2CAA2C,EAC3CD,EAAE,CACH;IAEH,MAAMO,MAAM,GAAGF,KAAK,IAAI,CAAC,CAAC,CAAC;IAC3B,MAAMG,MAAM,GAAGF,KAAK,IAAI,CAAC,CAAC,CAAC;;IAE3B,MAAMG,CAAC,GACLb,CAAC,GAAGC,CAAC,GAAG,IAAI,CAACa,MAAM,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACE,MAAM,GAC1ChB,CAAC,GAAG,IAAI,CAACc,MAAM,CAACC,KAAK,GACrBd,CAAC,GAAG,IAAI,CAACa,MAAM,CAACE,MAAM;IAC5B,IAAI,CAACC,KAAK,CAACJ,CAAC,EAAEV,IAAI,CAAC;IACnB,IAAI,CAACe,IAAI,CACN,CAAC,IAAI,CAACJ,MAAM,CAACC,KAAK,GAAGf,CAAC,IAAI,CAAC,GAAIW,MAAM,EACrC,CAAC,IAAI,CAACG,MAAM,CAACE,MAAM,GAAGf,CAAC,IAAI,CAAC,GAAIW,MAAM,EACvCZ,CAAC,EACDC,CAAC,CACF;IAED,IAAIJ,aAAa,CAACO,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-cover/index.d.ts b/project starter code/node_modules/@jimp/plugin-cover/index.d.ts
index 19209341..6a9e5d1c 100644
--- a/project starter code/node_modules/@jimp/plugin-cover/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-cover/index.d.ts
@@ -1,8 +1,13 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Cover {
cover(w: number, h: number, cb?: ImageCallback): this;
- cover(w: number, h: number, alignBits?: number, cb?: ImageCallback): this;
+ cover(
+ w: number,
+ h: number,
+ alignBits?: number,
+ cb?: ImageCallback
+ ): this;
cover(
w: number,
h: number,
@@ -12,4 +17,4 @@ interface Cover {
): this;
}
-export default function(): Cover;
+export default function (): Cover;
diff --git a/project starter code/node_modules/@jimp/plugin-cover/package.json b/project starter code/node_modules/@jimp/plugin-cover/package.json
index 81b0bcdd..708db221 100644
--- a/project starter code/node_modules/@jimp/plugin-cover/package.json
+++ b/project starter code/node_modules/@jimp/plugin-cover/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-cover",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "cover an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,8 +21,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -30,14 +30,14 @@
"@jimp/plugin-scale": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/plugin-crop": "^0.16.2",
- "@jimp/plugin-resize": "^0.16.2",
- "@jimp/plugin-scale": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/plugin-crop": "^0.22.12",
+ "@jimp/plugin-resize": "^0.22.12",
+ "@jimp/plugin-scale": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-cover/src/index.js b/project starter code/node_modules/@jimp/plugin-cover/src/index.js
index c290481e..37a0f1b7 100644
--- a/project starter code/node_modules/@jimp/plugin-cover/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-cover/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern, throwError } from '@jimp/utils';
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.
@@ -11,19 +11,19 @@ import { isNodePattern, throwError } from '@jimp/utils';
*/
export default () => ({
cover(w, h, alignBits, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return throwError.call(this, 'w and h must be numbers', cb);
+ if (typeof w !== "number" || typeof h !== "number") {
+ return throwError.call(this, "w and h must be numbers", cb);
}
if (
alignBits &&
- typeof alignBits === 'function' &&
- typeof cb === 'undefined'
+ typeof alignBits === "function" &&
+ typeof cb === "undefined"
) {
cb = alignBits;
alignBits = null;
mode = null;
- } else if (typeof mode === 'function' && typeof cb === 'undefined') {
+ } else if (typeof mode === "function" && typeof cb === "undefined") {
cb = mode;
mode = null;
}
@@ -44,7 +44,7 @@ export default () => ({
)
return throwError.call(
this,
- 'only use one flag per alignment direction',
+ "only use one flag per alignment direction",
cb
);
@@ -68,5 +68,5 @@ export default () => ({
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js b/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js
index fc08ac63..ba61d3bb 100644
--- a/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js
+++ b/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js
@@ -1,48 +1,49 @@
-import { Jimp, mkJGD, hasOwnProp } from '@jimp/test-utils';
-import configure from '@jimp/custom';
-import crop from '@jimp/plugin-crop';
-import scale from '@jimp/plugin-scale';
-import resize from '@jimp/plugin-resize';
+import { Jimp, mkJGD, hasOwnProp } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import crop from "@jimp/plugin-crop";
+import scale from "@jimp/plugin-scale";
+import resize from "@jimp/plugin-resize";
-import cover from '../src';
+import cover from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [resize, scale, crop, cover] }, Jimp);
-describe('All align combinations for cover', () => {
+describe("All align combinations for cover", () => {
const verticalJGD = mkJGD(
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▴▴▴▴▸▸▸▸',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆',
- '▾▾▾▾◆◆◆◆'
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▴▴▴▴▸▸▸▸",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆",
+ "▾▾▾▾◆◆◆◆"
);
const horizontalJGD = mkJGD(
- '▴▴▴▴▴▴▸▸▸▸▸▸',
- '▴▴▴▴▴▴▸▸▸▸▸▸',
- '▴▴▴▴▴▴▸▸▸▸▸▸',
- '▴▴▴▴▴▴▸▸▸▸▸▸',
- '▾▾▾▾▾▾◆◆◆◆◆◆',
- '▾▾▾▾▾▾◆◆◆◆◆◆',
- '▾▾▾▾▾▾◆◆◆◆◆◆',
- '▾▾▾▾▾▾◆◆◆◆◆◆'
+ "▴▴▴▴▴▴▸▸▸▸▸▸",
+ "▴▴▴▴▴▴▸▸▸▸▸▸",
+ "▴▴▴▴▴▴▸▸▸▸▸▸",
+ "▴▴▴▴▴▴▸▸▸▸▸▸",
+ "▾▾▾▾▾▾◆◆◆◆◆◆",
+ "▾▾▾▾▾▾◆◆◆◆◆◆",
+ "▾▾▾▾▾▾◆◆◆◆◆◆",
+ "▾▾▾▾▾▾◆◆◆◆◆◆"
);
let vertical;
let horizontal; // stores the Jimp instances of the JGD images above.
- before(done => {
+ before((done) => {
const img1 = jimp.read(verticalJGD);
const img2 = jimp.read(horizontalJGD);
Promise.all([img1, img2])
- .then(images => {
+ .then((images) => {
vertical = images[0];
horizontal = images[1];
done();
@@ -51,79 +52,71 @@ describe('All align combinations for cover', () => {
});
const tests = {}; // Stores the expected result for each alignment combination.
- tests['LEFT TOP'] = {
+ tests["LEFT TOP"] = {
cover: {
- verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▴▴▸▸', '▾▾◆◆'),
- horiz: mkJGD('▴▴▴▸', '▴▴▴▸', '▾▾▾◆', '▾▾▾◆')
- }
+ verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▴▴▸▸", "▾▾◆◆"),
+ horiz: mkJGD("▴▴▴▸", "▴▴▴▸", "▾▾▾◆", "▾▾▾◆"),
+ },
};
- tests['CENTER TOP'] = {
+ tests["CENTER TOP"] = {
cover: {
- verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▴▴▸▸', '▾▾◆◆'),
- horiz: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆')
- }
+ verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▴▴▸▸", "▾▾◆◆"),
+ horiz: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"),
+ },
};
- tests['RIGHT TOP'] = {
+ tests["RIGHT TOP"] = {
cover: {
- verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▴▴▸▸', '▾▾◆◆'),
- horiz: mkJGD('▴▸▸▸', '▴▸▸▸', '▾◆◆◆', '▾◆◆◆')
- }
+ verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▴▴▸▸", "▾▾◆◆"),
+ horiz: mkJGD("▴▸▸▸", "▴▸▸▸", "▾◆◆◆", "▾◆◆◆"),
+ },
};
- tests['LEFT MIDDLE'] = {
+ tests["LEFT MIDDLE"] = {
cover: {
- verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆'),
- horiz: mkJGD('▴▴▴▸', '▴▴▴▸', '▾▾▾◆', '▾▾▾◆')
- }
+ verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"),
+ horiz: mkJGD("▴▴▴▸", "▴▴▴▸", "▾▾▾◆", "▾▾▾◆"),
+ },
};
- tests['CENTER MIDDLE'] = {
+ tests["CENTER MIDDLE"] = {
cover: {
- verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆'),
- horiz: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆')
- }
+ verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"),
+ horiz: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"),
+ },
};
- tests['RIGHT MIDDLE'] = {
+ tests["RIGHT MIDDLE"] = {
cover: {
- verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆'),
- horiz: mkJGD('▴▸▸▸', '▴▸▸▸', '▾◆◆◆', '▾◆◆◆')
- }
+ verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"),
+ horiz: mkJGD("▴▸▸▸", "▴▸▸▸", "▾◆◆◆", "▾◆◆◆"),
+ },
};
- tests['LEFT BOTTOM'] = {
+ tests["LEFT BOTTOM"] = {
cover: {
- verti: mkJGD('▴▴▸▸', '▾▾◆◆', '▾▾◆◆', '▾▾◆◆'),
- horiz: mkJGD('▴▴▴▸', '▴▴▴▸', '▾▾▾◆', '▾▾▾◆')
- }
+ verti: mkJGD("▴▴▸▸", "▾▾◆◆", "▾▾◆◆", "▾▾◆◆"),
+ horiz: mkJGD("▴▴▴▸", "▴▴▴▸", "▾▾▾◆", "▾▾▾◆"),
+ },
};
- tests['CENTER BOTTOM'] = {
+ tests["CENTER BOTTOM"] = {
cover: {
- verti: mkJGD('▴▴▸▸', '▾▾◆◆', '▾▾◆◆', '▾▾◆◆'),
- horiz: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆')
- }
+ verti: mkJGD("▴▴▸▸", "▾▾◆◆", "▾▾◆◆", "▾▾◆◆"),
+ horiz: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"),
+ },
};
- tests['RIGHT BOTTOM'] = {
+ tests["RIGHT BOTTOM"] = {
cover: {
- verti: mkJGD('▴▴▸▸', '▾▾◆◆', '▾▾◆◆', '▾▾◆◆'),
- horiz: mkJGD('▴▸▸▸', '▴▸▸▸', '▾◆◆◆', '▾◆◆◆')
- }
+ verti: mkJGD("▴▴▸▸", "▾▾◆◆", "▾▾◆◆", "▾▾◆◆"),
+ horiz: mkJGD("▴▸▸▸", "▴▸▸▸", "▾◆◆◆", "▾◆◆◆"),
+ },
};
function runAlignTest(align) {
const jgdCoverV = tests[align].cover.verti;
const jgdCoverH = tests[align].cover.horiz;
- let a = align.split(' ');
- a = Jimp['HORIZONTAL_ALIGN_' + a[0]] | Jimp['VERTICAL_ALIGN_' + a[1]];
- it('cover aligned to ' + align, () => {
- vertical
- .clone()
- .cover(4, 4, a)
- .getJGDSync()
- .should.be.sameJGD(jgdCoverV, 'Vertical image');
- horizontal
- .clone()
- .cover(4, 4, a)
- .getJGDSync()
- .should.be.sameJGD(jgdCoverH, 'Horizontal image');
+ let a = align.split(" ");
+ a = Jimp["HORIZONTAL_ALIGN_" + a[0]] | Jimp["VERTICAL_ALIGN_" + a[1]];
+ it("cover aligned to " + align, () => {
+ expectToBeJGD(vertical.clone().cover(4, 4, a).getJGDSync(), jgdCoverV);
+ expectToBeJGD(horizontal.clone().cover(4, 4, a).getJGDSync(), jgdCoverH);
});
}
diff --git a/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md
index d74238e7..ffe751ec 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md
@@ -1,3 +1,86 @@
+# v0.22.8 (Thu May 11 2023)
+
+:tada: This release contains work from a new contributor! :tada:
+
+Thank you, Sjoerd ([@sjoerd108](https://github.com/sjoerd108)), for all your work!
+
+#### 🐛 Bug Fix
+
+- Fix autocrop mixing up east and west [#1227](https://github.com/jimp-dev/jimp/pull/1227) ([@sjoerd108](https://github.com/sjoerd108))
+
+#### Authors: 1
+
+- Sjoerd ([@sjoerd108](https://github.com/sjoerd108))
+
+---
+
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### 🐛 Bug Fix
+
+- fixed plugin-crop full width slices math [#1073](https://github.com/jimp-dev/jimp/pull/1073) ([@endreszabo](https://github.com/endreszabo))
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Endre Szabo ([@endreszabo](https://github.com/endreszabo))
+
+---
+
# v0.16.0 (Sat Aug 08 2020)
#### 🚀 Enhancement
@@ -24,7 +107,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -32,4 +115,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-crop/README.md b/project starter code/node_modules/@jimp/plugin-crop/README.md
index 86ea04dd..64689368 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/README.md
+++ b/project starter code/node_modules/@jimp/plugin-crop/README.md
@@ -16,10 +16,10 @@ Crops the image at a given point to a give size
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.crop(150, 150);
}
@@ -43,10 +43,10 @@ or
- leaveBorder (optional): integer of how many pixels of the background color to leave around the image
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.autocrop();
image.autocrop({ cropOnlyFrames: false, cropSymmetric: true });
diff --git a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js b/project starter code/node_modules/@jimp/plugin-crop/dist/index.js
index ea6d0b7d..2c690c49 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-crop/dist/index.js
@@ -1,17 +1,12 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = pluginCrop;
-
-var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
-
+exports.default = pluginCrop;
var _utils = require("@jimp/utils");
-
/* eslint-disable no-labels */
+
function pluginCrop(event) {
/**
* Crops the image at a given point to a give size
@@ -22,42 +17,39 @@ function pluginCrop(event) {
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
- event('crop', function (x, y, w, h, cb) {
- if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb);
- if (typeof w !== 'number' || typeof h !== 'number') return _utils.throwError.call(this, 'w and h must be numbers', cb); // round input
+ event("crop", function (x, y, w, h, cb) {
+ if (typeof x !== "number" || typeof y !== "number") return _utils.throwError.call(this, "x and y must be numbers", cb);
+ if (typeof w !== "number" || typeof h !== "number") return _utils.throwError.call(this, "w and h must be numbers", cb);
+ // round input
x = Math.round(x);
y = Math.round(y);
w = Math.round(w);
h = Math.round(h);
-
if (x === 0 && w === this.bitmap.width) {
// shortcut
- var start = w * y + x << 2;
- var end = start + h * w << 2;
+ const start = w * y + x << 2;
+ const end = start + (h * w << 2);
this.bitmap.data = this.bitmap.data.slice(start, end);
} else {
- var bitmap = Buffer.allocUnsafe(w * h * 4);
- var offset = 0;
+ const bitmap = Buffer.allocUnsafe(w * h * 4);
+ let offset = 0;
this.scanQuiet(x, y, w, h, function (x, y, idx) {
- var data = this.bitmap.data.readUInt32BE(idx, true);
+ const data = this.bitmap.data.readUInt32BE(idx, true);
bitmap.writeUInt32BE(data, offset, true);
offset += 4;
});
this.bitmap.data = bitmap;
}
-
this.bitmap.width = w;
this.bitmap.height = h;
-
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}
-
return this;
});
return {
- "class": {
+ class: {
/**
* Autocrop same color borders from this image
* @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)
@@ -65,201 +57,188 @@ function pluginCrop(event) {
* @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)
* @returns {Jimp} this for chaining of methods
*/
- autocrop: function autocrop() {
- var w = this.bitmap.width;
- var h = this.bitmap.height;
- var minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image
-
- var cb; // callback
-
- var leaveBorder = 0; // Amount of pixels in border to leave
-
- var tolerance = 0.0002; // percent of color difference tolerance (default value)
-
- var cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame"
+ autocrop() {
+ const w = this.bitmap.width;
+ const h = this.bitmap.height;
+ const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image
+
+ let cb; // callback
+ let leaveBorder = 0; // Amount of pixels in border to leave
+ let tolerance = 0.0002; // percent of color difference tolerance (default value)
+ let cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame"
// i.e. all 4 sides have some border (default value)
-
- var cropSymmetric = false; // flag to force cropping top be symmetric.
+ let cropSymmetric = false; // flag to force cropping top be symmetric.
// i.e. north and south / east and west are cropped by the same value
-
- var ignoreSides = {
+ let ignoreSides = {
north: false,
south: false,
east: false,
west: false
- }; // parse arguments
+ };
+ // parse arguments
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
-
- for (var a = 0, len = args.length; a < len; a++) {
- if (typeof args[a] === 'number') {
+ for (let a = 0, len = args.length; a < len; a++) {
+ if (typeof args[a] === "number") {
// tolerance value passed
tolerance = args[a];
}
-
- if (typeof args[a] === 'boolean') {
+ if (typeof args[a] === "boolean") {
// cropOnlyFrames value passed
cropOnlyFrames = args[a];
}
-
- if (typeof args[a] === 'function') {
+ if (typeof args[a] === "function") {
// callback value passed
cb = args[a];
}
-
- if ((0, _typeof2["default"])(args[a]) === 'object') {
+ if (typeof args[a] === "object") {
// config object passed
- var config = args[a];
-
- if (typeof config.tolerance !== 'undefined') {
- tolerance = config.tolerance;
+ const config = args[a];
+ if (typeof config.tolerance !== "undefined") {
+ ({
+ tolerance
+ } = config);
}
-
- if (typeof config.cropOnlyFrames !== 'undefined') {
- cropOnlyFrames = config.cropOnlyFrames;
+ if (typeof config.cropOnlyFrames !== "undefined") {
+ ({
+ cropOnlyFrames
+ } = config);
}
-
- if (typeof config.cropSymmetric !== 'undefined') {
- cropSymmetric = config.cropSymmetric;
+ if (typeof config.cropSymmetric !== "undefined") {
+ ({
+ cropSymmetric
+ } = config);
}
-
- if (typeof config.leaveBorder !== 'undefined') {
- leaveBorder = config.leaveBorder;
+ if (typeof config.leaveBorder !== "undefined") {
+ ({
+ leaveBorder
+ } = config);
}
-
- if (typeof config.ignoreSides !== 'undefined') {
- ignoreSides = config.ignoreSides;
+ if (typeof config.ignoreSides !== "undefined") {
+ ({
+ ignoreSides
+ } = config);
}
}
}
+
/**
* All borders must be of the same color as the top left pixel, to be cropped.
* It should be possible to crop borders each with a different color,
* but since there are many ways for corners to intersect, it would
* introduce unnecessary complexity to the algorithm.
*/
- // scan each side for same color borders
-
-
- var colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color
- var rgba1 = this.constructor.intToRGBA(colorTarget); // for north and east sides
+ // scan each side for same color borders
+ let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color
+ const rgba1 = this.constructor.intToRGBA(colorTarget);
- var northPixelsToCrop = 0;
- var eastPixelsToCrop = 0;
- var southPixelsToCrop = 0;
- var westPixelsToCrop = 0; // north side (scan rows from north to south)
+ // for north and east sides
+ let northPixelsToCrop = 0;
+ let eastPixelsToCrop = 0;
+ let southPixelsToCrop = 0;
+ let westPixelsToCrop = 0;
+ // north side (scan rows from north to south)
colorTarget = this.getPixelColor(0, 0);
-
if (!ignoreSides.north) {
- north: for (var y = 0; y < h - minPixelsPerSide; y++) {
- for (var x = 0; x < w; x++) {
- var colorXY = this.getPixelColor(x, y);
- var rgba2 = this.constructor.intToRGBA(colorXY);
-
+ north: for (let y = 0; y < h - minPixelsPerSide; y++) {
+ for (let x = 0; x < w; x++) {
+ const colorXY = this.getPixelColor(x, y);
+ const rgba2 = this.constructor.intToRGBA(colorXY);
if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {
// this pixel is too distant from the first one: abort this side scan
break north;
}
- } // this row contains all pixels with the same color: increment this side pixels to crop
-
+ }
+ // this row contains all pixels with the same color: increment this side pixels to crop
northPixelsToCrop++;
}
- } // east side (scan columns from east to west)
-
+ }
+ // west side (scan columns from west to east)
colorTarget = this.getPixelColor(w, 0);
-
- if (!ignoreSides.east) {
- east: for (var _x = 0; _x < w - minPixelsPerSide; _x++) {
- for (var _y = 0 + northPixelsToCrop; _y < h; _y++) {
- var _colorXY = this.getPixelColor(_x, _y);
-
- var _rgba = this.constructor.intToRGBA(_colorXY);
-
- if (this.constructor.colorDiff(rgba1, _rgba) > tolerance) {
+ if (!ignoreSides.west) {
+ west: for (let x = 0; x < w - minPixelsPerSide; x++) {
+ for (let y = 0 + northPixelsToCrop; y < h; y++) {
+ const colorXY = this.getPixelColor(x, y);
+ const rgba2 = this.constructor.intToRGBA(colorXY);
+ if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {
// this pixel is too distant from the first one: abort this side scan
- break east;
+ break west;
}
- } // this column contains all pixels with the same color: increment this side pixels to crop
-
+ }
- eastPixelsToCrop++;
+ // this column contains all pixels with the same color: increment this side pixels to crop
+ westPixelsToCrop++;
}
- } // south side (scan rows from south to north)
-
+ }
+ // south side (scan rows from south to north)
colorTarget = this.getPixelColor(0, h);
-
if (!ignoreSides.south) {
- south: for (var _y2 = h - 1; _y2 >= northPixelsToCrop + minPixelsPerSide; _y2--) {
- for (var _x2 = w - eastPixelsToCrop - 1; _x2 >= 0; _x2--) {
- var _colorXY2 = this.getPixelColor(_x2, _y2);
-
- var _rgba2 = this.constructor.intToRGBA(_colorXY2);
-
- if (this.constructor.colorDiff(rgba1, _rgba2) > tolerance) {
+ south: for (let y = h - 1; y >= northPixelsToCrop + minPixelsPerSide; y--) {
+ for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {
+ const colorXY = this.getPixelColor(x, y);
+ const rgba2 = this.constructor.intToRGBA(colorXY);
+ if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {
// this pixel is too distant from the first one: abort this side scan
break south;
}
- } // this row contains all pixels with the same color: increment this side pixels to crop
-
+ }
+ // this row contains all pixels with the same color: increment this side pixels to crop
southPixelsToCrop++;
}
- } // west side (scan columns from west to east)
-
+ }
+ // east side (scan columns from east to west)
colorTarget = this.getPixelColor(w, h);
-
- if (!ignoreSides.west) {
- west: for (var _x3 = w - 1; _x3 >= 0 + eastPixelsToCrop + minPixelsPerSide; _x3--) {
- for (var _y3 = h - 1; _y3 >= 0 + northPixelsToCrop; _y3--) {
- var _colorXY3 = this.getPixelColor(_x3, _y3);
-
- var _rgba3 = this.constructor.intToRGBA(_colorXY3);
-
- if (this.constructor.colorDiff(rgba1, _rgba3) > tolerance) {
+ if (!ignoreSides.east) {
+ east: for (let x = w - 1; x >= 0 + westPixelsToCrop + minPixelsPerSide; x--) {
+ for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {
+ const colorXY = this.getPixelColor(x, y);
+ const rgba2 = this.constructor.intToRGBA(colorXY);
+ if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {
// this pixel is too distant from the first one: abort this side scan
- break west;
+ break east;
}
- } // this column contains all pixels with the same color: increment this side pixels to crop
-
+ }
- westPixelsToCrop++;
+ // this column contains all pixels with the same color: increment this side pixels to crop
+ eastPixelsToCrop++;
}
- } // decide if a crop is needed
-
+ }
- var doCrop = false; // apply leaveBorder
+ // decide if a crop is needed
+ let doCrop = false;
+ // apply leaveBorder
westPixelsToCrop -= leaveBorder;
eastPixelsToCrop -= leaveBorder;
northPixelsToCrop -= leaveBorder;
southPixelsToCrop -= leaveBorder;
-
if (cropSymmetric) {
- var horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);
- var vertical = Math.min(northPixelsToCrop, southPixelsToCrop);
+ const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);
+ const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);
westPixelsToCrop = horizontal;
eastPixelsToCrop = horizontal;
northPixelsToCrop = vertical;
southPixelsToCrop = vertical;
- } // make sure that crops are >= 0
-
+ }
+ // make sure that crops are >= 0
westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;
eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;
northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;
- southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; // safety checks
-
- var widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop);
- var heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop);
+ southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;
+ // safety checks
+ const widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop);
+ const heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop);
if (cropOnlyFrames) {
// crop image if all sides should be cropped
doCrop = eastPixelsToCrop !== 0 && northPixelsToCrop !== 0 && westPixelsToCrop !== 0 && southPixelsToCrop !== 0;
@@ -267,21 +246,18 @@ function pluginCrop(event) {
// crop image if at least one side should be cropped
doCrop = eastPixelsToCrop !== 0 || northPixelsToCrop !== 0 || westPixelsToCrop !== 0 || southPixelsToCrop !== 0;
}
-
if (doCrop) {
// do the real crop
- this.crop(eastPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels);
+ this.crop(westPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels);
}
-
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}
-
return this;
}
}
};
}
-
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map
index 0a3441ca..2c319a35 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["pluginCrop","event","x","y","w","h","cb","throwError","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","rgba2","colorDiff","doCrop","horizontal","min","vertical","widthOfRemainingPixels","heightOfRemainingPixels","crop"],"mappings":";;;;;;;;;;;AAEA;;AAFA;AAIe,SAASA,UAAT,CAAoBC,KAApB,EAA2B;AACxC;;;;;;;;;AASAA,EAAAA,KAAK,CAAC,MAAD,EAAS,UAASC,CAAT,EAAYC,CAAZ,EAAeC,CAAf,EAAkBC,CAAlB,EAAqBC,EAArB,EAAyB;AACrC,QAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EACE,OAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACF,QAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EACE,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP,CAJmC,CAMrC;;AACAJ,IAAAA,CAAC,GAAGO,IAAI,CAACC,KAAL,CAAWR,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGM,IAAI,CAACC,KAAL,CAAWP,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGK,IAAI,CAACC,KAAL,CAAWN,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGI,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAJ;;AAEA,QAAIH,CAAC,KAAK,CAAN,IAAWE,CAAC,KAAK,KAAKO,MAAL,CAAYC,KAAjC,EAAwC;AACtC;AACA,UAAMC,KAAK,GAAIT,CAAC,GAAGD,CAAJ,GAAQD,CAAT,IAAe,CAA7B;AACA,UAAMY,GAAG,GAAID,KAAK,GAAGR,CAAC,GAAGD,CAAb,IAAmB,CAA/B;AAEA,WAAKO,MAAL,CAAYI,IAAZ,GAAmB,KAAKJ,MAAL,CAAYI,IAAZ,CAAiBC,KAAjB,CAAuBH,KAAvB,EAA8BC,GAA9B,C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D,iBAAiB,KAAK,CAJxB;AAKD;;AAED,YAAIK,MAAJ,EAAY;AACV;AACA,eAAKM,IAAL,CACEZ,gBADF,EAEED,iBAFF,EAGEW,sBAHF,EAIEC,uBAJF;AAMD;;AAED,YAAI,0BAAcpD,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzOI;AADF,GAAP;AA6OD","sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event('crop', function(x, y, w, h, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n if (typeof w !== 'number' || typeof h !== 'number')\n return throwError.call(this, 'w and h must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = (start + h * w) << 2;\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function(x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === 'number') {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === 'boolean') {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === 'function') {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === 'object') {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== 'undefined') {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== 'undefined') {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== 'undefined') {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== 'undefined') {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== 'undefined') {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.east) {\n east: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.west) {\n west: for (\n let x = w - 1;\n x >= 0 + eastPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n eastPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n };\n}\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["pluginCrop","event","x","y","w","h","cb","throwError","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","isNodePattern","class","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","rgba2","colorDiff","doCrop","horizontal","min","vertical","widthOfRemainingPixels","heightOfRemainingPixels","crop"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event(\"crop\", function (x, y, w, h, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\")\n return throwError.call(this, \"x and y must be numbers\", cb);\n if (typeof w !== \"number\" || typeof h !== \"number\")\n return throwError.call(this, \"w and h must be numbers\", cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = start + ((h * w) << 2);\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function (x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false,\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === \"number\") {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === \"boolean\") {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === \"function\") {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === \"object\") {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== \"undefined\") {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== \"undefined\") {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== \"undefined\") {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== \"undefined\") {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== \"undefined\") {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.west) {\n west: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.east) {\n east: for (\n let x = w - 1;\n x >= 0 + westPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n westPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n };\n}\n"],"mappings":";;;;;;AAEA;AAFA;;AAIe,SAASA,UAAU,CAACC,KAAK,EAAE;EACxC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEA,KAAK,CAAC,MAAM,EAAE,UAAUC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,EAAE,EAAE;IACtC,IAAI,OAAOJ,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAChD,OAAOI,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;IAC7D,IAAI,OAAOF,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAChD,OAAOE,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;;IAE7D;IACAJ,CAAC,GAAGO,IAAI,CAACC,KAAK,CAACR,CAAC,CAAC;IACjBC,CAAC,GAAGM,IAAI,CAACC,KAAK,CAACP,CAAC,CAAC;IACjBC,CAAC,GAAGK,IAAI,CAACC,KAAK,CAACN,CAAC,CAAC;IACjBC,CAAC,GAAGI,IAAI,CAACC,KAAK,CAACL,CAAC,CAAC;IAEjB,IAAIH,CAAC,KAAK,CAAC,IAAIE,CAAC,KAAK,IAAI,CAACO,MAAM,CAACC,KAAK,EAAE;MACtC;MACA,MAAMC,KAAK,GAAIT,CAAC,GAAGD,CAAC,GAAGD,CAAC,IAAK,CAAC;MAC9B,MAAMY,GAAG,GAAGD,KAAK,IAAKR,CAAC,GAAGD,CA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diff --git a/project starter code/node_modules/@jimp/plugin-crop/es/index.js b/project starter code/node_modules/@jimp/plugin-crop/es/index.js
index f8e38329..d4d040fd 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-crop/es/index.js
@@ -1,18 +1,7 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = pluginCrop;
-
-var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
-
-var _utils = require("@jimp/utils");
-
/* eslint-disable no-labels */
-function pluginCrop(event) {
+
+import { throwError, isNodePattern } from "@jimp/utils";
+export default function pluginCrop(event) {
/**
* Crops the image at a given point to a give size
* @param {number} x the x coordinate to crop form
@@ -22,42 +11,39 @@ function pluginCrop(event) {
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
- event('crop', function (x, y, w, h, cb) {
- if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb);
- if (typeof w !== 'number' || typeof h !== 'number') return _utils.throwError.call(this, 'w and h must be numbers', cb); // round input
+ event("crop", function (x, y, w, h, cb) {
+ if (typeof x !== "number" || typeof y !== "number") return throwError.call(this, "x and y must be numbers", cb);
+ if (typeof w !== "number" || typeof h !== "number") return throwError.call(this, "w and h must be numbers", cb);
+ // round input
x = Math.round(x);
y = Math.round(y);
w = Math.round(w);
h = Math.round(h);
-
if (x === 0 && w === this.bitmap.width) {
// shortcut
- var start = w * y + x << 2;
- var end = start + h * w << 2;
+ const start = w * y + x << 2;
+ const end = start + (h * w << 2);
this.bitmap.data = this.bitmap.data.slice(start, end);
} else {
- var bitmap = Buffer.allocUnsafe(w * h * 4);
- var offset = 0;
+ const bitmap = Buffer.allocUnsafe(w * h * 4);
+ let offset = 0;
this.scanQuiet(x, y, w, h, function (x, y, idx) {
- var data = this.bitmap.data.readUInt32BE(idx, true);
+ const data = this.bitmap.data.readUInt32BE(idx, true);
bitmap.writeUInt32BE(data, offset, true);
offset += 4;
});
this.bitmap.data = bitmap;
}
-
this.bitmap.width = w;
this.bitmap.height = h;
-
- if ((0, _utils.isNodePattern)(cb)) {
+ if (isNodePattern(cb)) {
cb.call(this, null, this);
}
-
return this;
});
return {
- "class": {
+ class: {
/**
* Autocrop same color borders from this image
* @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)
@@ -65,201 +51,188 @@ function pluginCrop(event) {
* @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)
* @returns {Jimp} this for chaining of methods
*/
- autocrop: function autocrop() {
- var w = this.bitmap.width;
- var h = this.bitmap.height;
- var minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image
-
- var cb; // callback
-
- var leaveBorder = 0; // Amount of pixels in border to leave
-
- var tolerance = 0.0002; // percent of color difference tolerance (default value)
-
- var cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame"
+ autocrop() {
+ const w = this.bitmap.width;
+ const h = this.bitmap.height;
+ const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image
+
+ let cb; // callback
+ let leaveBorder = 0; // Amount of pixels in border to leave
+ let tolerance = 0.0002; // percent of color difference tolerance (default value)
+ let cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame"
// i.e. all 4 sides have some border (default value)
-
- var cropSymmetric = false; // flag to force cropping top be symmetric.
+ let cropSymmetric = false; // flag to force cropping top be symmetric.
// i.e. north and south / east and west are cropped by the same value
-
- var ignoreSides = {
+ let ignoreSides = {
north: false,
south: false,
east: false,
west: false
- }; // parse arguments
+ };
+ // parse arguments
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
-
- for (var a = 0, len = args.length; a < len; a++) {
- if (typeof args[a] === 'number') {
+ for (let a = 0, len = args.length; a < len; a++) {
+ if (typeof args[a] === "number") {
// tolerance value passed
tolerance = args[a];
}
-
- if (typeof args[a] === 'boolean') {
+ if (typeof args[a] === "boolean") {
// cropOnlyFrames value passed
cropOnlyFrames = args[a];
}
-
- if (typeof args[a] === 'function') {
+ if (typeof args[a] === "function") {
// callback value passed
cb = args[a];
}
-
- if ((0, _typeof2["default"])(args[a]) === 'object') {
+ if (typeof args[a] === "object") {
// config object passed
- var config = args[a];
-
- if (typeof config.tolerance !== 'undefined') {
- tolerance = config.tolerance;
+ const config = args[a];
+ if (typeof config.tolerance !== "undefined") {
+ ({
+ tolerance
+ } = config);
}
-
- if (typeof config.cropOnlyFrames !== 'undefined') {
- cropOnlyFrames = config.cropOnlyFrames;
+ if (typeof config.cropOnlyFrames !== "undefined") {
+ ({
+ cropOnlyFrames
+ } = config);
}
-
- if (typeof config.cropSymmetric !== 'undefined') {
- cropSymmetric = config.cropSymmetric;
+ if (typeof config.cropSymmetric !== "undefined") {
+ ({
+ cropSymmetric
+ } = config);
}
-
- if (typeof config.leaveBorder !== 'undefined') {
- leaveBorder = config.leaveBorder;
+ if (typeof config.leaveBorder !== "undefined") {
+ ({
+ leaveBorder
+ } = config);
}
-
- if (typeof config.ignoreSides !== 'undefined') {
- ignoreSides = config.ignoreSides;
+ if (typeof config.ignoreSides !== "undefined") {
+ ({
+ ignoreSides
+ } = config);
}
}
}
+
/**
* All borders must be of the same color as the top left pixel, to be cropped.
* It should be possible to crop borders each with a different color,
* but since there are many ways for corners to intersect, it would
* introduce unnecessary complexity to the algorithm.
*/
- // scan each side for same color borders
-
- var colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color
-
- var rgba1 = this.constructor.intToRGBA(colorTarget); // for north and east sides
+ // scan each side for same color borders
+ let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color
+ const rgba1 = this.constructor.intToRGBA(colorTarget);
- var northPixelsToCrop = 0;
- var eastPixelsToCrop = 0;
- var southPixelsToCrop = 0;
- var westPixelsToCrop = 0; // north side (scan rows from north to south)
+ // for north and east sides
+ let northPixelsToCrop = 0;
+ let eastPixelsToCrop = 0;
+ let southPixelsToCrop = 0;
+ let westPixelsToCrop = 0;
+ // north side (scan rows from north to south)
colorTarget = this.getPixelColor(0, 0);
-
if (!ignoreSides.north) {
- north: for (var y = 0; y < h - minPixelsPerSide; y++) {
- for (var x = 0; x < w; x++) {
- var colorXY = this.getPixelColor(x, y);
- var rgba2 = this.constructor.intToRGBA(colorXY);
-
+ north: for (let y = 0; y < h - minPixelsPerSide; y++) {
+ for (let x = 0; x < w; x++) {
+ const colorXY = this.getPixelColor(x, y);
+ const rgba2 = this.constructor.intToRGBA(colorXY);
if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {
// this pixel is too distant from the first one: abort this side scan
break north;
}
- } // this row contains all pixels with the same color: increment this side pixels to crop
-
+ }
+ // this row contains all pixels with the same color: increment this side pixels to crop
northPixelsToCrop++;
}
- } // east side (scan columns from east to west)
-
+ }
+ // west side (scan columns from west to east)
colorTarget = this.getPixelColor(w, 0);
-
- if (!ignoreSides.east) {
- east: for (var _x = 0; _x < w - minPixelsPerSide; _x++) {
- for (var _y = 0 + northPixelsToCrop; _y < h; _y++) {
- var _colorXY = this.getPixelColor(_x, _y);
-
- var _rgba = this.constructor.intToRGBA(_colorXY);
-
- if (this.constructor.colorDiff(rgba1, _rgba) > tolerance) {
+ if (!ignoreSides.west) {
+ west: for (let x = 0; x < w - minPixelsPerSide; x++) {
+ for (let y = 0 + northPixelsToCrop; y < h; y++) {
+ const colorXY = this.getPixelColor(x, y);
+ const rgba2 = this.constructor.intToRGBA(colorXY);
+ if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {
// this pixel is too distant from the first one: abort this side scan
- break east;
+ break west;
}
- } // this column contains all pixels with the same color: increment this side pixels to crop
-
+ }
- eastPixelsToCrop++;
+ // this column contains all pixels with the same color: increment this side pixels to crop
+ westPixelsToCrop++;
}
- } // south side (scan rows from south to north)
-
+ }
+ // south side (scan rows from south to north)
colorTarget = this.getPixelColor(0, h);
-
if (!ignoreSides.south) {
- south: for (var _y2 = h - 1; _y2 >= northPixelsToCrop + minPixelsPerSide; _y2--) {
- for (var _x2 = w - eastPixelsToCrop - 1; _x2 >= 0; _x2--) {
- var _colorXY2 = this.getPixelColor(_x2, _y2);
-
- var _rgba2 = this.constructor.intToRGBA(_colorXY2);
-
- if (this.constructor.colorDiff(rgba1, _rgba2) > tolerance) {
+ south: for (let y = h - 1; y >= northPixelsToCrop + minPixelsPerSide; y--) {
+ for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {
+ const colorXY = this.getPixelColor(x, y);
+ const rgba2 = this.constructor.intToRGBA(colorXY);
+ if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {
// this pixel is too distant from the first one: abort this side scan
break south;
}
- } // this row contains all pixels with the same color: increment this side pixels to crop
-
+ }
+ // this row contains all pixels with the same color: increment this side pixels to crop
southPixelsToCrop++;
}
- } // west side (scan columns from west to east)
-
+ }
+ // east side (scan columns from east to west)
colorTarget = this.getPixelColor(w, h);
-
- if (!ignoreSides.west) {
- west: for (var _x3 = w - 1; _x3 >= 0 + eastPixelsToCrop + minPixelsPerSide; _x3--) {
- for (var _y3 = h - 1; _y3 >= 0 + northPixelsToCrop; _y3--) {
- var _colorXY3 = this.getPixelColor(_x3, _y3);
-
- var _rgba3 = this.constructor.intToRGBA(_colorXY3);
-
- if (this.constructor.colorDiff(rgba1, _rgba3) > tolerance) {
+ if (!ignoreSides.east) {
+ east: for (let x = w - 1; x >= 0 + westPixelsToCrop + minPixelsPerSide; x--) {
+ for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {
+ const colorXY = this.getPixelColor(x, y);
+ const rgba2 = this.constructor.intToRGBA(colorXY);
+ if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {
// this pixel is too distant from the first one: abort this side scan
- break west;
+ break east;
}
- } // this column contains all pixels with the same color: increment this side pixels to crop
-
+ }
- westPixelsToCrop++;
+ // this column contains all pixels with the same color: increment this side pixels to crop
+ eastPixelsToCrop++;
}
- } // decide if a crop is needed
-
+ }
- var doCrop = false; // apply leaveBorder
+ // decide if a crop is needed
+ let doCrop = false;
+ // apply leaveBorder
westPixelsToCrop -= leaveBorder;
eastPixelsToCrop -= leaveBorder;
northPixelsToCrop -= leaveBorder;
southPixelsToCrop -= leaveBorder;
-
if (cropSymmetric) {
- var horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);
- var vertical = Math.min(northPixelsToCrop, southPixelsToCrop);
+ const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);
+ const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);
westPixelsToCrop = horizontal;
eastPixelsToCrop = horizontal;
northPixelsToCrop = vertical;
southPixelsToCrop = vertical;
- } // make sure that crops are >= 0
-
+ }
+ // make sure that crops are >= 0
westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;
eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;
northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;
- southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; // safety checks
-
- var widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop);
- var heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop);
+ southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;
+ // safety checks
+ const widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop);
+ const heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop);
if (cropOnlyFrames) {
// crop image if all sides should be cropped
doCrop = eastPixelsToCrop !== 0 && northPixelsToCrop !== 0 && westPixelsToCrop !== 0 && southPixelsToCrop !== 0;
@@ -267,16 +240,13 @@ function pluginCrop(event) {
// crop image if at least one side should be cropped
doCrop = eastPixelsToCrop !== 0 || northPixelsToCrop !== 0 || westPixelsToCrop !== 0 || southPixelsToCrop !== 0;
}
-
if (doCrop) {
// do the real crop
- this.crop(eastPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels);
+ this.crop(westPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels);
}
-
- if ((0, _utils.isNodePattern)(cb)) {
+ if (isNodePattern(cb)) {
cb.call(this, null, this);
}
-
return this;
}
}
diff --git a/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map b/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map
index 0a3441ca..6f8e4e20 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["pluginCrop","event","x","y","w","h","cb","throwError","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","rgba2","colorDiff","doCrop","horizontal","min","vertical","widthOfRemainingPixels","heightOfRemainingPixels","crop"],"mappings":";;;;;;;;;;;AAEA;;AAFA;AAIe,SAASA,UAAT,CAAoBC,KAApB,EAA2B;AACxC;;;;;;;;;AASAA,EAAAA,KAAK,CAAC,MAAD,EAAS,UAASC,CAAT,EAAYC,CAAZ,EAAeC,CAAf,EAAkBC,CAAlB,EAAqBC,EAArB,EAAyB;AACrC,QAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EACE,OAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACF,QAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EACE,OAAOE,kBAAWC,IAAX,CAAgB,IAAh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gB,IAAI,CAApB,GAAwBA,gBAAxB,GAA2C,CAA9D;AACAD,QAAAA,iBAAiB,GAAGA,iBAAiB,IAAI,CAArB,GAAyBA,iBAAzB,GAA6C,CAAjE;AACAE,QAAAA,iBAAiB,GAAGA,iBAAiB,IAAI,CAArB,GAAyBA,iBAAzB,GAA6C,CAAjE,CA1LgB,CA4LhB;;AACA,YAAMS,sBAAsB,GAC1BrD,CAAC,IAAI6C,gBAAgB,GAAGF,gBAAvB,CADH;AAEA,YAAMW,uBAAuB,GAC3BrD,CAAC,IAAI2C,iBAAiB,GAAGF,iBAAxB,CADH;;AAGA,YAAIjB,cAAJ,EAAoB;AAClB;AACAwB,UAAAA,MAAM,GACJN,gBAAgB,KAAK,CAArB,IACAD,iBAAiB,KAAK,CADtB,IAEAG,gBAAgB,KAAK,CAFrB,IAGAD,iBAAiB,KAAK,CAJxB;AAKD,SAPD,MAOO;AACL;AACAK,UAAAA,MAAM,GACJN,gBAAgB,KAAK,CAArB,IACAD,iBAAiB,KAAK,CADtB,IAEAG,gBAAgB,KAAK,CAFrB,IAGAD,iBAAiB,KAAK,CAJxB;AAKD;;AAED,YAAIK,MAAJ,EAAY;AACV;AACA,eAAKM,IAAL,CACEZ,gBADF,EAEED,iBAFF,EAGEW,sBAHF,EAIEC,uBAJF;AAMD;;AAED,YAAI,0BAAcpD,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzOI;AADF,GAAP;AA6OD","sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event('crop', function(x, y, w, h, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n if (typeof w !== 'number' || typeof h !== 'number')\n return throwError.call(this, 'w and h must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = (start + h * w) << 2;\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function(x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === 'number') {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === 'boolean') {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === 'function') {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === 'object') {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== 'undefined') {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== 'undefined') {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== 'undefined') {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== 'undefined') {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== 'undefined') {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.east) {\n east: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.west) {\n west: for (\n let x = w - 1;\n x >= 0 + eastPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n eastPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n };\n}\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["throwError","isNodePattern","pluginCrop","event","x","y","w","h","cb","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","class","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","rgba2","colorDiff","doCrop","horizontal","min","vertical","widthOfRemainingPixels","heightOfRemainingPixels","crop"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event(\"crop\", function (x, y, w, h, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\")\n return throwError.call(this, \"x and y must be numbers\", cb);\n if (typeof w !== \"number\" || typeof h !== \"number\")\n return throwError.call(this, \"w and h must be numbers\", cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = start + ((h * w) << 2);\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function (x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false,\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === \"number\") {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === \"boolean\") {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === \"function\") {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === \"object\") {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== \"undefined\") {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== \"undefined\") {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== \"undefined\") {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== \"undefined\") {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== \"undefined\") {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.west) {\n west: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.east) {\n east: for (\n let x = w - 1;\n x >= 0 + westPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n westPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n };\n}\n"],"mappings":"AAAA;;AAEA,SAASA,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,eAAe,SAASC,UAAU,CAACC,KAAK,EAAE;EACxC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEA,KAAK,CAAC,MAAM,EAAE,UAAUC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,EAAE,EAAE;IACtC,IAAI,OAAOJ,CAAC,KAAK,QAAQ,IAAI,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uBAAuB,GAC3BrD,CAAC,IAAI2C,iBAAiB,GAAGF,iBAAiB,CAAC;QAE7C,IAAIjB,cAAc,EAAE;UAClB;UACAwB,MAAM,GACJN,gBAAgB,KAAK,CAAC,IACtBD,iBAAiB,KAAK,CAAC,IACvBG,gBAAgB,KAAK,CAAC,IACtBD,iBAAiB,KAAK,CAAC;QAC3B,CAAC,MAAM;UACL;UACAK,MAAM,GACJN,gBAAgB,KAAK,CAAC,IACtBD,iBAAiB,KAAK,CAAC,IACvBG,gBAAgB,KAAK,CAAC,IACtBD,iBAAiB,KAAK,CAAC;QAC3B;QAEA,IAAIK,MAAM,EAAE;UACV;UACA,IAAI,CAACM,IAAI,CACPV,gBAAgB,EAChBH,iBAAiB,EACjBW,sBAAsB,EACtBC,uBAAuB,CACxB;QACH;QAEA,IAAI3D,aAAa,CAACO,EAAE,CAAC,EAAE;UACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QAC3B;QAEA,OAAO,IAAI;MACb;IACF;EACF,CAAC;AACH"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-crop/index.d.ts b/project starter code/node_modules/@jimp/plugin-crop/index.d.ts
index 5dc5c83e..48550b4f 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-crop/index.d.ts
@@ -1,7 +1,13 @@
-import { Jimp, ImageCallback } from '@jimp/core';
+import { Jimp, ImageCallback } from "@jimp/core";
interface CropClass {
- crop(x: number, y: number, w: number, h: number, cb?: ImageCallback): this;
+ crop(
+ x: number,
+ y: number,
+ w: number,
+ h: number,
+ cb?: ImageCallback
+ ): this;
cropQuiet(
x: number,
y: number,
@@ -27,14 +33,14 @@ interface CropClass {
south: boolean;
east: boolean;
west: boolean;
- }
+ };
},
cb?: ImageCallback
): this;
}
interface Crop {
- class: CropClass
+ class: CropClass;
}
-export default function(): Crop;
+export default function (): Crop;
diff --git a/project starter code/node_modules/@jimp/plugin-crop/package.json b/project starter code/node_modules/@jimp/plugin-crop/package.json
index fd888526..15d98501 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/package.json
+++ b/project starter code/node_modules/@jimp/plugin-crop/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-crop",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "crop an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,12 +21,11 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
@@ -33,5 +33,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-crop/src/index.js b/project starter code/node_modules/@jimp/plugin-crop/src/index.js
index 4d1f78ad..7528d2b8 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-crop/src/index.js
@@ -1,6 +1,6 @@
/* eslint-disable no-labels */
-import { throwError, isNodePattern } from '@jimp/utils';
+import { throwError, isNodePattern } from "@jimp/utils";
export default function pluginCrop(event) {
/**
@@ -12,11 +12,11 @@ export default function pluginCrop(event) {
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
- event('crop', function(x, y, w, h, cb) {
- if (typeof x !== 'number' || typeof y !== 'number')
- return throwError.call(this, 'x and y must be numbers', cb);
- if (typeof w !== 'number' || typeof h !== 'number')
- return throwError.call(this, 'w and h must be numbers', cb);
+ event("crop", function (x, y, w, h, cb) {
+ if (typeof x !== "number" || typeof y !== "number")
+ return throwError.call(this, "x and y must be numbers", cb);
+ if (typeof w !== "number" || typeof h !== "number")
+ return throwError.call(this, "w and h must be numbers", cb);
// round input
x = Math.round(x);
@@ -27,14 +27,14 @@ export default function pluginCrop(event) {
if (x === 0 && w === this.bitmap.width) {
// shortcut
const start = (w * y + x) << 2;
- const end = (start + h * w) << 2;
+ const end = start + ((h * w) << 2);
this.bitmap.data = this.bitmap.data.slice(start, end);
} else {
const bitmap = Buffer.allocUnsafe(w * h * 4);
let offset = 0;
- this.scanQuiet(x, y, w, h, function(x, y, idx) {
+ this.scanQuiet(x, y, w, h, function (x, y, idx) {
const data = this.bitmap.data.readUInt32BE(idx, true);
bitmap.writeUInt32BE(data, offset, true);
offset += 4;
@@ -78,47 +78,47 @@ export default function pluginCrop(event) {
north: false,
south: false,
east: false,
- west: false
+ west: false,
};
// parse arguments
for (let a = 0, len = args.length; a < len; a++) {
- if (typeof args[a] === 'number') {
+ if (typeof args[a] === "number") {
// tolerance value passed
tolerance = args[a];
}
- if (typeof args[a] === 'boolean') {
+ if (typeof args[a] === "boolean") {
// cropOnlyFrames value passed
cropOnlyFrames = args[a];
}
- if (typeof args[a] === 'function') {
+ if (typeof args[a] === "function") {
// callback value passed
cb = args[a];
}
- if (typeof args[a] === 'object') {
+ if (typeof args[a] === "object") {
// config object passed
const config = args[a];
- if (typeof config.tolerance !== 'undefined') {
+ if (typeof config.tolerance !== "undefined") {
({ tolerance } = config);
}
- if (typeof config.cropOnlyFrames !== 'undefined') {
+ if (typeof config.cropOnlyFrames !== "undefined") {
({ cropOnlyFrames } = config);
}
- if (typeof config.cropSymmetric !== 'undefined') {
+ if (typeof config.cropSymmetric !== "undefined") {
({ cropSymmetric } = config);
}
- if (typeof config.leaveBorder !== 'undefined') {
+ if (typeof config.leaveBorder !== "undefined") {
({ leaveBorder } = config);
}
- if (typeof config.ignoreSides !== 'undefined') {
+ if (typeof config.ignoreSides !== "undefined") {
({ ignoreSides } = config);
}
}
@@ -160,22 +160,22 @@ export default function pluginCrop(event) {
}
}
- // east side (scan columns from east to west)
+ // west side (scan columns from west to east)
colorTarget = this.getPixelColor(w, 0);
- if (!ignoreSides.east) {
- east: for (let x = 0; x < w - minPixelsPerSide; x++) {
+ if (!ignoreSides.west) {
+ west: for (let x = 0; x < w - minPixelsPerSide; x++) {
for (let y = 0 + northPixelsToCrop; y < h; y++) {
const colorXY = this.getPixelColor(x, y);
const rgba2 = this.constructor.intToRGBA(colorXY);
if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {
// this pixel is too distant from the first one: abort this side scan
- break east;
+ break west;
}
}
// this column contains all pixels with the same color: increment this side pixels to crop
- eastPixelsToCrop++;
+ westPixelsToCrop++;
}
}
@@ -203,12 +203,12 @@ export default function pluginCrop(event) {
}
}
- // west side (scan columns from west to east)
+ // east side (scan columns from east to west)
colorTarget = this.getPixelColor(w, h);
- if (!ignoreSides.west) {
- west: for (
+ if (!ignoreSides.east) {
+ east: for (
let x = w - 1;
- x >= 0 + eastPixelsToCrop + minPixelsPerSide;
+ x >= 0 + westPixelsToCrop + minPixelsPerSide;
x--
) {
for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {
@@ -217,12 +217,12 @@ export default function pluginCrop(event) {
if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {
// this pixel is too distant from the first one: abort this side scan
- break west;
+ break east;
}
}
// this column contains all pixels with the same color: increment this side pixels to crop
- westPixelsToCrop++;
+ eastPixelsToCrop++;
}
}
@@ -275,7 +275,7 @@ export default function pluginCrop(event) {
if (doCrop) {
// do the real crop
this.crop(
- eastPixelsToCrop,
+ westPixelsToCrop,
northPixelsToCrop,
widthOfRemainingPixels,
heightOfRemainingPixels
@@ -287,7 +287,7 @@ export default function pluginCrop(event) {
}
return this;
- }
- }
+ },
+ },
};
}
diff --git a/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js b/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js
index 395af91e..9fe2b3a7 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js
+++ b/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js
@@ -1,429 +1,408 @@
-import { Jimp, mkJGD } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, mkJGD } from "@jimp/test-utils";
+import configure from "@jimp/custom";
-import crop from '../src';
+import crop from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [crop] }, Jimp);
-describe('Autocrop', () => {
- it('image with transparent surround color', async () => {
+describe("Autocrop", () => {
+ it("image with transparent surround color", async () => {
const imgSrc = await jimp.read(
mkJGD(
- ' ',
- ' ◆◆ ',
- ' ◆▦▦◆ ',
- ' ◆▦▦▦▦◆ ',
- ' ◆▦▦◆ ',
- ' ◆◆ ',
- ' '
+ " ",
+ " ◆◆ ",
+ " ◆▦▦◆ ",
+ " ◆▦▦▦▦◆ ",
+ " ◆▦▦◆ ",
+ " ◆◆ ",
+ " "
)
);
- imgSrc
- .autocrop()
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(' ◆◆ ', ' ◆▦▦◆ ', '◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ ')
- );
+ expectToBeJGD(
+ imgSrc.autocrop().getJGDSync(),
+ mkJGD(" ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ")
+ );
});
- it('image with opaque surround color', async () => {
+ it("image with opaque surround color", async () => {
const imgSrc = await jimp.read(
mkJGD(
- '▥▥▥▥▥▥▥▥▥▥',
- '▥▥▥▥◆◆▥▥▥▥',
- '▥▥▥◆▦▦◆▥▥▥',
- '▥▥◆▦▦▦▦◆▥▥',
- '▥▥▥◆▦▦◆▥▥▥',
- '▥▥▥▥◆◆▥▥▥▥',
- '▥▥▥▥▥▥▥▥▥▥'
+ "▥▥▥▥▥▥▥▥▥▥",
+ "▥▥▥▥◆◆▥▥▥▥",
+ "▥▥▥◆▦▦◆▥▥▥",
+ "▥▥◆▦▦▦▦◆▥▥",
+ "▥▥▥◆▦▦◆▥▥▥",
+ "▥▥▥▥◆◆▥▥▥▥",
+ "▥▥▥▥▥▥▥▥▥▥"
)
);
- imgSrc
- .autocrop()
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD('▥▥◆◆▥▥', '▥◆▦▦◆▥', '◆▦▦▦▦◆', '▥◆▦▦◆▥', '▥▥◆◆▥▥')
- );
+ expectToBeJGD(
+ imgSrc.autocrop().getJGDSync(),
+ mkJGD("▥▥◆◆▥▥", "▥◆▦▦◆▥", "◆▦▦▦▦◆", "▥◆▦▦◆▥", "▥▥◆◆▥▥")
+ );
});
- it('image with one color border', async () => {
+ it("image with one color border", async () => {
const imgSrc = await jimp.read(
mkJGD(
- '▥▥▥▥▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥▥▥▥▥',
- '▥▥ ◆◆ ▥▥',
- '▥▥ ◆▦▦◆ ▥▥',
- '▥▥ ◆▦▦▦▦◆ ▥▥',
- '▥▥ ◆▦▦◆ ▥▥',
- '▥▥ ◆◆ ▥▥',
- '▥▥▥▥▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥▥▥▥▥'
+ "▥▥▥▥▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥▥▥▥▥",
+ "▥▥ ◆◆ ▥▥",
+ "▥▥ ◆▦▦◆ ▥▥",
+ "▥▥ ◆▦▦▦▦◆ ▥▥",
+ "▥▥ ◆▦▦◆ ▥▥",
+ "▥▥ ◆◆ ▥▥",
+ "▥▥▥▥▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥▥▥▥▥"
)
);
- imgSrc
- .autocrop()
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ')
- );
+ expectToBeJGD(
+ imgSrc.autocrop().getJGDSync(),
+ mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
+ );
});
- it('image border with small variation', async () => {
+ it("image border with small variation", async () => {
const imgSrc = await jimp.read(
mkJGD(
- '323232323232',
- '232323232323',
- '32 ◆◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆▦▦▦▦◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆◆ 32',
- '232323232323',
- '323232323232'
+ "323232323232",
+ "232323232323",
+ "32 ◆◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆▦▦▦▦◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆◆ 32",
+ "232323232323",
+ "323232323232"
)
);
- imgSrc
- .clone()
- .autocrop()
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '323232323232',
- '232323232323',
- '32 ◆◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆▦▦▦▦◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆◆ 32',
- '232323232323',
- '323232323232'
- )
- );
- imgSrc
- .clone()
- .autocrop(0.005)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ')
- );
+ expectToBeJGD(
+ imgSrc.clone().autocrop().getJGDSync(),
+ mkJGD(
+ "323232323232",
+ "232323232323",
+ "32 ◆◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆▦▦▦▦◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆◆ 32",
+ "232323232323",
+ "323232323232"
+ )
+ );
+ expectToBeJGD(
+ imgSrc.clone().autocrop(0.005).getJGDSync(),
+ mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
+ );
});
- it('image border with small variation configured by options', async () => {
+ it("image border with small variation configured by options", async () => {
const imgSrc = await Jimp.read(
mkJGD(
- '323232323232',
- '232323232323',
- '32 ◆◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆▦▦▦▦◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆◆ 32',
- '232323232323',
- '323232323232'
+ "323232323232",
+ "232323232323",
+ "32 ◆◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆▦▦▦▦◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆◆ 32",
+ "232323232323",
+ "323232323232"
+ )
+ );
+ expectToBeJGD(
+ imgSrc.clone().autocrop().getJGDSync(),
+ mkJGD(
+ "323232323232",
+ "232323232323",
+ "32 ◆◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆▦▦▦▦◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆◆ 32",
+ "232323232323",
+ "323232323232"
)
);
- imgSrc
- .clone()
- .autocrop()
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '323232323232',
- '232323232323',
- '32 ◆◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆▦▦▦▦◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆◆ 32',
- '232323232323',
- '323232323232'
- )
- );
- imgSrc
- .clone()
- .autocrop({ tolerance: 0.005 })
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ')
- );
+ expectToBeJGD(
+ imgSrc.clone().autocrop({ tolerance: 0.005 }).getJGDSync(),
+ mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
+ );
});
- it('image without frame', async () => {
+ it("image without frame", async () => {
const imgSrc = await Jimp.read(
mkJGD(
- '▥▥ ◆◆ ',
- '▥▥ ◆▦▦◆ ',
- '▥▥ ◆▦▦▦▦◆ ',
- '▥▥ ◆▦▦◆ ',
- '▥▥ ◆◆ ',
- '▥▥▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥▥▥'
+ "▥▥ ◆◆ ",
+ "▥▥ ◆▦▦◆ ",
+ "▥▥ ◆▦▦▦▦◆ ",
+ "▥▥ ◆▦▦◆ ",
+ "▥▥ ◆◆ ",
+ "▥▥▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥▥▥"
)
);
- imgSrc
- .autocrop(false)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ')
- );
+ expectToBeJGD(
+ imgSrc.autocrop(false).getJGDSync(),
+ mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
+ );
});
- it('image without frame configured by options', async () => {
+ it("image without frame configured by options", async () => {
const imgSrc = await Jimp.read(
mkJGD(
- '▥▥ ◆◆ ',
- '▥▥ ◆▦▦◆ ',
- '▥▥ ◆▦▦▦▦◆ ',
- '▥▥ ◆▦▦◆ ',
- '▥▥ ◆◆ ',
- '▥▥▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥▥▥'
+ "▥▥ ◆◆ ",
+ "▥▥ ◆▦▦◆ ",
+ "▥▥ ◆▦▦▦▦◆ ",
+ "▥▥ ◆▦▦◆ ",
+ "▥▥ ◆◆ ",
+ "▥▥▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥▥▥"
)
);
- imgSrc
- .autocrop({ cropOnlyFrames: false })
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ')
- );
+ expectToBeJGD(
+ imgSrc.autocrop({ cropOnlyFrames: false }).getJGDSync(),
+ mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
+ );
});
- it('image with symmetric border configured by options', async () => {
+ it("image with symmetric border configured by options", async () => {
const imgSrc = await Jimp.read(
mkJGD(
- '▥▥▥▥▥▥▥▥▥▥▥▥▥▥',
- '▥▥ ◆◆ ▥▥▥▥',
- '▥▥ ◆▦▦◆ ▥▥▥▥',
- '▥▥ ◆▦▦▦▦◆ ▥▥▥▥',
- '▥▥ ◆▦▦◆ ▥▥▥▥',
- '▥▥ ◆◆ ▥▥▥▥',
- '▥▥▥▥▥▥▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥▥▥▥▥▥▥'
+ "▥▥▥▥▥▥▥▥▥▥▥▥▥▥",
+ "▥▥ ◆◆ ▥▥▥▥",
+ "▥▥ ◆▦▦◆ ▥▥▥▥",
+ "▥▥ ◆▦▦▦▦◆ ▥▥▥▥",
+ "▥▥ ◆▦▦◆ ▥▥▥▥",
+ "▥▥ ◆◆ ▥▥▥▥",
+ "▥▥▥▥▥▥▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥▥▥▥▥▥▥"
)
);
- imgSrc
- .autocrop({ cropSymmetric: true })
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ◆◆ ▥▥',
- ' ◆▦▦◆ ▥▥',
- ' ◆▦▦▦▦◆ ▥▥',
- ' ◆▦▦◆ ▥▥',
- ' ◆◆ ▥▥',
- '▥▥▥▥▥▥▥▥▥▥'
- )
- );
+ expectToBeJGD(
+ imgSrc.autocrop({ cropSymmetric: true }).getJGDSync(),
+ mkJGD(
+ " ◆◆ ▥▥",
+ " ◆▦▦◆ ▥▥",
+ " ◆▦▦▦▦◆ ▥▥",
+ " ◆▦▦◆ ▥▥",
+ " ◆◆ ▥▥",
+ "▥▥▥▥▥▥▥▥▥▥"
+ )
+ );
});
- it('image without frame and with symmetric border configured by options', async () => {
+ it("image without frame and with symmetric border configured by options", async () => {
const imgSrc = await Jimp.read(
mkJGD(
- '▥▥ ◆◆ ▥▥▥▥',
- '▥▥ ◆▦▦◆ ▥▥▥▥',
- '▥▥ ◆▦▦▦▦◆ ▥▥▥▥',
- '▥▥ ◆▦▦◆ ▥▥▥▥',
- '▥▥ ◆◆ ▥▥▥▥',
- '▥▥▥▥▥▥▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥▥▥▥▥▥▥'
+ "▥▥ ◆◆ ▥▥▥▥",
+ "▥▥ ◆▦▦◆ ▥▥▥▥",
+ "▥▥ ◆▦▦▦▦◆ ▥▥▥▥",
+ "▥▥ ◆▦▦◆ ▥▥▥▥",
+ "▥▥ ◆◆ ▥▥▥▥",
+ "▥▥▥▥▥▥▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥▥▥▥▥▥▥"
+ )
+ );
+ expectToBeJGD(
+ imgSrc
+ .autocrop({ cropSymmetric: true, cropOnlyFrames: false })
+ .getJGDSync(),
+ mkJGD(
+ " ◆◆ ▥▥",
+ " ◆▦▦◆ ▥▥",
+ " ◆▦▦▦▦◆ ▥▥",
+ " ◆▦▦◆ ▥▥",
+ " ◆◆ ▥▥",
+ "▥▥▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥▥▥"
)
);
- imgSrc
- .autocrop({ cropSymmetric: true, cropOnlyFrames: false })
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ◆◆ ▥▥',
- ' ◆▦▦◆ ▥▥',
- ' ◆▦▦▦▦◆ ▥▥',
- ' ◆▦▦◆ ▥▥',
- ' ◆◆ ▥▥',
- '▥▥▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥▥▥'
- )
- );
});
- it('image without frame and with some border left', async () => {
+ it("image without frame and with some border left", async () => {
const imgSrc = await Jimp.read(
mkJGD(
- '323232323232',
- '232323232323',
- '32 ◆◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆▦▦▦▦◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆◆ 32',
- '232323232323',
- '323232323232'
+ "323232323232",
+ "232323232323",
+ "32 ◆◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆▦▦▦▦◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆◆ 32",
+ "232323232323",
+ "323232323232"
)
);
- imgSrc
- .autocrop({
- tolerance: 0.005,
- leaveBorder: 1
- })
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '3232323232',
- '2 ◆◆ 3',
- '3 ◆▦▦◆ 2',
- '2 ◆▦▦▦▦◆ 3',
- '3 ◆▦▦◆ 2',
- '2 ◆◆ 3',
- '3232323232'
- )
- );
+ expectToBeJGD(
+ imgSrc
+ .autocrop({
+ tolerance: 0.005,
+ leaveBorder: 1,
+ })
+ .getJGDSync(),
+ mkJGD(
+ "3232323232",
+ "2 ◆◆ 3",
+ "3 ◆▦▦◆ 2",
+ "2 ◆▦▦▦▦◆ 3",
+ "3 ◆▦▦◆ 2",
+ "2 ◆◆ 3",
+ "3232323232"
+ )
+ );
});
it('image not cropped given an out of bounds "leaveBorder" value ', async () => {
const imgSrc = await Jimp.read(
mkJGD(
- '323232323232',
- '232323232323',
- '32 ◆◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆▦▦▦▦◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆◆ 32',
- '232323232323',
- '323232323232'
+ "323232323232",
+ "232323232323",
+ "32 ◆◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆▦▦▦▦◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆◆ 32",
+ "232323232323",
+ "323232323232"
+ )
+ );
+ expectToBeJGD(
+ imgSrc
+ .autocrop({
+ tolerance: 0.005,
+ leaveBorder: 100,
+ })
+ .getJGDSync(),
+ mkJGD(
+ "323232323232",
+ "232323232323",
+ "32 ◆◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆▦▦▦▦◆ 32",
+ "23 ◆▦▦◆ 23",
+ "32 ◆◆ 32",
+ "232323232323",
+ "323232323232"
)
);
-
- imgSrc
- .autocrop({
- tolerance: 0.005,
- leaveBorder: 100
- })
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '323232323232',
- '232323232323',
- '32 ◆◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆▦▦▦▦◆ 32',
- '23 ◆▦▦◆ 23',
- '32 ◆◆ 32',
- '232323232323',
- '323232323232'
- )
- );
});
- it('image with top and bottom frame and leaveBorder', async () => {
+ it("image with top and bottom frame and leaveBorder", async () => {
const imgSrc = await Jimp.read(
mkJGD(
- '▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥',
- ' ◆◆ ',
- ' ◆▦▦◆ ',
- ' ◆▦▦▦▦◆ ',
- ' ◆▦▦◆ ',
- ' ◆◆ ',
- '▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥'
+ "▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥",
+ " ◆◆ ",
+ " ◆▦▦◆ ",
+ " ◆▦▦▦▦◆ ",
+ " ◆▦▦◆ ",
+ " ◆◆ ",
+ "▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥"
+ )
+ );
+ expectToBeJGD(
+ imgSrc
+ .autocrop({
+ cropSymmetric: true,
+ cropOnlyFrames: false,
+ leaveBorder: 2,
+ })
+ .getJGDSync(),
+ mkJGD(
+ "▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥",
+ " ◆◆ ",
+ " ◆▦▦◆ ",
+ " ◆▦▦▦▦◆ ",
+ " ◆▦▦◆ ",
+ " ◆◆ ",
+ "▥▥▥▥▥▥▥▥",
+ "▥▥▥▥▥▥▥▥"
)
);
- imgSrc
- .autocrop({ cropSymmetric: true, cropOnlyFrames: false, leaveBorder: 2 })
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥',
- ' ◆◆ ',
- ' ◆▦▦◆ ',
- ' ◆▦▦▦▦◆ ',
- ' ◆▦▦◆ ',
- ' ◆◆ ',
- '▥▥▥▥▥▥▥▥',
- '▥▥▥▥▥▥▥▥'
- )
- );
});
- it('ignore sides north', async () => {
+ it("ignore sides north", async () => {
const imgSrc = await jimp.read(
mkJGD(
- ' ',
- ' ◆◆ ',
- ' ◆▦▦◆ ',
- ' ◆▦▦▦▦◆ ',
- ' ◆▦▦◆ ',
- ' ◆◆ ',
- ' '
+ " ",
+ " ◆◆ ",
+ " ◆▦▦◆ ",
+ " ◆▦▦▦▦◆ ",
+ " ◆▦▦◆ ",
+ " ◆◆ ",
+ " "
)
);
-
- imgSrc
- .autocrop({ cropOnlyFrames: false, ignoreSides: { north: true } })
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(' ', ' ◆◆ ', ' ◆▦▦◆ ', '◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ ')
- );
+ expectToBeJGD(
+ imgSrc
+ .autocrop({ cropOnlyFrames: false, ignoreSides: { north: true } })
+ .getJGDSync(),
+ mkJGD(" ", " ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ")
+ );
});
- it('ignore sides south and west', async () => {
+ it("ignore sides south and west", async () => {
const imgSrc = await jimp.read(
mkJGD(
- ' ',
- ' ◆◆ ',
- ' ◆▦▦◆ ',
- ' ◆▦▦▦▦◆ ',
- ' ◆▦▦◆ ',
- ' ◆◆ ',
- ' '
+ " ",
+ " ◆◆ ",
+ " ◆▦▦◆ ",
+ " ◆▦▦▦▦◆ ",
+ " ◆▦▦◆ ",
+ " ◆◆ ",
+ " "
)
);
- imgSrc
- .autocrop({
- cropOnlyFrames: false,
- ignoreSides: { west: true, south: true }
- })
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ◆◆ ',
- ' ◆▦▦◆ ',
- '◆▦▦▦▦◆ ',
- ' ◆▦▦◆ ',
- ' ◆◆ ',
- ' '
- )
- );
+ expectToBeJGD(
+ imgSrc
+ .autocrop({
+ cropOnlyFrames: false,
+ ignoreSides: { west: true, south: true },
+ })
+ .getJGDSync(),
+ mkJGD(
+ " ◆◆ ",
+ " ◆▦▦◆ ",
+ " ◆▦▦▦▦◆",
+ " ◆▦▦◆ ",
+ " ◆◆ ",
+ " "
+ )
+ );
});
- it('ignore sides east', async () => {
+ it("ignore sides east", async () => {
const imgSrc = await jimp.read(
mkJGD(
- ' ',
- ' ◆◆ ',
- ' ◆▦▦◆ ',
- ' ◆▦▦▦▦◆ ',
- ' ◆▦▦◆ ',
- ' ◆◆ ',
- ' '
+ " ",
+ " ◆◆ ",
+ " ◆▦▦◆ ",
+ " ◆▦▦▦▦◆ ",
+ " ◆▦▦◆ ",
+ " ◆◆ ",
+ " "
)
);
- imgSrc
- .autocrop({ cropOnlyFrames: false, ignoreSides: { east: true } })
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ ')
- );
+ expectToBeJGD(
+ imgSrc
+ .autocrop({ cropOnlyFrames: false, ignoreSides: { east: true } })
+ .getJGDSync(),
+ mkJGD(" ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
+ );
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js b/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js
index 88f64973..a6bb5002 100644
--- a/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js
+++ b/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js
@@ -1,65 +1,66 @@
-import { Jimp, mkJGD } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, mkJGD } from "@jimp/test-utils";
+import configure from "@jimp/custom";
-import crop from '../src';
+import crop from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [crop] }, Jimp);
-describe('crop', () => {
+describe("crop", () => {
// 6x5 size
- const testImage = mkJGD(' ◆◆ ', ' ◆▦▦◆ ', '◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ ');
+ const testImage = mkJGD(" ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ");
- it('full width from top', async () => {
+ it("full width from top", async () => {
const imgSrc = await jimp.read(testImage);
- imgSrc
- .crop(0, 0, 6, 2)
- .getJGDSync()
- .should.be.sameJGD(mkJGD(' ◆◆ ', ' ◆▦▦◆ '));
+ expectToBeJGD(
+ imgSrc.crop(0, 0, 6, 2).getJGDSync(),
+ mkJGD(" ◆◆ ", " ◆▦▦◆ ")
+ );
});
- it('full width from bottom', async () => {
+ it("full width from bottom", async () => {
const imgSrc = await jimp.read(testImage);
- imgSrc
- .crop(0, 3, 6, 2)
- .getJGDSync()
- .should.be.sameJGD(mkJGD(' ◆▦▦◆ ', ' ◆◆ '));
+ expectToBeJGD(
+ imgSrc.crop(0, 3, 6, 2).getJGDSync(),
+ mkJGD(" ◆▦▦◆ ", " ◆◆ ")
+ );
});
- it('full width from middle', async () => {
+ it("full width from middle", async () => {
const imgSrc = await jimp.read(testImage);
- imgSrc
- .crop(0, 2, 6, 2)
- .getJGDSync()
- .should.be.sameJGD(mkJGD('◆▦▦▦▦◆', ' ◆▦▦◆ '));
+ expectToBeJGD(
+ imgSrc.crop(0, 2, 6, 2).getJGDSync(),
+ mkJGD("◆▦▦▦▦◆", " ◆▦▦◆ ")
+ );
});
- it('full height from left', async () => {
+ it("full height from left", async () => {
const imgSrc = await jimp.read(testImage);
- imgSrc
- .crop(0, 0, 2, 5)
- .getJGDSync()
- .should.be.sameJGD(mkJGD(' ', ' ◆', '◆▦', ' ◆', ' '));
+ expectToBeJGD(
+ imgSrc.crop(0, 0, 2, 5).getJGDSync(),
+ mkJGD(" ", " ◆", "◆▦", " ◆", " ")
+ );
});
- it('full height from right', async () => {
+ it("full height from right", async () => {
const imgSrc = await jimp.read(testImage);
- imgSrc
- .crop(4, 0, 2, 5)
- .getJGDSync()
- .should.be.sameJGD(mkJGD(' ', '◆ ', '▦◆', '◆ ', ' '));
+ expectToBeJGD(
+ imgSrc.crop(4, 0, 2, 5).getJGDSync(),
+ mkJGD(" ", "◆ ", "▦◆", "◆ ", " ")
+ );
});
- it('full height from middle', async () => {
+ it("full height from middle", async () => {
const imgSrc = await jimp.read(testImage);
- imgSrc
- .crop(2, 0, 2, 5)
- .getJGDSync()
- .should.be.sameJGD(mkJGD('◆◆', '▦▦', '▦▦', '▦▦', '◆◆'));
+ expectToBeJGD(
+ imgSrc.crop(2, 0, 2, 5).getJGDSync(),
+ mkJGD("◆◆", "▦▦", "▦▦", "▦▦", "◆◆")
+ );
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md
index 26394e0f..8d029143 100644
--- a/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md
@@ -1,3 +1,51 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +60,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +68,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-displace/README.md b/project starter code/node_modules/@jimp/plugin-displace/README.md
index fe3a7bc3..d74a2447 100644
--- a/project starter code/node_modules/@jimp/plugin-displace/README.md
+++ b/project starter code/node_modules/@jimp/plugin-displace/README.md
@@ -14,10 +14,10 @@ Displaces the image based on the provided displacement map
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
// Make me better!
image.displace(map, 10);
diff --git a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js b/project starter code/node_modules/@jimp/plugin-displace/dist/index.js
index c5d30800..f698154b 100644
--- a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-displace/dist/index.js
@@ -1,16 +1,10 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Displaces the image based on the provided displacement map
* @param {object} map the source Jimp instance
@@ -18,36 +12,30 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- displace: function displace(map, offset, cb) {
- if ((0, _typeof2["default"])(map) !== 'object' || map.constructor !== this.constructor) {
- return _utils.throwError.call(this, 'The source must be a Jimp image', cb);
- }
-
- if (typeof offset !== 'number') {
- return _utils.throwError.call(this, 'factor must be a number', cb);
- }
-
- var source = this.cloneQuiet();
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var displacement = map.bitmap.data[idx] / 256 * offset;
- displacement = Math.round(displacement);
- var ids = this.getPixelIndex(x + displacement, y);
- this.bitmap.data[ids] = source.bitmap.data[idx];
- this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];
- this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+var _default = () => ({
+ displace(map, offset, cb) {
+ if (typeof map !== "object" || map.constructor !== this.constructor) {
+ return _utils.throwError.call(this, "The source must be a Jimp image", cb);
}
- };
-};
-
-exports["default"] = _default;
+ if (typeof offset !== "number") {
+ return _utils.throwError.call(this, "factor must be a number", cb);
+ }
+ const source = this.cloneQuiet();
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ let displacement = map.bitmap.data[idx] / 256 * offset;
+ displacement = Math.round(displacement);
+ const ids = this.getPixelIndex(x + displacement, y);
+ this.bitmap.data[ids] = source.bitmap.data[idx];
+ this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];
+ this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map
index 4bf4208a..b34bbd4e 100644
--- a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["displace","map","offset","cb","constructor","throwError","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;eAOe;AAAA,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A5B;AACD,OAZD;;AAcA,UAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== 'object' || map.constructor !== this.constructor) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof offset !== 'number') {\n return throwError.call(this, 'factor must be a number', cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["displace","map","offset","cb","constructor","throwError","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== \"object\" || map.constructor !== this.constructor) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof offset !== \"number\") {\n return throwError.call(this, \"factor must be a number\", cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,eAOe,OAAO;EACpBA,QAAQ,CAACC,GAAG,EAAEC,MAAM,EAAEC,EAAE,EAAE;IACxB,IAAI,OAAOF,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACG,WAAW,KAAK,IAAI,CAACA,WAAW,EAAE;MACnE,OAAOC,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEH,EAAE,CAAC;IACrE;IAEA,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE;MAC9B,OAAOG,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEH,EAAE,CAAC;IAC7D;IAEA,MAAMI,MAAM,GAAG,IAAI,CAACC,UAAU,EAAE;IAChC,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;MACnB,IAAIC,YAAY,GAAIf,GAAG,CAACS,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAG,GAAG,GAAIb,MAAM;MACxDc,YAAY,GAAGE,IAAI,CAACC,KAAK,CAACH,YAAY,CAAC;MAEvC,MAAMI,GAAG,GAAG,IAAI,CAACC,aAAa,CAACR,CAAC,GAAGG,YAAY,EAAEF,CAAC,CAAC;MACnD,IAAI,CAACJ,MAAM,CAACO,IAAI,CAACG,GAAG,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC;MAC/C,IAAI,CAACL,MAAM,CAACO,IAAI,CAACG,GAAG,GAAG,CAAC,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC;MACvD,IAAI,CAACL,MAAM,CAACO,IAAI,CAACG,GAAG,GAAG,CAAC,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC;IACzD,CAAC,CACF;IAED,IAAI,IAAAO,oBAAa,EAACnB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-displace/es/index.js b/project starter code/node_modules/@jimp/plugin-displace/es/index.js
index b5e9d289..acdc290c 100644
--- a/project starter code/node_modules/@jimp/plugin-displace/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-displace/es/index.js
@@ -1,15 +1,4 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
-
-var _utils = require("@jimp/utils");
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Displaces the image based on the provided displacement map
@@ -18,35 +7,27 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- displace: function displace(map, offset, cb) {
- if ((0, _typeof2["default"])(map) !== 'object' || map.constructor !== this.constructor) {
- return _utils.throwError.call(this, 'The source must be a Jimp image', cb);
- }
-
- if (typeof offset !== 'number') {
- return _utils.throwError.call(this, 'factor must be a number', cb);
- }
-
- var source = this.cloneQuiet();
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var displacement = map.bitmap.data[idx] / 256 * offset;
- displacement = Math.round(displacement);
- var ids = this.getPixelIndex(x + displacement, y);
- this.bitmap.data[ids] = source.bitmap.data[idx];
- this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];
- this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+export default (() => ({
+ displace(map, offset, cb) {
+ if (typeof map !== "object" || map.constructor !== this.constructor) {
+ return throwError.call(this, "The source must be a Jimp image", cb);
}
- };
-};
-
-exports["default"] = _default;
+ if (typeof offset !== "number") {
+ return throwError.call(this, "factor must be a number", cb);
+ }
+ const source = this.cloneQuiet();
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ let displacement = map.bitmap.data[idx] / 256 * offset;
+ displacement = Math.round(displacement);
+ const ids = this.getPixelIndex(x + displacement, y);
+ this.bitmap.data[ids] = source.bitmap.data[idx];
+ this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];
+ this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map b/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map
index 4bf4208a..3c4a069d 100644
--- a/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["displace","map","offset","cb","constructor","throwError","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;eAOe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,GADW,EACNC,MADM,EACEC,EADF,EACM;AACxB,UAAI,yBAAOF,GAAP,MAAe,QAAf,IAA2BA,GAAG,CAACG,WAAJ,KAAoB,KAAKA,WAAxD,EAAqE;AACnE,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9B,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAED,UAAMI,MAAM,GAAG,KAAKC,UAAL,EAAf;AACA,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,YAAIC,YAAY,GAAIf,GAAG,CAACS,MAAJ,CAAWO,IAAX,CAAgBF,GAAhB,IAAuB,GAAxB,GAA+Bb,MAAlD;AACAc,QAAAA,YAAY,GAAGE,IAAI,CAACC,KAAL,CAAWH,YAAX,CAAf;AAEA,YAAMI,GAAG,GAAG,KAAKC,aAAL,CAAmBR,CAAC,GAAGG,YAAvB,EAAqCF,CAArC,CAAZ;AACA,aAAKJ,MAAL,CAAYO,IAAZ,CAAiBG,GAAjB,IAAwBb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAnB,CAAxB;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACD,OAZD;;AAcA,UAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== 'object' || map.constructor !== this.constructor) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof offset !== 'number') {\n return throwError.call(this, 'factor must be a number', cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","throwError","displace","map","offset","cb","constructor","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== \"object\" || map.constructor !== this.constructor) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof offset !== \"number\") {\n return throwError.call(this, \"factor must be a number\", cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,QAAQ,CAACC,GAAG,EAAEC,MAAM,EAAEC,EAAE,EAAE;IACxB,IAAI,OAAOF,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACG,WAAW,KAAK,IAAI,CAACA,WAAW,EAAE;MACnE,OAAOL,UAAU,CAACM,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEF,EAAE,CAAC;IACrE;IAEA,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE;MAC9B,OAAOH,UAAU,CAACM,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;IAC7D;IAEA,MAAMG,MAAM,GAAG,IAAI,CAACC,UAAU,EAAE;IAChC,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;MACnB,IAAIC,YAAY,GAAId,GAAG,CAACQ,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAG,GAAG,GAAIZ,MAAM;MACxDa,YAAY,GAAGE,IAAI,CAACC,KAAK,CAACH,YAAY,CAAC;MAEvC,MAAMI,GAAG,GAAG,IAAI,CAACC,aAAa,CAACR,CAAC,GAAGG,YAAY,EAAEF,CAAC,CAAC;MACnD,IAAI,CAACJ,MAAM,CAACO,IAAI,CAACG,GAAG,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC;MAC/C,IAAI,CAACL,MAAM,CAACO,IAAI,CAACG,GAAG,GAAG,CAAC,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC;MACvD,IAAI,CAACL,MAAM,CAACO,IAAI,CAACG,GAAG,GAAG,CAAC,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC;IACzD,CAAC,CACF;IAED,IAAIhB,aAAa,CAACK,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-displace/index.d.ts b/project starter code/node_modules/@jimp/plugin-displace/index.d.ts
index d9f8652f..d2ea79bf 100644
--- a/project starter code/node_modules/@jimp/plugin-displace/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-displace/index.d.ts
@@ -1,7 +1,7 @@
-import { Jimp, ImageCallback } from '@jimp/core';
+import { Jimp, ImageCallback } from "@jimp/core";
interface Displace {
displace(map: Jimp, offset: number, cb?: ImageCallback): this;
}
-export default function(): Displace;
+export default function (): Displace;
diff --git a/project starter code/node_modules/@jimp/plugin-displace/package.json b/project starter code/node_modules/@jimp/plugin-displace/package.json
index 2f273c69..3f4eaa1a 100644
--- a/project starter code/node_modules/@jimp/plugin-displace/package.json
+++ b/project starter code/node_modules/@jimp/plugin-displace/package.json
@@ -1,9 +1,10 @@
{
"name": "@jimp/plugin-displace",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "displace an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
"build": "npm run build:node:production && npm run build:module",
@@ -17,8 +18,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
@@ -26,5 +26,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-displace/src/index.js b/project starter code/node_modules/@jimp/plugin-displace/src/index.js
index 0e5c5b5c..4dcd4403 100644
--- a/project starter code/node_modules/@jimp/plugin-displace/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-displace/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern, throwError } from '@jimp/utils';
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Displaces the image based on the provided displacement map
@@ -9,33 +9,35 @@ import { isNodePattern, throwError } from '@jimp/utils';
*/
export default () => ({
displace(map, offset, cb) {
- if (typeof map !== 'object' || map.constructor !== this.constructor) {
- return throwError.call(this, 'The source must be a Jimp image', cb);
+ if (typeof map !== "object" || map.constructor !== this.constructor) {
+ return throwError.call(this, "The source must be a Jimp image", cb);
}
- if (typeof offset !== 'number') {
- return throwError.call(this, 'factor must be a number', cb);
+ if (typeof offset !== "number") {
+ return throwError.call(this, "factor must be a number", cb);
}
const source = this.cloneQuiet();
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- let displacement = (map.bitmap.data[idx] / 256) * offset;
- displacement = Math.round(displacement);
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ let displacement = (map.bitmap.data[idx] / 256) * offset;
+ displacement = Math.round(displacement);
- const ids = this.getPixelIndex(x + displacement, y);
- this.bitmap.data[ids] = source.bitmap.data[idx];
- this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];
- this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];
- });
+ const ids = this.getPixelIndex(x + displacement, y);
+ this.bitmap.data[ids] = source.bitmap.data[idx];
+ this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];
+ this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md
index 26394e0f..8d029143 100644
--- a/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md
@@ -1,3 +1,51 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +60,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +68,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-dither/README.md b/project starter code/node_modules/@jimp/plugin-dither/README.md
index f578dc8f..b384599d 100644
--- a/project starter code/node_modules/@jimp/plugin-dither/README.md
+++ b/project starter code/node_modules/@jimp/plugin-dither/README.md
@@ -14,10 +14,10 @@ Apply a ordered dithering effect
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.dither565();
}
diff --git a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js b/project starter code/node_modules/@jimp/plugin-dither/dist/index.js
index a4fc3cd8..ea11d97e 100644
--- a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-dither/dist/index.js
@@ -3,39 +3,32 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Apply a ordered dithering effect
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
function dither(cb) {
- var rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];
+ const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var thresholdId = ((y & 3) << 2) + x % 4;
- var dither = rgb565Matrix[thresholdId];
+ const thresholdId = ((y & 3) << 2) + x % 4;
+ const dither = rgb565Matrix[thresholdId];
this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);
this.bitmap.data[idx + 1] = Math.min(this.bitmap.data[idx + 1] + dither, 0xff);
this.bitmap.data[idx + 2] = Math.min(this.bitmap.data[idx + 2] + dither, 0xff);
});
-
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}
-
return this;
}
-
-var _default = function _default() {
- return {
- dither565: dither,
- dither16: dither
- };
-};
-
-exports["default"] = _default;
+var _default = () => ({
+ dither565: dither,
+ dither16: dither
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map
index 8e9cf9e3..50627c72 100644
--- a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","call","dither565","dither16"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,MAAT,CAAgBC,EAAhB,EAAoB;AAClB,MAAMC,YAAY,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,EAAV,EAAc,EAAd,EAAkB,CAAlB,EAAqB,EAArB,EAAyB,CAAzB,EAA4B,CAA5B,EAA+B,EAA/B,EAAmC,CAAnC,EAAsC,EAAtC,EAA0C,EAA1C,EAA8C,CAA9C,EAAiD,EAAjD,EAAqD,CAArD,CAArB;AACA,OAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,QAAMC,WAAW,GAAG,CAAC,CAACF,CAAC,GAAG,CAAL,KAAW,CAAZ,IAAkBD,CAAC,GAAG,CAA1C;AACA,QAAMP,MAAM,GAAGE,YAAY,CAACQ,WAAD,CAA3B;AACA,SAAKN,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBG,IAAI,CAACC,GAAL,CAAS,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBT,MAAjC,EAAyC,IAAzC,CAAxB;AACA,SAAKI,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BG,IAAI,CAACC,GAAL,CAC1B,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BT,MADF,EAE1B,IAF0B,CAA5B;AAIA,SAAKI,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BG,IAAI,CAACC,GAAL,CAC1B,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BT,MADF,EAE1B,IAF0B,CAA5B;AAID,GAhBD;;AAkBA,MAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACa,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBC,IAAAA,SAAS,EAAEf,MADS;AAEpBgB,IAAAA,QAAQ,EAAEhB;AAFU,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","isNodePattern","call","dither565","dither16"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither,\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,CAACC,EAAE,EAAE;EAClB,MAAMC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;EAC5E,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;IACnB,MAAMC,WAAW,GAAG,CAAC,CAACF,CAAC,GAAG,CAAC,KAAK,CAAC,IAAKD,CAAC,GAAG,CAAE;IAC5C,MAAMP,MAAM,GAAGE,YAAY,CAACQ,WAAW,CAAC;IACxC,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGG,IAAI,CAACC,GAAG,CAAC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGT,MAAM,EAAE,IAAI,CAAC;IACtE,IAAI,CAACI,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGG,IAAI,CAACC,GAAG,CAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGT,MAAM,EAClC,IAAI,CACL;IACD,IAAI,CAACI,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGG,IAAI,CAACC,GAAG,CAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGT,MAAM,EAClC,IAAI,CACL;EACH,CAAC,CACF;EAED,IAAI,IAAAc,oBAAa,EAACb,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACc,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb;AAAC,eAEc,OAAO;EACpBC,SAAS,EAAEhB,MAAM;EACjBiB,QAAQ,EAAEjB;AACZ,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-dither/es/index.js b/project starter code/node_modules/@jimp/plugin-dither/es/index.js
index 17b6b6a7..0dcc1360 100644
--- a/project starter code/node_modules/@jimp/plugin-dither/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-dither/es/index.js
@@ -1,11 +1,4 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern } from "@jimp/utils";
/**
* Apply a ordered dithering effect
@@ -13,28 +6,21 @@ var _utils = require("@jimp/utils");
* @returns {Jimp} this for chaining of methods
*/
function dither(cb) {
- var rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];
+ const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var thresholdId = ((y & 3) << 2) + x % 4;
- var dither = rgb565Matrix[thresholdId];
+ const thresholdId = ((y & 3) << 2) + x % 4;
+ const dither = rgb565Matrix[thresholdId];
this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);
this.bitmap.data[idx + 1] = Math.min(this.bitmap.data[idx + 1] + dither, 0xff);
this.bitmap.data[idx + 2] = Math.min(this.bitmap.data[idx + 2] + dither, 0xff);
});
-
- if ((0, _utils.isNodePattern)(cb)) {
+ if (isNodePattern(cb)) {
cb.call(this, null, this);
}
-
return this;
}
-
-var _default = function _default() {
- return {
- dither565: dither,
- dither16: dither
- };
-};
-
-exports["default"] = _default;
+export default (() => ({
+ dither565: dither,
+ dither16: dither
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map b/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map
index 8e9cf9e3..f3ec9697 100644
--- a/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","call","d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EAAuB;AACrBA,IAAAA,EAAE,CAACa,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBC,IAAAA,SAAS,EAAEf,MADS;AAEpBgB,IAAAA,QAAQ,EAAEhB;AAFU,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","call","dither565","dither16"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither,\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA,SAASC,MAAM,CAACC,EAAE,EAAE;EAClB,MAAMC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;EAC5E,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;IACnB,MAAMC,WAAW,GAAG,CAAC,CAACF,CAAC,GAAG,CAAC,KAAK,CAAC,IAAKD,CAAC,GAAG,CAAE;IAC5C,MAAMP,MAAM,GAAGE,YAAY,CAACQ,WAAW,CAAC;IACxC,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGG,IAAI,CAACC,GAAG,CAAC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGT,MAAM,EAAE,IAAI,CAAC;IACtE,IAAI,CAACI,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGG,IAAI,CAACC,GAAG,CAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGT,MAAM,EAClC,IAAI,CACL;IACD,IAAI,CAACI,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGG,IAAI,CAACC,GAAG,CAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGT,MAAM,EAClC,IAAI,CACL;EACH,CAAC,CACF;EAED,IAAID,aAAa,CAACE,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACa,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb;AAEA,gBAAe,OAAO;EACpBC,SAAS,EAAEf,MAAM;EACjBgB,QAAQ,EAAEhB;AACZ,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-dither/index.d.ts b/project starter code/node_modules/@jimp/plugin-dither/index.d.ts
index 5b00858c..9f2415df 100644
--- a/project starter code/node_modules/@jimp/plugin-dither/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-dither/index.d.ts
@@ -1,8 +1,8 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Dither {
dither565(cb?: ImageCallback): this;
dither16(cb?: ImageCallback): this;
}
-export default function(): Dither;
+export default function (): Dither;
diff --git a/project starter code/node_modules/@jimp/plugin-dither/package.json b/project starter code/node_modules/@jimp/plugin-dither/package.json
index 20abf485..0f65daff 100644
--- a/project starter code/node_modules/@jimp/plugin-dither/package.json
+++ b/project starter code/node_modules/@jimp/plugin-dither/package.json
@@ -1,9 +1,10 @@
{
"name": "@jimp/plugin-dither",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Dither an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
"build": "npm run build:node:production && npm run build:module",
@@ -17,8 +18,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
@@ -26,5 +26,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-dither/src/index.js b/project starter code/node_modules/@jimp/plugin-dither/src/index.js
index 59019faa..c5ce9ece 100644
--- a/project starter code/node_modules/@jimp/plugin-dither/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-dither/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern } from '@jimp/utils';
+import { isNodePattern } from "@jimp/utils";
/**
* Apply a ordered dithering effect
@@ -7,23 +7,25 @@ import { isNodePattern } from '@jimp/utils';
*/
function dither(cb) {
const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- const thresholdId = ((y & 3) << 2) + (x % 4);
- const dither = rgb565Matrix[thresholdId];
- this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);
- this.bitmap.data[idx + 1] = Math.min(
- this.bitmap.data[idx + 1] + dither,
- 0xff
- );
- this.bitmap.data[idx + 2] = Math.min(
- this.bitmap.data[idx + 2] + dither,
- 0xff
- );
- });
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ const thresholdId = ((y & 3) << 2) + (x % 4);
+ const dither = rgb565Matrix[thresholdId];
+ this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);
+ this.bitmap.data[idx + 1] = Math.min(
+ this.bitmap.data[idx + 1] + dither,
+ 0xff
+ );
+ this.bitmap.data[idx + 2] = Math.min(
+ this.bitmap.data[idx + 2] + dither,
+ 0xff
+ );
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
@@ -34,5 +36,5 @@ function dither(cb) {
export default () => ({
dither565: dither,
- dither16: dither
+ dither16: dither,
});
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md
index 25346d5c..a3763830 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md
@@ -1,3 +1,65 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.16.2 (Thu Sep 15 2022)
#### 📝 Documentation
@@ -24,7 +86,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -32,4 +94,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/README.md b/project starter code/node_modules/@jimp/plugin-fisheye/README.md
index 97a86b6a..3a1ae13c 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/README.md
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/README.md
@@ -11,10 +11,10 @@
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.fisheye();
// or
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js b/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js
index 60a6d805..13e2603a 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js
@@ -1,38 +1,38 @@
-module.exports = api => {
+module.exports = (api) => {
api.cache(true);
return {
presets: [
[
- '@babel/env',
+ "@babel/env",
{
- useBuiltIns: 'usage'
- }
- ]
+ useBuiltIns: "usage",
+ },
+ ],
],
plugins: [
- '@babel/proposal-class-properties',
- '@babel/syntax-object-rest-spread',
- process.env.BABEL_ENV !== 'module' && 'add-module-exports',
+ "@babel/proposal-class-properties",
+ "@babel/syntax-object-rest-spread",
+ process.env.BABEL_ENV !== "module" && "add-module-exports",
[
- 'transform-inline-environment-variables',
- { include: ['BABEL_ENV', 'ENV'] }
- ]
+ "transform-inline-environment-variables",
+ { include: ["BABEL_ENV", "ENV"] },
+ ],
].filter(Boolean),
env: {
test: {
- plugins: ['istanbul']
+ plugins: ["istanbul"],
},
development: {
- plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter(
+ plugins: [process.env.ENV !== "browser" && "source-map-support"].filter(
Boolean
- )
+ ),
},
module: {
- presets: [['@babel/env', { modules: false }]]
- }
- }
+ presets: [["@babel/env", { modules: false }]],
+ },
+ },
};
};
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js b/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js
index 82e4d8c2..ef9cecd5 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js
@@ -3,63 +3,53 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Creates a circle out of an image.
* @param {object} options (optional) r: radius of effect
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- fisheye: function fisheye() {
- var _this = this;
-
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
+var _default = () => ({
+ fisheye() {
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
+ r: 2.5
+ };
+ let cb = arguments.length > 1 ? arguments[1] : undefined;
+ if (typeof options === "function") {
+ cb = options;
+ options = {
r: 2.5
};
- var cb = arguments.length > 1 ? arguments[1] : undefined;
-
- if (typeof options === 'function') {
- cb = options;
- options = {
- r: 2.5
- };
- }
-
- var source = this.cloneQuiet();
- var _source$bitmap = source.bitmap,
- width = _source$bitmap.width,
- height = _source$bitmap.height;
- source.scanQuiet(0, 0, width, height, function (x, y) {
- var hx = x / width;
- var hy = y / height;
- var r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));
- var rn = 2 * Math.pow(r, options.r);
- var cosA = (hx - 0.5) / r;
- var sinA = (hy - 0.5) / r;
- var newX = Math.round((rn * cosA + 0.5) * width);
- var newY = Math.round((rn * sinA + 0.5) * height);
- var color = source.getPixelColor(newX, newY);
-
- _this.setPixelColor(color, x, y);
- });
- /* Set center pixel color, otherwise it will be transparent */
-
- this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
}
- };
-};
-
-exports["default"] = _default;
+ const source = this.cloneQuiet();
+ const {
+ width,
+ height
+ } = source.bitmap;
+ source.scanQuiet(0, 0, width, height, (x, y) => {
+ const hx = x / width;
+ const hy = y / height;
+ const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));
+ const rn = 2 * Math.pow(r, options.r);
+ const cosA = (hx - 0.5) / r;
+ const sinA = (hy - 0.5) / r;
+ const newX = Math.round((rn * cosA + 0.5) * width);
+ const newY = Math.round((rn * sinA + 0.5) * height);
+ const color = source.getPixelColor(newX, newY);
+ this.setPixelColor(color, x, y);
+ });
+
+ /* Set center pixel color, otherwise it will be transparent */
+ this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map
index e31c3f43..5b934ad4 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["fisheye","options","r","cb","source","cloneQuiet","bitmap","width","height","scanQuiet","x","y","hx","hy","Math","sqrt","pow","rn","cosA","sinA","newX","round","newY","color","getPixelColor","setPixelColor","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,OADoB,qBACc;AAAA;;AAAA,UAA1BC,OAA0B,uEAAhB;AAAEC,QAAAA,CAAC,EAAE;AAAL,OAAgB;AAAA,UAAJC,EAAI;;AAChC,UAAI,OAAOF,OAAP,KAAmB,UAAvB,EAAmC;AACjCE,QAAAA,EAAE,GAAGF,OAAL;AACAA,QAAAA,OAAO,GAAG;AAAEC,UAAAA,CAAC,EAAE;AAAL,SAAV;AACD;;AAED,UAAME,MAAM,GAAG,KAAKC,UAAL,EAAf;AANgC,2BAOND,MAAM,CAACE,MAPD;AAAA,UAOxBC,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AM,GAAG,CAHX;;AAMA,UAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACuB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["fisheye","options","r","cb","source","cloneQuiet","width","height","bitmap","scanQuiet","x","y","hx","hy","Math","sqrt","pow","rn","cosA","sinA","newX","round","newY","color","getPixelColor","setPixelColor","isNodePattern","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AALA,eAMe,OAAO;EACpBA,OAAO,GAA2B;IAAA,IAA1BC,OAAO,uEAAG;MAAEC,CAAC,EAAE;IAAI,CAAC;IAAA,IAAEC,EAAE;IAC9B,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;MACjCE,EAAE,GAAGF,OAAO;MACZA,OAAO,GAAG;QAAEC,CAAC,EAAE;MAAI,CAAC;IACtB;IAEA,MAAME,MAAM,GAAG,IAAI,CAACC,UAAU,EAAE;IAChC,MAAM;MAAEC,KAAK;MAAEC;IAAO,CAAC,GAAGH,MAAM,CAACI,MAAM;IAEvCJ,MAAM,CAACK,SAAS,CAAC,CAAC,EAAE,CAAC,EAAEH,KAAK,EAAEC,MAAM,EAAE,CAACG,CAAC,EAAEC,CAAC,KAAK;MAC9C,MAAMC,EAAE,GAAGF,CAAC,GAAGJ,KAAK;MACpB,MAAMO,EAAE,GAAGF,CAAC,GAAGJ,MAAM;MACrB,MAAML,CAAC,GAAGY,IAAI,CAACC,IAAI,CAACD,IAAI,CAACE,GAAG,CAACJ,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC,GAAGE,IAAI,CAACE,GAAG,CAACH,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;MAClE,MAAMI,EAAE,GAAG,CAAC,GAAGH,IAAI,CAACE,GAAG,CAACd,CAAC,EAAED,OAAO,CAACC,CAAC,CAAC;MACrC,MAAMgB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAG,IAAIV,CAAC;MAC3B,MAAMiB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAG,IAAIX,CAAC;MAC3B,MAAMkB,IAAI,GAAGN,IAAI,CAACO,KAAK,CAAC,CAACJ,EAAE,GAAGC,IAAI,GAAG,GAAG,IAAIZ,KAAK,CAAC;MAClD,MAAMgB,IAAI,GAAGR,IAAI,CAACO,KAAK,CAAC,CAACJ,EAAE,GAAGE,IAAI,GAAG,GAAG,IAAIZ,MAAM,CAAC;MACnD,MAAMgB,KAAK,GAAGnB,MAAM,CAACoB,aAAa,CAACJ,IAAI,EAAEE,IAAI,CAAC;MAE9C,IAAI,CAACG,aAAa,CAACF,KAAK,EAAEb,CAAC,EAAEC,CAAC,CAAC;IACjC,CAAC,CAAC;;IAEF;IACA,IAAI,CAACc,aAAa,CAChBrB,MAAM,CAACoB,aAAa,CAAClB,KAAK,GAAG,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,EAC3CD,KAAK,GAAG,CAAC,EACTC,MAAM,GAAG,CAAC,CACX;IAED,IAAI,IAAAmB,oBAAa,EAACvB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACwB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js b/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js
index 71ff0b9d..f50b9458 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js
@@ -1,11 +1,4 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern } from "@jimp/utils";
/**
* Creates a circle out of an image.
@@ -13,52 +6,42 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- fisheye: function fisheye() {
- var _this = this;
-
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
+export default (() => ({
+ fisheye() {
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
+ r: 2.5
+ };
+ let cb = arguments.length > 1 ? arguments[1] : undefined;
+ if (typeof options === "function") {
+ cb = options;
+ options = {
r: 2.5
};
- var cb = arguments.length > 1 ? arguments[1] : undefined;
-
- if (typeof options === 'function') {
- cb = options;
- options = {
- r: 2.5
- };
- }
-
- var source = this.cloneQuiet();
- var _source$bitmap = source.bitmap,
- width = _source$bitmap.width,
- height = _source$bitmap.height;
- source.scanQuiet(0, 0, width, height, function (x, y) {
- var hx = x / width;
- var hy = y / height;
- var r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));
- var rn = 2 * Math.pow(r, options.r);
- var cosA = (hx - 0.5) / r;
- var sinA = (hy - 0.5) / r;
- var newX = Math.round((rn * cosA + 0.5) * width);
- var newY = Math.round((rn * sinA + 0.5) * height);
- var color = source.getPixelColor(newX, newY);
-
- _this.setPixelColor(color, x, y);
- });
- /* Set center pixel color, otherwise it will be transparent */
-
- this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
}
- };
-};
-
-exports["default"] = _default;
+ const source = this.cloneQuiet();
+ const {
+ width,
+ height
+ } = source.bitmap;
+ source.scanQuiet(0, 0, width, height, (x, y) => {
+ const hx = x / width;
+ const hy = y / height;
+ const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));
+ const rn = 2 * Math.pow(r, options.r);
+ const cosA = (hx - 0.5) / r;
+ const sinA = (hy - 0.5) / r;
+ const newX = Math.round((rn * cosA + 0.5) * width);
+ const newY = Math.round((rn * sinA + 0.5) * height);
+ const color = source.getPixelColor(newX, newY);
+ this.setPixelColor(color, x, y);
+ });
+
+ /* Set center pixel color, otherwise it will be transparent */
+ this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map b/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map
index e31c3f43..19b713df 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["fisheye","options","r","cb","source","cloneQuiet","bitmap","width","height","scanQuiet","x","y","hx","hy","Math","sqrt","pow","rn","cosA","sinA","newX","round","newY","color","getPixelColor","setPixelColor","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,OADoB,qBACc;AAAA;;AAAA,UAA1BC,OAA0B,uEAAhB;AAAEC,QAAAA,CAAC,EAAE;AAAL,OAAgB;AAAA,UAAJC,EAAI;;AAChC,UAAI,OAAOF,OAAP,KAAmB,UAAvB,EAAmC;AACjCE,QAAAA,EAAE,GAAGF,OAAL;AACAA,QAAAA,OAAO,GAAG;AAAEC,UAAAA,CAAC,EAAE;AAAL,SAAV;AACD;;AAED,UAAME,MAAM,GAAG,KAAKC,UAAL,EA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AG,CAAzC,CADF,EAEED,KAAK,GAAG,CAFV,EAGEC,MAAM,GAAG,CAHX;;AAMA,UAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACuB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","fisheye","options","r","cb","source","cloneQuiet","width","height","bitmap","scanQuiet","x","y","hx","hy","Math","sqrt","pow","rn","cosA","sinA","newX","round","newY","color","getPixelColor","setPixelColor","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,OAAO,GAA2B;IAAA,IAA1BC,OAAO,uEAAG;MAAEC,CAAC,EAAE;IAAI,CAAC;IAAA,IAAEC,EAAE;IAC9B,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;MACjCE,EAAE,GAAGF,OAAO;MACZA,OAAO,GAAG;QAAEC,CAAC,EAAE;MAAI,CAAC;IACtB;IAEA,MAAME,MAAM,GAAG,IAAI,CAACC,UAAU,EAAE;IAChC,MAAM;MAAEC,KAAK;MAAEC;IAAO,CAAC,GAAGH,MAAM,CAACI,MAAM;IAEvCJ,MAAM,CAACK,SAAS,CAAC,CAAC,EAAE,CAAC,EAAEH,KAAK,EAAEC,MAAM,EAAE,CAACG,CAAC,EAAEC,CAAC,KAAK;MAC9C,MAAMC,EAAE,GAAGF,CAAC,GAAGJ,KAAK;MACpB,MAAMO,EAAE,GAAGF,CAAC,GAAGJ,MAAM;MACrB,MAAML,CAAC,GAAGY,IAAI,CAACC,IAAI,CAACD,IAAI,CAACE,GAAG,CAACJ,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC,GAAGE,IAAI,CAACE,GAAG,CAACH,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;MAClE,MAAMI,EAAE,GAAG,CAAC,GAAGH,IAAI,CAACE,GAAG,CAACd,CAAC,EAAED,OAAO,CAACC,CAAC,CAAC;MACrC,MAAMgB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAG,IAAIV,CAAC;MAC3B,MAAMiB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAG,IAAIX,CAAC;MAC3B,MAAMkB,IAAI,GAAGN,IAAI,CAACO,KAAK,CAAC,CAACJ,EAAE,GAAGC,IAAI,GAAG,GAAG,IAAIZ,KAAK,CAAC;MAClD,MAAMgB,IAAI,GAAGR,IAAI,CAACO,KAAK,CAAC,CAACJ,EAAE,GAAGE,IAAI,GAAG,GAAG,IAAIZ,MAAM,CAAC;MACnD,MAAMgB,KAAK,GAAGnB,MAAM,CAACoB,aAAa,CAACJ,IAAI,EAAEE,IAAI,CAAC;MAE9C,IAAI,CAACG,aAAa,CAACF,KAAK,EAAEb,CAAC,EAAEC,CAAC,CAAC;IACjC,CAAC,CAAC;;IAEF;IACA,IAAI,CAACc,aAAa,CAChBrB,MAAM,CAACoB,aAAa,CAAClB,KAAK,GAAG,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,EAC3CD,KAAK,GAAG,CAAC,EACTC,MAAM,GAAG,CAAC,CACX;IAED,IAAIR,aAAa,CAACI,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACuB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts b/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts
index d8140192..693b6f33 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts
@@ -1,8 +1,8 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Fisheye {
fishEye(opts?: { r: number }, cb?: ImageCallback): this;
fishEye(cb?: ImageCallback): this;
}
-export default function(): Fisheye;
+export default function (): Fisheye;
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/package.json b/project starter code/node_modules/@jimp/plugin-fisheye/package.json
index b461826e..53e8d7c8 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/package.json
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-fisheye",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Apply a fisheye effect to an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,18 +21,17 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js b/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js
index 33aeb10d..15c5b51d 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern } from '@jimp/utils';
+import { isNodePattern } from "@jimp/utils";
/**
* Creates a circle out of an image.
@@ -8,7 +8,7 @@ import { isNodePattern } from '@jimp/utils';
*/
export default () => ({
fisheye(options = { r: 2.5 }, cb) {
- if (typeof options === 'function') {
+ if (typeof options === "function") {
cb = options;
options = { r: 2.5 };
}
@@ -42,5 +42,5 @@ export default () => ({
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js b/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js
index 8c37b771..537b4f45 100644
--- a/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js
+++ b/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js
@@ -1,80 +1,78 @@
-import { Jimp, mkJGD } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, mkJGD } from "@jimp/test-utils";
+import configure from "@jimp/custom";
-import fisheye from '../src';
+import fisheye from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [fisheye] }, Jimp);
-describe('Fisheye', () => {
- it('should create fisheye lens to image', async () => {
+describe("Fisheye", () => {
+ it("should create fisheye lens to image", async () => {
const imgNormal = await jimp.read(
mkJGD(
- '0000000000',
- '0001221000',
- '0022222200',
- '0122112210',
- '0221001220',
- '0221001220',
- '0122112210',
- '0022222200',
- '0001221000',
- '0000000000'
+ "0000000000",
+ "0001221000",
+ "0022222200",
+ "0122112210",
+ "0221001220",
+ "0221001220",
+ "0122112210",
+ "0022222200",
+ "0001221000",
+ "0000000000"
)
);
const imgBulged = await jimp.read(
mkJGD(
- '0001221000',
- '0221112220',
- '0220000121',
- '1100000112',
- '2100000012',
- '2100000012',
- '1200000012',
- '0211000222',
- '0221111220',
- '0012222200'
+ "0001221000",
+ "0221112220",
+ "0220000121",
+ "1100000112",
+ "2100000012",
+ "2100000012",
+ "1200000012",
+ "0211000222",
+ "0221111220",
+ "0012222200"
)
);
- imgNormal
- .fisheye()
- .getJGDSync()
- .should.be.sameJGD(imgBulged.getJGDSync());
+ expectToBeJGD(imgNormal.fisheye().getJGDSync(), imgBulged.getJGDSync());
});
- it('should create fisheye lens to image with radius', async () => {
+ it("should create fisheye lens to image with radius", async () => {
const imgNormal = await jimp.read(
mkJGD(
- '0000000000',
- '0000000000',
- '0000000000',
- '0000000000',
- '0001111000',
- '0001111000',
- '0000000000',
- '0000000000',
- '0000000000',
- '0000000000'
+ "0000000000",
+ "0000000000",
+ "0000000000",
+ "0000000000",
+ "0001111000",
+ "0001111000",
+ "0000000000",
+ "0000000000",
+ "0000000000",
+ "0000000000"
)
);
const imgBulged = await jimp.read(
mkJGD(
- '■■■■■■■■■■',
- '■■■■■■■■■■',
- '■■■■■■■■■■',
- '■■■11111■■',
- '■■111111■■',
- '■■111111■■',
- '■■■■111■■■',
- '■■■■■■■■■■',
- '■■■■■■■■■■',
- '■■■■■■■■■■'
+ "■■■■■■■■■■",
+ "■■■■■■■■■■",
+ "■■■■■■■■■■",
+ "■■■11111■■",
+ "■■111111■■",
+ "■■111111■■",
+ "■■■■111■■■",
+ "■■■■■■■■■■",
+ "■■■■■■■■■■",
+ "■■■■■■■■■■"
)
);
- imgNormal
- .fisheye({ r: 1.8 })
- .getJGDSync()
- .should.be.sameJGD(imgBulged.getJGDSync());
+ expectToBeJGD(
+ imgNormal.fisheye({ r: 1.8 }).getJGDSync(),
+ imgBulged.getJGDSync()
+ );
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md
index 8e115c85..16844d0a 100644
--- a/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md
@@ -1,3 +1,65 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -24,7 +86,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -32,4 +94,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-flip/README.md b/project starter code/node_modules/@jimp/plugin-flip/README.md
index 4dfe3206..dd7ecaf5 100644
--- a/project starter code/node_modules/@jimp/plugin-flip/README.md
+++ b/project starter code/node_modules/@jimp/plugin-flip/README.md
@@ -16,10 +16,10 @@ Also aliased as `mirror`
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.flip();
image.mirror();
diff --git a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js b/project starter code/node_modules/@jimp/plugin-flip/dist/index.js
index 5a85279a..a300850b 100644
--- a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-flip/dist/index.js
@@ -3,10 +3,8 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Flip the image horizontally
* @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally
@@ -15,34 +13,26 @@ var _utils = require("@jimp/utils");
* @returns {Jimp} this for chaining of methods
*/
function flipFn(horizontal, vertical, cb) {
- if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') return _utils.throwError.call(this, 'horizontal and vertical must be Booleans', cb);
- var bitmap = Buffer.alloc(this.bitmap.data.length);
+ if (typeof horizontal !== "boolean" || typeof vertical !== "boolean") return _utils.throwError.call(this, "horizontal and vertical must be Booleans", cb);
+ const bitmap = Buffer.alloc(this.bitmap.data.length);
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var _x = horizontal ? this.bitmap.width - 1 - x : x;
-
- var _y = vertical ? this.bitmap.height - 1 - y : y;
-
- var _idx = this.bitmap.width * _y + _x << 2;
-
- var data = this.bitmap.data.readUInt32BE(idx);
+ const _x = horizontal ? this.bitmap.width - 1 - x : x;
+ const _y = vertical ? this.bitmap.height - 1 - y : y;
+ const _idx = this.bitmap.width * _y + _x << 2;
+ const data = this.bitmap.data.readUInt32BE(idx);
bitmap.writeUInt32BE(data, _idx);
});
this.bitmap.data = Buffer.from(bitmap);
-
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}
-
return this;
}
-
-var _default = function _default() {
- return {
- flip: flipFn,
- mirror: flipFn
- };
-};
-
-exports["default"] = _default;
+var _default = () => ({
+ flip: flipFn,
+ mirror: flipFn
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map
index bf47a102..515011d6 100644
--- a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","flip","mirror"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;AAOA,SAASA,MAAT,CAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,EAAtC,EAA0C;AACxC,MAAI,OAAOF,UAAP,KAAsB,SAAtB,IAAmC,OAAOC,QAAP,KAAoB,SAA3D,EACE,OAAOE,kBAAWC,IAAX,CACL,IADK,EAEL,0CAFK,EAGLF,EAHK,CAAP;AAMF,MAAMG,MAAM,GAAGC,MAAM,CAACC,KAAP,CAAa,KAAKF,MAAL,CAAYG,IAAZ,CAAiBC,MAA9B,CAAf;AACA,OAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKL,MAAL,CAAYM,KAAjC,EAAwC,KAAKN,MAAL,CAAYO,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,QAAMC,EAAE,GAAGhB,UAAU,GAAG,KAAKK,MAAL,CAAYM,KAAZ,GAAoB,CAApB,GAAwBE,CAA3B,GAA+BA,CAApD;;AACA,QAAMI,EAAE,GAAGhB,QAAQ,GAAG,KAAKI,MAAL,CAAYO,MAAZ,GAAqB,CAArB,GAAyBE,CAA5B,GAAgCA,CAAnD;;AACA,QAAMI,IAAI,GAAI,KAAKb,MAAL,CAAYM,KAAZ,GAAoBM,EAApB,GAAyBD,EAA1B,IAAiC,CAA9C;;AACA,QAAMR,IAAI,GAAG,KAAKH,MAAL,CAAYG,IAAZ,CAAiBW,YAAjB,CAA8BJ,GAA9B,CAAb;AAEAV,IAAAA,MAAM,CAACe,aAAP,CAAqBZ,IAArB,EAA2BU,IAA3B;AACD,GAXD;AAaA,OAAKb,MAAL,CAAYG,IAAZ,GAAmBF,MAAM,CAACe,IAAP,CAAYhB,MAAZ,CAAnB;;AAEA,MAAI,0BAAcH,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBkB,IAAAA,IAAI,EAAEvB,MADc;AAEpBwB,IAAAA,MAAM,EAAExB;AAFY,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean')\n return throwError.call(\n this,\n 'horizontal and vertical must be Booleans',\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n });\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","isNodePattern","flip","mirror"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== \"boolean\" || typeof vertical !== \"boolean\")\n return throwError.call(\n this,\n \"horizontal and vertical must be Booleans\",\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n }\n );\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn,\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,CAACC,UAAU,EAAEC,QAAQ,EAAEC,EAAE,EAAE;EACxC,IAAI,OAAOF,UAAU,KAAK,SAAS,IAAI,OAAOC,QAAQ,KAAK,SAAS,EAClE,OAAOE,iBAAU,CAACC,IAAI,CACpB,IAAI,EACJ,0CAA0C,EAC1CF,EAAE,CACH;EAEH,MAAMG,MAAM,GAAGC,MAAM,CAACC,KAAK,CAAC,IAAI,CAACF,MAAM,CAACG,IAAI,CAACC,MAAM,CAAC;EACpD,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACL,MAAM,CAACM,KAAK,EACjB,IAAI,CAACN,MAAM,CAACO,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;IACnB,MAAMC,EAAE,GAAGhB,UAAU,GAAG,IAAI,CAACK,MAAM,CAACM,KAAK,GAAG,CAAC,GAAGE,CAAC,GAAGA,CAAC;IACrD,MAAMI,EAAE,GAAGhB,QAAQ,GAAG,IAAI,CAACI,MAAM,CAACO,MAAM,GAAG,CAAC,GAAGE,CAAC,GAAGA,CAAC;IACpD,MAAMI,IAAI,GAAI,IAAI,CAACb,MAAM,CAACM,KAAK,GAAGM,EAAE,GAAGD,EAAE,IAAK,CAAC;IAC/C,MAAMR,IAAI,GAAG,IAAI,CAACH,MAAM,CAACG,IAAI,CAACW,YAAY,CAACJ,GAAG,CAAC;IAE/CV,MAAM,CAACe,aAAa,CAACZ,IAAI,EAAEU,IAAI,CAAC;EAClC,CAAC,CACF;EAED,IAAI,CAACb,MAAM,CAACG,IAAI,GAAGF,MAAM,CAACe,IAAI,CAAChB,MAAM,CAAC;EAEtC,IAAI,IAAAiB,oBAAa,EAACpB,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb;AAAC,eAEc,OAAO;EACpBmB,IAAI,EAAExB,MAAM;EACZyB,MAAM,EAAEzB;AACV,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js b/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js
new file mode 100644
index 00000000..685a13f9
--- /dev/null
+++ b/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js
@@ -0,0 +1,25 @@
+import { Jimp, mkJGD } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import flip from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
+const jimp = configure({
+ plugins: [flip]
+}, Jimp);
+describe("Flipping plugin", () => {
+ it("can flip horizontally", async () => {
+ const src = await jimp.read(mkJGD("AAAABBBB", "AAABAAAB", "ABABABAB", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA"));
+ const result = src.flip(true, false);
+ expectToBeJGD(result.getJGDSync(), mkJGD("BBBBAAAA", "BAAABAAA", "BABABABA", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA"));
+ });
+ it("can flip vertically", async () => {
+ const src = await jimp.read(mkJGD("AAAABBBB", "AAABAAAB", "ABABABAB", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA"));
+ const result = src.flip(false, true);
+ expectToBeJGD(result.getJGDSync(), mkJGD("AACCCCAA", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "ABABABAB", "AAABAAAB", "AAAABBBB"));
+ });
+ it("can flip both horizontally and vertically at once", async () => {
+ const src = await jimp.read(mkJGD("AAAABBBB", "AAABAAAB", "ABABABAB", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA"));
+ const result = src.flip(true, true);
+ expectToBeJGD(result.getJGDSync(), mkJGD("AACCCCAA", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "BABABABA", "BAAABAAA", "BBBBAAAA"));
+ });
+});
+//# sourceMappingURL=flipping.test.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js.map b/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js.map
new file mode 100644
index 00000000..e38c9f54
--- /dev/null
+++ b/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"flipping.test.js","names":["Jimp","mkJGD","configure","flip","expectToBeJGD","jimp","plugins","describe","it","src","read","result","getJGDSync"],"sources":["../test/flipping.test.js"],"sourcesContent":["import { Jimp, mkJGD } from \"@jimp/test-utils\";\n\nimport configure from \"@jimp/custom\";\n\nimport flip from \"../src\";\nimport { expectToBeJGD } from \"@jimp/test-utils/src\";\n\nconst jimp = configure({ plugins: [flip] }, Jimp);\n\ndescribe(\"Flipping plugin\", () => {\n it(\"can flip horizontally\", async () => {\n const src = await jimp.read(\n mkJGD(\n \"AAAABBBB\",\n \"AAABAAAB\",\n \"ABABABAB\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"AACCCCAA\"\n )\n );\n\n const result = src.flip(true, false);\n\n expectToBeJGD(\n result.getJGDSync(),\n mkJGD(\n \"BBBBAAAA\",\n \"BAAABAAA\",\n \"BABABABA\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"AACCCCAA\"\n )\n );\n });\n\n it(\"can flip vertically\", async () => {\n const src = await jimp.read(\n mkJGD(\n \"AAAABBBB\",\n \"AAABAAAB\",\n \"ABABABAB\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"AACCCCAA\"\n )\n );\n\n const result = src.flip(false, true);\n\n expectToBeJGD(\n result.getJGDSync(),\n mkJGD(\n \"AACCCCAA\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"ABABABAB\",\n \"AAABAAAB\",\n \"AAAABBBB\"\n )\n );\n });\n\n it(\"can flip both horizontally and vertically at once\", async () => {\n const src = await jimp.read(\n mkJGD(\n \"AAAABBBB\",\n \"AAABAAAB\",\n \"ABABABAB\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"AACCCCAA\"\n )\n );\n\n const result = src.flip(true, true);\n\n expectToBeJGD(\n result.getJGDSync(),\n mkJGD(\n \"AACCCCAA\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"BABABABA\",\n \"BAAABAAA\",\n \"BBBBAAAA\"\n )\n );\n });\n});\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,KAAK,QAAQ,kBAAkB;AAE9C,OAAOC,SAAS,MAAM,cAAc;AAEpC,OAAOC,IAAI,MAAM,QAAQ;AACzB,SAASC,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G,CAACN,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;IAEnCC,aAAa,CACXO,MAAM,CAACC,UAAU,EAAE,EACnBX,KAAK,CACH,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,CACX,CACF;EACH,CAAC,CAAC;AACJ,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-flip/es/index.js b/project starter code/node_modules/@jimp/plugin-flip/es/index.js
index 241787ff..64931680 100644
--- a/project starter code/node_modules/@jimp/plugin-flip/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-flip/es/index.js
@@ -1,11 +1,4 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Flip the image horizontally
@@ -15,33 +8,23 @@ var _utils = require("@jimp/utils");
* @returns {Jimp} this for chaining of methods
*/
function flipFn(horizontal, vertical, cb) {
- if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') return _utils.throwError.call(this, 'horizontal and vertical must be Booleans', cb);
- var bitmap = Buffer.alloc(this.bitmap.data.length);
+ if (typeof horizontal !== "boolean" || typeof vertical !== "boolean") return throwError.call(this, "horizontal and vertical must be Booleans", cb);
+ const bitmap = Buffer.alloc(this.bitmap.data.length);
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var _x = horizontal ? this.bitmap.width - 1 - x : x;
-
- var _y = vertical ? this.bitmap.height - 1 - y : y;
-
- var _idx = this.bitmap.width * _y + _x << 2;
-
- var data = this.bitmap.data.readUInt32BE(idx);
+ const _x = horizontal ? this.bitmap.width - 1 - x : x;
+ const _y = vertical ? this.bitmap.height - 1 - y : y;
+ const _idx = this.bitmap.width * _y + _x << 2;
+ const data = this.bitmap.data.readUInt32BE(idx);
bitmap.writeUInt32BE(data, _idx);
});
this.bitmap.data = Buffer.from(bitmap);
-
- if ((0, _utils.isNodePattern)(cb)) {
+ if (isNodePattern(cb)) {
cb.call(this, null, this);
}
-
return this;
}
-
-var _default = function _default() {
- return {
- flip: flipFn,
- mirror: flipFn
- };
-};
-
-exports["default"] = _default;
+export default (() => ({
+ flip: flipFn,
+ mirror: flipFn
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map b/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map
index bf47a102..c8499213 100644
--- a/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","flip","mirror"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;AAOA,SAASA,MAAT,CAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,EAAtC,EAA0C;AACxC,MAAI,OAAOF,UAAP,KAAsB,SAAtB,IAAmC,OAAOC,QAAP,KAAoB,SAA3D,EACE,OAAOE,kBAAWC,IAAX,CACL,IADK,EAEL,0CAFK,EAGLF,EAHK,CAAP;AAMF,MAAMG,MAAM,GAAGC,MAAM,CAACC,KAAP,CAAa,KAAKF,MAAL,CAAYG,IAAZ,CAAiBC,MAA9B,CAAf;AACA,OAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKL,MAAL,CAAYM,KAAjC,EAAwC,KAAKN,MAAL,CAAYO,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,QAAMC,EAAE,GAAGhB,UAAU,GAAG,KAAKK,MAAL,CAAYM,KAAZ,GAAoB,CAApB,GAAwBE,CAA3B,GAA+BA,CAApD;;AACA,QAAMI,EAAE,GAAGhB,QAAQ,GAAG,KAAKI,MAAL,CAAYO,MAAZ,GAAqB,CAArB,GAAyBE,CAA5B,GAAgCA,CAAnD;;AACA,QAAMI,IAAI,GAAI,KAAKb,MAAL,CAAYM,KAAZ,GAAoBM,EAApB,GAAyBD,EAA1B,IAAiC,CAA9C;;AACA,QAAMR,IAAI,GAAG,KAAKH,MAAL,CAAYG,IAAZ,CAAiBW,YAAjB,CAA8BJ,GAA9B,CAAb;AAEAV,IAAAA,MAAM,CAACe,aAAP,CAAqBZ,IAArB,EAA2BU,IAA3B;AACD,GAXD;AAaA,OAAKb,MAAL,CAAYG,IAAZ,GAAmBF,MAAM,CAACe,IAAP,CAAYhB,MAAZ,CAAnB;;AAEA,MAAI,0BAAcH,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBkB,IAAAA,IAAI,EAAEvB,MADc;AAEpBwB,IAAAA,MAAM,EAAExB;AAFY,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean')\n return throwError.call(\n this,\n 'horizontal and vertical must be Booleans',\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n });\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","throwError","flipFn","horizontal","vertical","cb","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","flip","mirror"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== \"boolean\" || typeof vertical !== \"boolean\")\n return throwError.call(\n this,\n \"horizontal and vertical must be Booleans\",\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n }\n );\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn,\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,MAAM,CAACC,UAAU,EAAEC,QAAQ,EAAEC,EAAE,EAAE;EACxC,IAAI,OAAOF,UAAU,KAAK,SAAS,IAAI,OAAOC,QAAQ,KAAK,SAAS,EAClE,OAAOH,UAAU,CAACK,IAAI,CACpB,IAAI,EACJ,0CAA0C,EAC1CD,EAAE,CACH;EAEH,MAAME,MAAM,GAAGC,MAAM,CAACC,KAAK,CAAC,IAAI,CAACF,MAAM,CAACG,IAAI,CAACC,MAAM,CAAC;EACpD,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACL,MAAM,CAACM,KAAK,EACjB,IAAI,CAACN,MAAM,CAACO,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;IACnB,MAAMC,EAAE,GAAGf,UAAU,GAAG,IAAI,CAACI,MAAM,CAACM,KAAK,GAAG,CAAC,GAAGE,CAAC,GAAGA,CAAC;IACrD,MAAMI,EAAE,GAAGf,QAAQ,GAAG,IAAI,CAACG,MAAM,CAACO,MAAM,GAAG,CAAC,GAAGE,CAAC,GAAGA,CAAC;IACpD,MAAMI,IAAI,GAAI,IAAI,CAACb,MAAM,CAACM,KAAK,GAAGM,EAAE,GAAGD,EAAE,IAAK,CAAC;IAC/C,MAAMR,IAAI,GAAG,IAAI,CAACH,MAAM,CAACG,IAAI,CAACW,YAAY,CAACJ,GAAG,CAAC;IAE/CV,MAAM,CAACe,aAAa,CAACZ,IAAI,EAAEU,IAAI,CAAC;EAClC,CAAC,CACF;EAED,IAAI,CAACb,MAAM,CAACG,IAAI,GAAGF,MAAM,CAACe,IAAI,CAAChB,MAAM,CAAC;EAEtC,IAAIP,aAAa,CAACK,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb;AAEA,gBAAe,OAAO;EACpBkB,IAAI,EAAEtB,MAAM;EACZuB,MAAM,EAAEvB;AACV,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-flip/index.d.ts b/project starter code/node_modules/@jimp/plugin-flip/index.d.ts
index 17b107d4..3f1efd66 100644
--- a/project starter code/node_modules/@jimp/plugin-flip/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-flip/index.d.ts
@@ -1,8 +1,12 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Flip {
flip(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this;
- mirror(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this;
+ mirror(
+ horizontal: boolean,
+ vertical: boolean,
+ cb?: ImageCallback
+ ): this;
}
-export default function(): Flip;
+export default function (): Flip;
diff --git a/project starter code/node_modules/@jimp/plugin-flip/package.json b/project starter code/node_modules/@jimp/plugin-flip/package.json
index 9285c679..21e4c468 100644
--- a/project starter code/node_modules/@jimp/plugin-flip/package.json
+++ b/project starter code/node_modules/@jimp/plugin-flip/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-flip",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "flip an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "build": "npm run build:node:production && npm run build:module",
+ "build": "npm run build:node:production && npm run build:module --recursive test",
"build:watch": "npm run build:node:debug -- -- --watch --verbose",
"build:debug": "npm run build:node:debug",
"build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js",
@@ -17,8 +18,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -27,5 +27,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-flip/src/index.js b/project starter code/node_modules/@jimp/plugin-flip/src/index.js
index 212fb848..01064ac1 100644
--- a/project starter code/node_modules/@jimp/plugin-flip/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-flip/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern, throwError } from '@jimp/utils';
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Flip the image horizontally
@@ -8,26 +8,28 @@ import { isNodePattern, throwError } from '@jimp/utils';
* @returns {Jimp} this for chaining of methods
*/
function flipFn(horizontal, vertical, cb) {
- if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean')
+ if (typeof horizontal !== "boolean" || typeof vertical !== "boolean")
return throwError.call(
this,
- 'horizontal and vertical must be Booleans',
+ "horizontal and vertical must be Booleans",
cb
);
const bitmap = Buffer.alloc(this.bitmap.data.length);
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- const _x = horizontal ? this.bitmap.width - 1 - x : x;
- const _y = vertical ? this.bitmap.height - 1 - y : y;
- const _idx = (this.bitmap.width * _y + _x) << 2;
- const data = this.bitmap.data.readUInt32BE(idx);
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ const _x = horizontal ? this.bitmap.width - 1 - x : x;
+ const _y = vertical ? this.bitmap.height - 1 - y : y;
+ const _idx = (this.bitmap.width * _y + _x) << 2;
+ const data = this.bitmap.data.readUInt32BE(idx);
- bitmap.writeUInt32BE(data, _idx);
- });
+ bitmap.writeUInt32BE(data, _idx);
+ }
+ );
this.bitmap.data = Buffer.from(bitmap);
@@ -40,5 +42,5 @@ function flipFn(horizontal, vertical, cb) {
export default () => ({
flip: flipFn,
- mirror: flipFn
+ mirror: flipFn,
});
diff --git a/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js b/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js
index de9a1e49..6866acf6 100644
--- a/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js
+++ b/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js
@@ -1,99 +1,97 @@
-import { Jimp, mkJGD } from '@jimp/test-utils';
+import { Jimp, mkJGD } from "@jimp/test-utils";
-import configure from '@jimp/custom';
+import configure from "@jimp/custom";
-import flip from '../src';
+import flip from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [flip] }, Jimp);
-describe('Flipping plugin', () => {
- it('can flip horizontally', async () => {
+describe("Flipping plugin", () => {
+ it("can flip horizontally", async () => {
const src = await jimp.read(
mkJGD(
- 'AAAABBBB',
- 'AAABAAAB',
- 'ABABABAB',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'AACCCCAA'
+ "AAAABBBB",
+ "AAABAAAB",
+ "ABABABAB",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "AACCCCAA"
)
);
const result = src.flip(true, false);
- result
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- 'BBBBAAAA',
- 'BAAABAAA',
- 'BABABABA',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'AACCCCAA'
- )
- );
+ expectToBeJGD(
+ result.getJGDSync(),
+ mkJGD(
+ "BBBBAAAA",
+ "BAAABAAA",
+ "BABABABA",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "AACCCCAA"
+ )
+ );
});
- it('can flip vertically', async () => {
+ it("can flip vertically", async () => {
const src = await jimp.read(
mkJGD(
- 'AAAABBBB',
- 'AAABAAAB',
- 'ABABABAB',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'AACCCCAA'
+ "AAAABBBB",
+ "AAABAAAB",
+ "ABABABAB",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "AACCCCAA"
)
);
const result = src.flip(false, true);
- result
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- 'AACCCCAA',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'ABABABAB',
- 'AAABAAAB',
- 'AAAABBBB'
- )
- );
+ expectToBeJGD(
+ result.getJGDSync(),
+ mkJGD(
+ "AACCCCAA",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "ABABABAB",
+ "AAABAAAB",
+ "AAAABBBB"
+ )
+ );
});
- it('can flip both horizontally and vertically at once', async () => {
+ it("can flip both horizontally and vertically at once", async () => {
const src = await jimp.read(
mkJGD(
- 'AAAABBBB',
- 'AAABAAAB',
- 'ABABABAB',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'AACCCCAA'
+ "AAAABBBB",
+ "AAABAAAB",
+ "ABABABAB",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "AACCCCAA"
)
);
const result = src.flip(true, true);
- result
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- 'AACCCCAA',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'CCCCCCCC',
- 'BABABABA',
- 'BAAABAAA',
- 'BBBBAAAA'
- )
- );
+ expectToBeJGD(
+ result.getJGDSync(),
+ mkJGD(
+ "AACCCCAA",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "CCCCCCCC",
+ "BABABABA",
+ "BAAABAAA",
+ "BBBBAAAA"
+ )
+ );
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md
index 26394e0f..8d029143 100644
--- a/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md
@@ -1,3 +1,51 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +60,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +68,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/README.md b/project starter code/node_modules/@jimp/plugin-gaussian/README.md
index 116ea741..0f15ca98 100644
--- a/project starter code/node_modules/@jimp/plugin-gaussian/README.md
+++ b/project starter code/node_modules/@jimp/plugin-gaussian/README.md
@@ -13,10 +13,10 @@ Applies a true Gaussian blur to the image (warning: this is VERY slow)
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.gaussian(15);
}
diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js b/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js
index 9502e1f9..3b70a82f 100644
--- a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js
@@ -3,85 +3,69 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Applies a true Gaussian blur to the image (warning: this is VERY slow)
* @param {number} r the pixel radius of the blur
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- gaussian: function gaussian(r, cb) {
- // http://blog.ivank.net/fastest-gaussian-blur.html
- if (typeof r !== 'number') {
- return _utils.throwError.call(this, 'r must be a number', cb);
- }
-
- if (r < 1) {
- return _utils.throwError.call(this, 'r must be greater than 0', cb);
- }
-
- var rs = Math.ceil(r * 2.57); // significant radius
-
- var range = rs * 2 + 1;
- var rr2 = r * r * 2;
- var rr2pi = rr2 * Math.PI;
- var weights = [];
-
- for (var y = 0; y < range; y++) {
- weights[y] = [];
-
- for (var x = 0; x < range; x++) {
- var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2);
- weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;
- }
+var _default = () => ({
+ gaussian(r, cb) {
+ // http://blog.ivank.net/fastest-gaussian-blur.html
+ if (typeof r !== "number") {
+ return _utils.throwError.call(this, "r must be a number", cb);
+ }
+ if (r < 1) {
+ return _utils.throwError.call(this, "r must be greater than 0", cb);
+ }
+ const rs = Math.ceil(r * 2.57); // significant radius
+ const range = rs * 2 + 1;
+ const rr2 = r * r * 2;
+ const rr2pi = rr2 * Math.PI;
+ const weights = [];
+ for (let y = 0; y < range; y++) {
+ weights[y] = [];
+ for (let x = 0; x < range; x++) {
+ const dsq = (x - rs) ** 2 + (y - rs) ** 2;
+ weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;
}
-
- for (var _y = 0; _y < this.bitmap.height; _y++) {
- for (var _x = 0; _x < this.bitmap.width; _x++) {
- var red = 0;
- var green = 0;
- var blue = 0;
- var alpha = 0;
- var wsum = 0;
-
- for (var iy = 0; iy < range; iy++) {
- for (var ix = 0; ix < range; ix++) {
- var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs));
- var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs));
- var weight = weights[iy][ix];
-
- var _idx = y1 * this.bitmap.width + x1 << 2;
-
- red += this.bitmap.data[_idx] * weight;
- green += this.bitmap.data[_idx + 1] * weight;
- blue += this.bitmap.data[_idx + 2] * weight;
- alpha += this.bitmap.data[_idx + 3] * weight;
- wsum += weight;
- }
-
- var idx = _y * this.bitmap.width + _x << 2;
- this.bitmap.data[idx] = Math.round(red / wsum);
- this.bitmap.data[idx + 1] = Math.round(green / wsum);
- this.bitmap.data[idx + 2] = Math.round(blue / wsum);
- this.bitmap.data[idx + 3] = Math.round(alpha / wsum);
+ }
+ for (let y = 0; y < this.bitmap.height; y++) {
+ for (let x = 0; x < this.bitmap.width; x++) {
+ let red = 0;
+ let green = 0;
+ let blue = 0;
+ let alpha = 0;
+ let wsum = 0;
+ for (let iy = 0; iy < range; iy++) {
+ for (let ix = 0; ix < range; ix++) {
+ const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs));
+ const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));
+ const weight = weights[iy][ix];
+ const idx = y1 * this.bitmap.width + x1 << 2;
+ red += this.bitmap.data[idx] * weight;
+ green += this.bitmap.data[idx + 1] * weight;
+ blue += this.bitmap.data[idx + 2] * weight;
+ alpha += this.bitmap.data[idx + 3] * weight;
+ wsum += weight;
}
+ const idx = y * this.bitmap.width + x << 2;
+ this.bitmap.data[idx] = Math.round(red / wsum);
+ this.bitmap.data[idx + 1] = Math.round(green / wsum);
+ this.bitmap.data[idx + 2] = Math.round(blue / wsum);
+ this.bitmap.data[idx + 3] = Math.round(alpha / wsum);
}
}
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
}
- };
-};
-
-exports["default"] = _default;
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map
index 95add697..2121d1ad 100644
--- a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["gaussian","r","cb","throwError","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix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G,CAAvB,IAA4BD,MAArC;AACAT,cAAAA,IAAI,IAAI,KAAKL,MAAL,CAAYgB,IAAZ,CAAiBD,IAAG,GAAG,CAAvB,IAA4BD,MAApC;AACAR,cAAAA,KAAK,IAAI,KAAKN,MAAL,CAAYgB,IAAZ,CAAiBD,IAAG,GAAG,CAAvB,IAA4BD,MAArC;AACAP,cAAAA,IAAI,IAAIO,MAAR;AACD;;AAED,gBAAMC,GAAG,GAAInB,EAAC,GAAG,KAAKI,MAAL,CAAYE,KAAhB,GAAwBL,EAAzB,IAA+B,CAA3C;AAEA,iBAAKG,MAAL,CAAYgB,IAAZ,CAAiBD,GAAjB,IAAwB1B,IAAI,CAAC4B,KAAL,CAAWd,GAAG,GAAGI,IAAjB,CAAxB;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWb,KAAK,GAAGG,IAAnB,CAA5B;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWZ,IAAI,GAAGE,IAAlB,CAA5B;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWX,KAAK,GAAGC,IAAnB,CAA5B;AACD;AACF;AACF;;AAED,UAAI,0BAActB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA/DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== 'number') {\n return throwError.call(this, 'r must be a number', cb);\n }\n\n if (r < 1) {\n return throwError.call(this, 'r must be greater than 0', cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2 ;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs ));\n const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["gaussian","r","cb","throwError","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== \"number\") {\n return throwError.call(this, \"r must be a number\", cb);\n }\n\n if (r < 1) {\n return throwError.call(this, \"r must be greater than 0\", cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(\n this.bitmap.width - 1,\n Math.max(0, ix + x - rs)\n );\n const y1 = Math.min(\n this.bitmap.height - 1,\n Math.max(0, iy + y - rs)\n );\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\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AAM;YAC3CT,IAAI,IAAI,IAAI,CAACL,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAGD,MAAM;YAC1CR,KAAK,IAAI,IAAI,CAACN,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAGD,MAAM;YAC3CP,IAAI,IAAIO,MAAM;UAChB;UAEA,MAAMC,GAAG,GAAInB,CAAC,GAAG,IAAI,CAACI,MAAM,CAACE,KAAK,GAAGL,CAAC,IAAK,CAAC;UAE5C,IAAI,CAACG,MAAM,CAACgB,IAAI,CAACD,GAAG,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACd,GAAG,GAAGI,IAAI,CAAC;UAC9C,IAAI,CAACP,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACb,KAAK,GAAGG,IAAI,CAAC;UACpD,IAAI,CAACP,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACZ,IAAI,GAAGE,IAAI,CAAC;UACnD,IAAI,CAACP,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACX,KAAK,GAAGC,IAAI,CAAC;QACtD;MACF;IACF;IAEA,IAAI,IAAAW,oBAAa,EAACjC,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js b/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js
index f18ae1e1..06ea20c5 100644
--- a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js
@@ -1,11 +1,4 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Applies a true Gaussian blur to the image (warning: this is VERY slow)
@@ -13,74 +6,58 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- gaussian: function gaussian(r, cb) {
- // http://blog.ivank.net/fastest-gaussian-blur.html
- if (typeof r !== 'number') {
- return _utils.throwError.call(this, 'r must be a number', cb);
- }
-
- if (r < 1) {
- return _utils.throwError.call(this, 'r must be greater than 0', cb);
- }
-
- var rs = Math.ceil(r * 2.57); // significant radius
-
- var range = rs * 2 + 1;
- var rr2 = r * r * 2;
- var rr2pi = rr2 * Math.PI;
- var weights = [];
-
- for (var y = 0; y < range; y++) {
- weights[y] = [];
-
- for (var x = 0; x < range; x++) {
- var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2);
- weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;
- }
+export default (() => ({
+ gaussian(r, cb) {
+ // http://blog.ivank.net/fastest-gaussian-blur.html
+ if (typeof r !== "number") {
+ return throwError.call(this, "r must be a number", cb);
+ }
+ if (r < 1) {
+ return throwError.call(this, "r must be greater than 0", cb);
+ }
+ const rs = Math.ceil(r * 2.57); // significant radius
+ const range = rs * 2 + 1;
+ const rr2 = r * r * 2;
+ const rr2pi = rr2 * Math.PI;
+ const weights = [];
+ for (let y = 0; y < range; y++) {
+ weights[y] = [];
+ for (let x = 0; x < range; x++) {
+ const dsq = (x - rs) ** 2 + (y - rs) ** 2;
+ weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;
}
-
- for (var _y = 0; _y < this.bitmap.height; _y++) {
- for (var _x = 0; _x < this.bitmap.width; _x++) {
- var red = 0;
- var green = 0;
- var blue = 0;
- var alpha = 0;
- var wsum = 0;
-
- for (var iy = 0; iy < range; iy++) {
- for (var ix = 0; ix < range; ix++) {
- var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs));
- var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs));
- var weight = weights[iy][ix];
-
- var _idx = y1 * this.bitmap.width + x1 << 2;
-
- red += this.bitmap.data[_idx] * weight;
- green += this.bitmap.data[_idx + 1] * weight;
- blue += this.bitmap.data[_idx + 2] * weight;
- alpha += this.bitmap.data[_idx + 3] * weight;
- wsum += weight;
- }
-
- var idx = _y * this.bitmap.width + _x << 2;
- this.bitmap.data[idx] = Math.round(red / wsum);
- this.bitmap.data[idx + 1] = Math.round(green / wsum);
- this.bitmap.data[idx + 2] = Math.round(blue / wsum);
- this.bitmap.data[idx + 3] = Math.round(alpha / wsum);
+ }
+ for (let y = 0; y < this.bitmap.height; y++) {
+ for (let x = 0; x < this.bitmap.width; x++) {
+ let red = 0;
+ let green = 0;
+ let blue = 0;
+ let alpha = 0;
+ let wsum = 0;
+ for (let iy = 0; iy < range; iy++) {
+ for (let ix = 0; ix < range; ix++) {
+ const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs));
+ const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));
+ const weight = weights[iy][ix];
+ const idx = y1 * this.bitmap.width + x1 << 2;
+ red += this.bitmap.data[idx] * weight;
+ green += this.bitmap.data[idx + 1] * weight;
+ blue += this.bitmap.data[idx + 2] * weight;
+ alpha += this.bitmap.data[idx + 3] * weight;
+ wsum += weight;
}
+ const idx = y * this.bitmap.width + x << 2;
+ this.bitmap.data[idx] = Math.round(red / wsum);
+ this.bitmap.data[idx + 1] = Math.round(green / wsum);
+ this.bitmap.data[idx + 2] = Math.round(blue / wsum);
+ this.bitmap.data[idx + 3] = Math.round(alpha / wsum);
}
}
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
}
- };
-};
-
-exports["default"] = _default;
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map b/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map
index 95add697..00b7b0f8 100644
--- a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["gaussian","r","cb","throwError","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,CADW,EACRC,EADQ,EACJ;AACd;AACA,UAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,UAAID,CAAC,GAAG,CAAR,EAAW;AACT,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,0BAAtB,EAAkDF,EAAlD,CAAP;AACD;;AAED,UAAMG,EAAE,GAAGC,IAAI,CAACC,IAAL,CAAUN,CAAC,GAAG,IAAd,CAAX,CAVc,CAUkB;;AAChC,UAAMO,KAAK,GAAGH,EAAE,GAAG,CAAL,GAAS,CAAvB;AACA,UAAMI,GAAG,GAAGR,CAAC,GAAGA,CAAJ,GAAQ,CAApB;AACA,UAAMS,KAAK,GAAGD,GAAG,GAAGH,IAAI,CAACK,EAAzB;AAEA,UAAMC,OAAO,GAAG,EAAhB;;AAEA,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,KAApB,EAA2BK,CAAC,EAA5B,EAAgC;AAC9BD,QAAAA,OAAO,CAACC,CAAD,CAAP,GAAa,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AWX,KAAK,GAAGC,IAAnB,CAA5B;AACD;AACF;AACF;;AAED,UAAI,0BAActB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA/DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== 'number') {\n return throwError.call(this, 'r must be a number', cb);\n }\n\n if (r < 1) {\n return throwError.call(this, 'r must be greater than 0', cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2 ;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs ));\n const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","throwError","gaussian","r","cb","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== \"number\") {\n return throwError.call(this, \"r must be a number\", cb);\n }\n\n if (r < 1) {\n return throwError.call(this, \"r must be greater than 0\", cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(\n this.bitmap.width - 1,\n Math.max(0, ix + x - rs)\n );\n const y1 = Math.min(\n this.bitmap.height - 1,\n Math.max(0, iy + y - rs)\n );\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,QAAQ,CAACC,CAAC,EAAEC,EAAE,EAAE;IACd;IACA,IAAI,OAAOD,CAAC,KAAK,QAAQ,EAAE;MACzB,OAAOF,UAAU,CAACI,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAED,EAAE,CAAC;IACxD;IAEA,IAAID,CAAC,GAAG,CAAC,EAAE;MACT,OAAOF,UAAU,CAACI,IAAI,CAAC,IAAI,EAAE,0BAA0B,EAAED,EAAE,CAAC;IAC9D;IAEA,MAAME,EAAE,GAAGC,IAAI,CAACC,IAAI,CAACL,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAChC,MAAMM,KAAK,GAAGH,EAAE,GAAG,CAAC,GAAG,CAAC;IACxB,MAAMI,GAAG,GAAGP,CAAC,GAAGA,CAAC,GAAG,CAAC;IACrB,MAAMQ,KAAK,GAAGD,GAAG,GAAGH,IAAI,CAACK,EAAE;IAE3B,MAAMC,OAAO,GAAG,EAAE;IAElB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,KAAK,EAAE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AAK,CAACX,KAAK,GAAGC,IAAI,CAAC;QACtD;MACF;IACF;IAEA,IAAIzB,aAAa,CAACI,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts b/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts
index 7f415775..4f9114c9 100644
--- a/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts
@@ -1,7 +1,7 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Gaussian {
gaussian(r: number, cb?: ImageCallback): this;
}
-export default function(): Gaussian;
+export default function (): Gaussian;
diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/package.json b/project starter code/node_modules/@jimp/plugin-gaussian/package.json
index f73fdcf8..507fb389 100644
--- a/project starter code/node_modules/@jimp/plugin-gaussian/package.json
+++ b/project starter code/node_modules/@jimp/plugin-gaussian/package.json
@@ -1,9 +1,10 @@
{
"name": "@jimp/plugin-gaussian",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "gaussian blur an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
"build": "npm run build:node:production && npm run build:module",
@@ -17,8 +18,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
@@ -26,5 +26,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js b/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js
index 2a7c25df..21528cb6 100644
--- a/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern, throwError } from '@jimp/utils';
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Applies a true Gaussian blur to the image (warning: this is VERY slow)
@@ -9,12 +9,12 @@ import { isNodePattern, throwError } from '@jimp/utils';
export default () => ({
gaussian(r, cb) {
// http://blog.ivank.net/fastest-gaussian-blur.html
- if (typeof r !== 'number') {
- return throwError.call(this, 'r must be a number', cb);
+ if (typeof r !== "number") {
+ return throwError.call(this, "r must be a number", cb);
}
if (r < 1) {
- return throwError.call(this, 'r must be greater than 0', cb);
+ return throwError.call(this, "r must be greater than 0", cb);
}
const rs = Math.ceil(r * 2.57); // significant radius
@@ -27,7 +27,7 @@ export default () => ({
for (let y = 0; y < range; y++) {
weights[y] = [];
for (let x = 0; x < range; x++) {
- const dsq = (x - rs) ** 2 + (y - rs) ** 2 ;
+ const dsq = (x - rs) ** 2 + (y - rs) ** 2;
weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;
}
}
@@ -42,8 +42,14 @@ export default () => ({
for (let iy = 0; iy < range; iy++) {
for (let ix = 0; ix < range; ix++) {
- const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs ));
- const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));
+ const x1 = Math.min(
+ this.bitmap.width - 1,
+ Math.max(0, ix + x - rs)
+ );
+ const y1 = Math.min(
+ this.bitmap.height - 1,
+ Math.max(0, iy + y - rs)
+ );
const weight = weights[iy][ix];
const idx = (y1 * this.bitmap.width + x1) << 2;
@@ -69,5 +75,5 @@ export default () => ({
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md
index 26394e0f..8d029143 100644
--- a/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md
@@ -1,3 +1,51 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +60,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +68,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-invert/README.md b/project starter code/node_modules/@jimp/plugin-invert/README.md
index 51585dec..e201f584 100644
--- a/project starter code/node_modules/@jimp/plugin-invert/README.md
+++ b/project starter code/node_modules/@jimp/plugin-invert/README.md
@@ -12,10 +12,10 @@ Invert an image's colors.
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.invert();
}
diff --git a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js b/project starter code/node_modules/@jimp/plugin-invert/dist/index.js
index e65becc6..a127d9e5 100644
--- a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-invert/dist/index.js
@@ -3,33 +3,27 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Inverts the image
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- invert: function invert(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- this.bitmap.data[idx] = 255 - this.bitmap.data[idx];
- this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];
- this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+var _default = () => ({
+ invert(cb) {
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ this.bitmap.data[idx] = 255 - this.bitmap.data[idx];
+ this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];
+ this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map
index df886979..672127d1 100644
--- a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;eAKe;AAAA,SAAO;AACpBA,IAAAA,MADoB,kBACbC,EADa,EACT;AACT,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,IAAwB,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,CAA9B;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACD,OARD;;AAUA,UAAI,0BAAcP,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACS,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjBmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","isNodePattern","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AAJA,eAKe,OAAO;EACpBA,MAAM,CAACC,EAAE,EAAE;IACT,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;MACnB,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,CAAC;MACnD,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC;MAC3D,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC;IAC7D,CAAC,CACF;IAED,IAAI,IAAAE,oBAAa,EAACT,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACU,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-invert/es/index.js b/project starter code/node_modules/@jimp/plugin-invert/es/index.js
index 4d4ce18d..61bc06c8 100644
--- a/project starter code/node_modules/@jimp/plugin-invert/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-invert/es/index.js
@@ -1,34 +1,21 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern } from "@jimp/utils";
/**
* Inverts the image
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- invert: function invert(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- this.bitmap.data[idx] = 255 - this.bitmap.data[idx];
- this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];
- this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+export default (() => ({
+ invert(cb) {
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ this.bitmap.data[idx] = 255 - this.bitmap.data[idx];
+ this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];
+ this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map b/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map
index df886979..a2fba38f 100644
--- a/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;eAKe;AAAA,SAAO;AACpBA,IAAAA,MADoB,kBACbC,EADa,EACT;AACT,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,IAAwB,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,CAA9B;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACD,OARD;;AAUA,UAAI,0BAAcP,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACS,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjBmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,MAAM,CAACC,EAAE,EAAE;IACT,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;MACnB,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,CAAC;MACnD,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC;MAC3D,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC;IAC7D,CAAC,CACF;IAED,IAAIT,aAAa,CAACE,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACS,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-invert/index.d.ts b/project starter code/node_modules/@jimp/plugin-invert/index.d.ts
index 654051c3..483b5430 100644
--- a/project starter code/node_modules/@jimp/plugin-invert/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-invert/index.d.ts
@@ -1,7 +1,7 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Invert {
invert(cb?: ImageCallback): this;
}
-export default function(): Invert;
+export default function (): Invert;
diff --git a/project starter code/node_modules/@jimp/plugin-invert/package.json b/project starter code/node_modules/@jimp/plugin-invert/package.json
index 863a4c18..09b9fee7 100644
--- a/project starter code/node_modules/@jimp/plugin-invert/package.json
+++ b/project starter code/node_modules/@jimp/plugin-invert/package.json
@@ -1,9 +1,10 @@
{
"name": "@jimp/plugin-invert",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "invert an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
"build": "npm run build:node:production && npm run build:module",
@@ -17,8 +18,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
@@ -26,5 +26,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-invert/src/index.js b/project starter code/node_modules/@jimp/plugin-invert/src/index.js
index 24565842..44ad9302 100644
--- a/project starter code/node_modules/@jimp/plugin-invert/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-invert/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern } from '@jimp/utils';
+import { isNodePattern } from "@jimp/utils";
/**
* Inverts the image
@@ -7,20 +7,22 @@ import { isNodePattern } from '@jimp/utils';
*/
export default () => ({
invert(cb) {
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- this.bitmap.data[idx] = 255 - this.bitmap.data[idx];
- this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];
- this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];
- });
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ this.bitmap.data[idx] = 255 - this.bitmap.data[idx];
+ this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];
+ this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md
index 26394e0f..3d839517 100644
--- a/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md
@@ -1,3 +1,65 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +74,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +82,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-mask/README.md b/project starter code/node_modules/@jimp/plugin-mask/README.md
index 97720717..840ce372 100644
--- a/project starter code/node_modules/@jimp/plugin-mask/README.md
+++ b/project starter code/node_modules/@jimp/plugin-mask/README.md
@@ -15,11 +15,11 @@ Masks a source image on to this image using average pixel colour. A completely b
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
- const mask = await jimp.read('test/mask.png');
+ const image = await jimp.read("test/image.png");
+ const mask = await jimp.read("test/mask.png");
image.mask(mask);
}
diff --git a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js b/project starter code/node_modules/@jimp/plugin-mask/dist/index.js
index 7c1c03a7..d8434809 100644
--- a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-mask/dist/index.js
@@ -3,10 +3,8 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.
* @param {Jimp} src the source Jimp instance
@@ -15,48 +13,43 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- mask: function mask(src) {
- var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
- var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
- var cb = arguments.length > 3 ? arguments[3] : undefined;
-
- if (!(src instanceof this.constructor)) {
- return _utils.throwError.call(this, 'The source must be a Jimp image', cb);
- }
-
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers', cb);
- } // round input
-
-
- x = Math.round(x);
- y = Math.round(y);
- var w = this.bitmap.width;
- var h = this.bitmap.height;
- var baseImage = this;
- src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) {
- var destX = x + sx;
- var destY = y + sy;
-
- if (destX >= 0 && destY >= 0 && destX < w && destY < h) {
- var dstIdx = baseImage.getPixelIndex(destX, destY);
- var data = this.bitmap.data;
- var avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;
- baseImage.bitmap.data[dstIdx + 3] *= avg / 255;
- }
- });
+var _default = () => ({
+ mask(src) {
+ let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
+ let cb = arguments.length > 3 ? arguments[3] : undefined;
+ if (!(src instanceof this.constructor)) {
+ return _utils.throwError.call(this, "The source must be a Jimp image", cb);
+ }
+ if (typeof x !== "number" || typeof y !== "number") {
+ return _utils.throwError.call(this, "x and y must be numbers", cb);
+ }
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ // round input
+ x = Math.round(x);
+ y = Math.round(y);
+ const w = this.bitmap.width;
+ const h = this.bitmap.height;
+ const baseImage = this;
+ src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) {
+ const destX = x + sx;
+ const destY = y + sy;
+ if (destX >= 0 && destY >= 0 && destX < w && destY < h) {
+ const dstIdx = baseImage.getPixelIndex(destX, destY);
+ const {
+ data
+ } = this.bitmap;
+ const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;
+ baseImage.bitmap.data[dstIdx + 3] *= avg / 255;
}
-
- return this;
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map
index 4a01d592..b28fd47c 100644
--- a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["mask","src","x","y","cb","constructor","throwError","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;eAQe;AAAA,SAAO;AACpBA,IAAAA,IADoB,gBACfC,GADe,EACQ;AAAA,UAAlBC,CAAkB,uEAAd,CAAc;AAAA,UAAXC,CAAW,uEAAP,CAAO;AAAA,UAAJC,EAAI;;AAC1B,UAAI,EAAEH,GAAG,YAAY,KAAKI,WAAtB,CAAJ,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD,OAPyB,CAS1B;;;AACAF,MAAAA,CAAC,GAAGM,IAAI,CAACC,KAAL,CAAWP,CAAX,CAAJ;AACAC,MAAAA,CAAC,GAAGK,IAAI,CAACC,KAAL,CAAWN,CAAX,CAAJ;AAEA,UAAMO,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAAtB;AACA,UAAMC,CAAC,GAAG,KAAKF,MAAL,CAAYG,MAAtB;AACA,UAAMC,SAAS,GAAG,IAAlB;AAEAd,MAAAA,GAAG,CAACe,SAAJ,CAAc,CAAd,EAAiB,CAAjB,EAAoBf,GAAG,CAACU,MAAJ,CAAWC,KAA/B,EAAsCX,GAAG,CAACU,MAAJ,CAAWG,MAAjD,EAAyD,UACvDG,EADuD,EAEvDC,EAFuD,EAGvDC,GAHuD,EAIvD;AACA,YAAMC,KAAK,GAAGlB,CAAC,GAAGe,EAAlB;AACA,YAAMI,KAAK,GAAGlB,CAAC,GAAGe,EAAlB;;AAEA,YAAIE,KAAK,IAAI,CAAT,IAAcC,KAAK,IAAI,CAAvB,IAA4BD,KAAK,GAAGV,CAApC,IAAyCW,KAAK,GAAGR,CAArD,EAAwD;AACtD,cAAMS,MAAM,GAAGP,SAAS,CAACQ,aAAV,CAAwBH,KAAxB,EAA+BC,KAA/B,CAAf;AADsD,cAE9CG,IAF8C,GAErC,KAAKb,MAFgC,CAE9Ca,IAF8C;AAGtD,cAAMC,GAAG,GAAG,CAACD,IAAI,CAACL,GAAG,GAAG,CAAP,CAAJ,GAAgBK,IAAI,CAACL,GAAG,GAAG,CAAP,CAApB,GAAgCK,IAAI,CAACL,GAAG,GAAG,CAAP,CAArC,IAAkD,CAA9D;AAEAJ,UAAAA,SAAS,CAACJ,MAAV,CAAiBa,IAAjB,CAAsBF,MAAM,GAAG,CAA/B,KAAqCG,GAAG,GAAG,GAA3C;AACD;AACF,OAfD;;AAiBA,UAAI,0BAAcrB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAxCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["mask","src","x","y","cb","constructor","throwError","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(\n 0,\n 0,\n src.bitmap.width,\n src.bitmap.height,\n function (sx, sy, idx) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,eAQe,OAAO;EACpBA,IAAI,CAACC,GAAG,EAAoB;IAAA,IAAlBC,CAAC,uEAAG,CAAC;IAAA,IAAEC,CAAC,uEAAG,CAAC;IAAA,IAAEC,EAAE;IACxB,IAAI,EAAEH,GAAG,YAAY,IAAI,CAACI,WAAW,CAAC,EAAE;MACtC,OAAOC,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEH,EAAE,CAAC;IACrE;IAEA,IAAI,OAAOF,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOG,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEH,EAAE,CAAC;IAC7D;;IAEA;IACAF,CAAC,GAAGM,IAAI,CAACC,KAAK,CAACP,CAAC,CAAC;IACjBC,CAAC,GAAGK,IAAI,CAACC,KAAK,CAACN,CAAC,CAAC;IAEjB,MAAMO,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK;IAC3B,MAAMC,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM;IAC5B,MAAMC,SAAS,GAAG,IAAI;IAEtBd,GAAG,CAACe,SAAS,CACX,CAAC,EACD,CAAC,EACDf,GAAG,CAACU,MAAM,CAACC,KAAK,EAChBX,GAAG,CAACU,MAAM,CAACG,MAAM,EACjB,UAAUG,EAAE,EAAEC,EAAE,EAAEC,GAAG,EAAE;MACrB,MAAMC,KAAK,GAAGlB,CAAC,GAAGe,EAAE;MACpB,MAAMI,KAAK,GAAGlB,CAAC,GAAGe,EAAE;MAEpB,IAAIE,KAAK,IAAI,CAAC,IAAIC,KAAK,IAAI,CAAC,IAAID,KAAK,GAAGV,CAAC,IAAIW,KAAK,GAAGR,CAAC,EAAE;QACtD,MAAMS,MAAM,GAAGP,SAAS,CAACQ,aAAa,CAACH,KAAK,EAAEC,KAAK,CAAC;QACpD,MAAM;UAAEG;QAAK,CAAC,GAAG,IAAI,CAACb,MAAM;QAC5B,MAAMc,GAAG,GAAG,CAACD,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAGK,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAGK,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;QAE/DJ,SAAS,CAACJ,MAAM,CAACa,IAAI,CAACF,MAAM,GAAG,CAAC,CAAC,IAAIG,GAAG,GAAG,GAAG;MAChD;IACF,CAAC,CACF;IAED,IAAI,IAAAC,oBAAa,EAACtB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-mask/es/index.js b/project starter code/node_modules/@jimp/plugin-mask/es/index.js
index 2bb7a119..ba52d216 100644
--- a/project starter code/node_modules/@jimp/plugin-mask/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-mask/es/index.js
@@ -1,11 +1,4 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.
@@ -15,47 +8,40 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- mask: function mask(src) {
- var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
- var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
- var cb = arguments.length > 3 ? arguments[3] : undefined;
-
- if (!(src instanceof this.constructor)) {
- return _utils.throwError.call(this, 'The source must be a Jimp image', cb);
- }
-
- if (typeof x !== 'number' || typeof y !== 'number') {
- return _utils.throwError.call(this, 'x and y must be numbers', cb);
- } // round input
-
-
- x = Math.round(x);
- y = Math.round(y);
- var w = this.bitmap.width;
- var h = this.bitmap.height;
- var baseImage = this;
- src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) {
- var destX = x + sx;
- var destY = y + sy;
-
- if (destX >= 0 && destY >= 0 && destX < w && destY < h) {
- var dstIdx = baseImage.getPixelIndex(destX, destY);
- var data = this.bitmap.data;
- var avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;
- baseImage.bitmap.data[dstIdx + 3] *= avg / 255;
- }
- });
+export default (() => ({
+ mask(src) {
+ let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
+ let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
+ let cb = arguments.length > 3 ? arguments[3] : undefined;
+ if (!(src instanceof this.constructor)) {
+ return throwError.call(this, "The source must be a Jimp image", cb);
+ }
+ if (typeof x !== "number" || typeof y !== "number") {
+ return throwError.call(this, "x and y must be numbers", cb);
+ }
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
+ // round input
+ x = Math.round(x);
+ y = Math.round(y);
+ const w = this.bitmap.width;
+ const h = this.bitmap.height;
+ const baseImage = this;
+ src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) {
+ const destX = x + sx;
+ const destY = y + sy;
+ if (destX >= 0 && destY >= 0 && destX < w && destY < h) {
+ const dstIdx = baseImage.getPixelIndex(destX, destY);
+ const {
+ data
+ } = this.bitmap;
+ const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;
+ baseImage.bitmap.data[dstIdx + 3] *= avg / 255;
}
-
- return this;
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map b/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map
index 4a01d592..fed87ab8 100644
--- a/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["mask","src","x","y","cb","constructor","throwError","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;eAQe;AAAA,SAAO;AACpBA,IAAAA,IADoB,gBACfC,GADe,EACQ;AAAA,UAAlBC,CAAkB,uEAAd,CAAc;AAAA,UAAXC,CAAW,uEAAP,CAAO;AAAA,UAAJC,EAAI;;AAC1B,UAAI,EAAEH,GAAG,YAAY,KAAKI,WAAtB,CAAJ,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD,OAPyB,CAS1B;;;AACAF,MAAAA,CAAC,GAAGM,IAAI,CAACC,KAAL,CAAWP,CAAX,CAAJ;AACAC,MAAAA,CAAC,GAAGK,IAAI,CAACC,KAAL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source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","throwError","mask","src","x","y","cb","constructor","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(\n 0,\n 0,\n src.bitmap.width,\n src.bitmap.height,\n function (sx, sy, idx) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,IAAI,CAACC,GAAG,EAAoB;IAAA,IAAlBC,CAAC,uEAAG,CAAC;IAAA,IAAEC,CAAC,uEAAG,CAAC;IAAA,IAAEC,EAAE;IACxB,IAAI,EAAEH,GAAG,YAAY,IAAI,CAACI,WAAW,CAAC,EAAE;MACtC,OAAON,UAAU,CAACO,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEF,EAAE,CAAC;IACrE;IAEA,IAAI,OAAOF,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOJ,UAAU,CAACO,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;IAC7D;;IAEA;IACAF,CAAC,GAAGK,IAAI,CAACC,KAAK,CAACN,CAAC,CAAC;IACjBC,CAAC,GAAGI,IAAI,CAACC,KAAK,CAACL,CAAC,CAAC;IAEjB,MAAMM,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK;IAC3B,MAAMC,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM;IAC5B,MAAMC,SAAS,GAAG,IAAI;IAEtBb,GAAG,CAACc,SAAS,CACX,CAAC,EACD,CAAC,EACDd,GAAG,CAACS,MAAM,CAACC,KAAK,EAChBV,GAAG,CAACS,MAAM,CAACG,MAAM,EACjB,UAAUG,EAAE,EAAEC,EAAE,EAAEC,GAAG,EAAE;MACrB,MAAMC,KAAK,GAAGjB,CAAC,GAAGc,EAAE;MACpB,MAAMI,KAAK,GAAGjB,CAAC,GAAGc,EAAE;MAEpB,IAAIE,KAAK,IAAI,CAAC,IAAIC,KAAK,IAAI,CAAC,IAAID,KAAK,GAAGV,CAAC,IAAIW,KAAK,GAAGR,CAAC,EAAE;QACtD,MAAMS,MAAM,GAAGP,SAAS,CAACQ,aAAa,CAACH,KAAK,EAAEC,KAAK,CAAC;QACpD,MAAM;UAAEG;QAAK,CAAC,GAAG,IAAI,CAACb,MAAM;QAC5B,MAAMc,GAAG,GAAG,CAACD,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAGK,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAGK,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;QAE/DJ,SAAS,CAACJ,MAAM,CAACa,IAAI,CAACF,MAAM,GAAG,CAAC,CAAC,IAAIG,GAAG,GAAG,GAAG;MAChD;IACF,CAAC,CACF;IAED,IAAI1B,aAAa,CAACM,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-mask/index.d.ts b/project starter code/node_modules/@jimp/plugin-mask/index.d.ts
index 01092b81..8effa592 100644
--- a/project starter code/node_modules/@jimp/plugin-mask/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-mask/index.d.ts
@@ -1,7 +1,7 @@
-import { ImageCallback, Jimp } from '@jimp/core';
+import { ImageCallback, Jimp } from "@jimp/core";
interface Mask {
mask(src: Jimp, x: number, y: number, cb?: ImageCallback): this;
}
-export default function(): Mask;
+export default function (): Mask;
diff --git a/project starter code/node_modules/@jimp/plugin-mask/package.json b/project starter code/node_modules/@jimp/plugin-mask/package.json
index 6b10d9eb..3faf2647 100644
--- a/project starter code/node_modules/@jimp/plugin-mask/package.json
+++ b/project starter code/node_modules/@jimp/plugin-mask/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-mask",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "mask an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,18 +21,17 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-mask/src/index.js b/project starter code/node_modules/@jimp/plugin-mask/src/index.js
index 92a5f5f1..2a6b32d4 100644
--- a/project starter code/node_modules/@jimp/plugin-mask/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-mask/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern, throwError } from '@jimp/utils';
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.
@@ -11,11 +11,11 @@ import { isNodePattern, throwError } from '@jimp/utils';
export default () => ({
mask(src, x = 0, y = 0, cb) {
if (!(src instanceof this.constructor)) {
- return throwError.call(this, 'The source must be a Jimp image', cb);
+ return throwError.call(this, "The source must be a Jimp image", cb);
}
- if (typeof x !== 'number' || typeof y !== 'number') {
- return throwError.call(this, 'x and y must be numbers', cb);
+ if (typeof x !== "number" || typeof y !== "number") {
+ return throwError.call(this, "x and y must be numbers", cb);
}
// round input
@@ -26,27 +26,29 @@ export default () => ({
const h = this.bitmap.height;
const baseImage = this;
- src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(
- sx,
- sy,
- idx
- ) {
- const destX = x + sx;
- const destY = y + sy;
-
- if (destX >= 0 && destY >= 0 && destX < w && destY < h) {
- const dstIdx = baseImage.getPixelIndex(destX, destY);
- const { data } = this.bitmap;
- const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;
-
- baseImage.bitmap.data[dstIdx + 3] *= avg / 255;
+ src.scanQuiet(
+ 0,
+ 0,
+ src.bitmap.width,
+ src.bitmap.height,
+ function (sx, sy, idx) {
+ const destX = x + sx;
+ const destY = y + sy;
+
+ if (destX >= 0 && destY >= 0 && destX < w && destY < h) {
+ const dstIdx = baseImage.getPixelIndex(destX, destY);
+ const { data } = this.bitmap;
+ const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;
+
+ baseImage.bitmap.data[dstIdx + 3] *= avg / 255;
+ }
}
- });
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js b/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js
index eebcf15e..e63713f6 100644
--- a/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js
+++ b/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js
@@ -1,26 +1,27 @@
-import { Jimp, mkJGD } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, mkJGD } from "@jimp/test-utils";
+import configure from "@jimp/custom";
-import mask from '../src';
+import mask from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [mask] }, Jimp);
-describe('Mask', () => {
+describe("Mask", () => {
let imgSrcOpaq;
let imgSrcAlpa;
let maskGrayBig;
let maskGraySmall;
let maskColor;
- before(done => {
+ before((done) => {
Promise.all([
- jimp.read(mkJGD('▴□▾□■□', '■▴■▾■□', '■□▴□▾□', '■□■▴■▾')),
- jimp.read(mkJGD('▴▵▾▿', '▴▵▾▿', '▴▵▾▿')),
- jimp.read(mkJGD('048840', '8CFFC8', '8CFFC8', '048840')),
- jimp.read(mkJGD('0369', '369C', '69CF')),
- jimp.read(mkJGD('▴▴▾▾', '▪▪▰▰', '□□□□'))
+ jimp.read(mkJGD("▴□▾□■□", "■▴■▾■□", "■□▴□▾□", "■□■▴■▾")),
+ jimp.read(mkJGD("▴▵▾▿", "▴▵▾▿", "▴▵▾▿")),
+ jimp.read(mkJGD("048840", "8CFFC8", "8CFFC8", "048840")),
+ jimp.read(mkJGD("0369", "369C", "69CF")),
+ jimp.read(mkJGD("▴▴▾▾", "▪▪▰▰", "□□□□")),
])
- .then(imgs => {
+ .then((imgs) => {
imgSrcOpaq = imgs[0];
imgSrcAlpa = imgs[1];
maskGrayBig = imgs[2];
@@ -31,275 +32,103 @@ describe('Mask', () => {
.catch(done);
});
- it('Affect opaque image with a gray mask with the same size', () => {
- imgSrcOpaq
- .clone()
- .mask(maskGrayBig)
- .getJGDSync()
- .should.be.sameJGD({
- width: 6,
- height: 4,
- data: [
- 0xff000000,
- 0xffffff44,
- 0x0000ff88,
- 0xffffff88,
- 0x00000044,
- 0xffffff00,
- 0x00000088,
- 0xff0000cc,
- 0x000000ff,
- 0x0000ffff,
- 0x000000cc,
- 0xffffff88,
- 0x00000088,
- 0xffffffcc,
- 0xff0000ff,
- 0xffffffff,
- 0x0000ffcc,
- 0xffffff88,
- 0x00000000,
- 0xffffff44,
- 0x00000088,
- 0xff000088,
- 0x00000044,
- 0x0000ff00
- ]
- });
+ it("Affect opaque image with a gray mask with the same size", () => {
+ expectToBeJGD(imgSrcOpaq.clone().mask(maskGrayBig).getJGDSync(), {
+ width: 6,
+ height: 4,
+ data: [
+ 0xff000000, 0xffffff44, 0x0000ff88, 0xffffff88, 0x00000044, 0xffffff00,
+ 0x00000088, 0xff0000cc, 0x000000ff, 0x0000ffff, 0x000000cc, 0xffffff88,
+ 0x00000088, 0xffffffcc, 0xff0000ff, 0xffffffff, 0x0000ffcc, 0xffffff88,
+ 0x00000000, 0xffffff44, 0x00000088, 0xff000088, 0x00000044, 0x0000ff00,
+ ],
+ });
});
- it('Affect opaque image with a gray mask with the same size, blited', () => {
- imgSrcOpaq
- .clone()
- .mask(maskGrayBig, 1, 1)
- .getJGDSync()
- .should.be.sameJGD({
- width: 6,
- height: 4,
- data: [
- 0xff0000ff,
- 0xffffffff,
- 0x0000ffff,
- 0xffffffff,
- 0x000000ff,
- 0xffffffff,
- 0x000000ff,
- 0xff000000,
- 0x00000044,
- 0x0000ff88,
- 0x00000088,
- 0xffffff44,
- 0x000000ff,
- 0xffffff88,
- 0xff0000cc,
- 0xffffffff,
- 0x0000ffff,
- 0xffffffcc,
- 0x000000ff,
- 0xffffff88,
- 0x000000cc,
- 0xff0000ff,
- 0x000000ff,
- 0x0000ffcc
- ]
- });
+ it("Affect opaque image with a gray mask with the same size, blited", () => {
+ expectToBeJGD(imgSrcOpaq.clone().mask(maskGrayBig, 1, 1).getJGDSync(), {
+ width: 6,
+ height: 4,
+ data: [
+ 0xff0000ff, 0xffffffff, 0x0000ffff, 0xffffffff, 0x000000ff, 0xffffffff,
+ 0x000000ff, 0xff000000, 0x00000044, 0x0000ff88, 0x00000088, 0xffffff44,
+ 0x000000ff, 0xffffff88, 0xff0000cc, 0xffffffff, 0x0000ffff, 0xffffffcc,
+ 0x000000ff, 0xffffff88, 0x000000cc, 0xff0000ff, 0x000000ff, 0x0000ffcc,
+ ],
+ });
});
- it('Affect opaque image with a gray mask with the same size, blited negative', () => {
- imgSrcOpaq
- .clone()
- .mask(maskGrayBig, -1, -1)
- .getJGDSync()
- .should.be.sameJGD({
- width: 6,
- height: 4,
- data: [
- 0xff0000cc,
- 0xffffffff,
- 0x0000ffff,
- 0xffffffcc,
- 0x00000088,
- 0xffffffff,
- 0x000000cc,
- 0xff0000ff,
- 0x000000ff,
- 0x0000ffcc,
- 0x00000088,
- 0xffffffff,
- 0x00000044,
- 0xffffff88,
- 0xff000088,
- 0xffffff44,
- 0x0000ff00,
- 0xffffffff,
- 0x000000ff,
- 0xffffffff,
- 0x000000ff,
- 0xff0000ff,
- 0x000000ff,
- 0x0000ffff
- ]
- });
+ it("Affect opaque image with a gray mask with the same size, blited negative", () => {
+ expectToBeJGD(imgSrcOpaq.clone().mask(maskGrayBig, -1, -1).getJGDSync(), {
+ width: 6,
+ height: 4,
+ data: [
+ 0xff0000cc, 0xffffffff, 0x0000ffff, 0xffffffcc, 0x00000088, 0xffffffff,
+ 0x000000cc, 0xff0000ff, 0x000000ff, 0x0000ffcc, 0x00000088, 0xffffffff,
+ 0x00000044, 0xffffff88, 0xff000088, 0xffffff44, 0x0000ff00, 0xffffffff,
+ 0x000000ff, 0xffffffff, 0x000000ff, 0xff0000ff, 0x000000ff, 0x0000ffff,
+ ],
+ });
});
- it('Affect opaque image with a smaller gray mask', () => {
- imgSrcOpaq
- .clone()
- .mask(maskGraySmall)
- .getJGDSync()
- .should.be.sameJGD({
- width: 6,
- height: 4,
- data: [
- 0xff000000,
- 0xffffff33,
- 0x0000ff66,
- 0xffffff99,
- 0x000000ff,
- 0xffffffff,
- 0x00000033,
- 0xff000066,
- 0x00000099,
- 0x0000ffcc,
- 0x000000ff,
- 0xffffffff,
- 0x00000066,
- 0xffffff99,
- 0xff0000cc,
- 0xffffffff,
- 0x0000ffff,
- 0xffffffff,
- 0x000000ff,
- 0xffffffff,
- 0x000000ff,
- 0xff0000ff,
- 0x000000ff,
- 0x0000ffff
- ]
- });
+ it("Affect opaque image with a smaller gray mask", () => {
+ expectToBeJGD(imgSrcOpaq.clone().mask(maskGraySmall).getJGDSync(), {
+ width: 6,
+ height: 4,
+ data: [
+ 0xff000000, 0xffffff33, 0x0000ff66, 0xffffff99, 0x000000ff, 0xffffffff,
+ 0x00000033, 0xff000066, 0x00000099, 0x0000ffcc, 0x000000ff, 0xffffffff,
+ 0x00000066, 0xffffff99, 0xff0000cc, 0xffffffff, 0x0000ffff, 0xffffffff,
+ 0x000000ff, 0xffffffff, 0x000000ff, 0xff0000ff, 0x000000ff, 0x0000ffff,
+ ],
+ });
});
- it('Affect opaque image with a smaller gray mask, blited', () => {
- imgSrcOpaq
- .clone()
- .mask(maskGraySmall, 1, 1)
- .getJGDSync()
- .should.be.sameJGD({
- width: 6,
- height: 4,
- data: [
- 0xff0000ff,
- 0xffffffff,
- 0x0000ffff,
- 0xffffffff,
- 0x000000ff,
- 0xffffffff,
- 0x000000ff,
- 0xff000000,
- 0x00000033,
- 0x0000ff66,
- 0x00000099,
- 0xffffffff,
- 0x000000ff,
- 0xffffff33,
- 0xff000066,
- 0xffffff99,
- 0x0000ffcc,
- 0xffffffff,
- 0x000000ff,
- 0xffffff66,
- 0x00000099,
- 0xff0000cc,
- 0x000000ff,
- 0x0000ffff
- ]
- });
+ it("Affect opaque image with a smaller gray mask, blited", () => {
+ expectToBeJGD(imgSrcOpaq.clone().mask(maskGraySmall, 1, 1).getJGDSync(), {
+ width: 6,
+ height: 4,
+ data: [
+ 0xff0000ff, 0xffffffff, 0x0000ffff, 0xffffffff, 0x000000ff, 0xffffffff,
+ 0x000000ff, 0xff000000, 0x00000033, 0x0000ff66, 0x00000099, 0xffffffff,
+ 0x000000ff, 0xffffff33, 0xff000066, 0xffffff99, 0x0000ffcc, 0xffffffff,
+ 0x000000ff, 0xffffff66, 0x00000099, 0xff0000cc, 0x000000ff, 0x0000ffff,
+ ],
+ });
});
- it('Affect alpha image with a bigger gray mask', () => {
- imgSrcAlpa
- .clone()
- .mask(maskGrayBig)
- .getJGDSync()
- .should.be.sameJGD({
- width: 4,
- height: 3,
- data: [
- 0xff000000,
- 0xff000021,
- 0x0000ff88,
- 0x0000ff43,
- 0xff000088,
- 0xff000065,
- 0x0000ffff,
- 0x0000ff7f,
- 0xff000088,
- 0xff000065,
- 0x0000ffff,
- 0x0000ff7f
- ]
- });
+ it("Affect alpha image with a bigger gray mask", () => {
+ expectToBeJGD(imgSrcAlpa.clone().mask(maskGrayBig).getJGDSync(), {
+ width: 4,
+ height: 3,
+ data: [
+ 0xff000000, 0xff000021, 0x0000ff88, 0x0000ff43, 0xff000088, 0xff000065,
+ 0x0000ffff, 0x0000ff7f, 0xff000088, 0xff000065, 0x0000ffff, 0x0000ff7f,
+ ],
+ });
});
- it('Affect alpha image with a bigger gray mask, blited', () => {
- imgSrcAlpa
- .clone()
- .mask(maskGrayBig, -1, -1)
- .getJGDSync()
- .should.be.sameJGD({
- width: 4,
- height: 3,
- data: [
- 0xff0000cc,
- 0xff00007f,
- 0x0000ffff,
- 0x0000ff65,
- 0xff0000cc,
- 0xff00007f,
- 0x0000ffff,
- 0x0000ff65,
- 0xff000044,
- 0xff000043,
- 0x0000ff88,
- 0x0000ff21
- ]
- });
+ it("Affect alpha image with a bigger gray mask, blited", () => {
+ expectToBeJGD(imgSrcAlpa.clone().mask(maskGrayBig, -1, -1).getJGDSync(), {
+ width: 4,
+ height: 3,
+ data: [
+ 0xff0000cc, 0xff00007f, 0x0000ffff, 0x0000ff65, 0xff0000cc, 0xff00007f,
+ 0x0000ffff, 0x0000ff65, 0xff000044, 0xff000043, 0x0000ff88, 0x0000ff21,
+ ],
+ });
});
- it('Affect opaque image with a colored mask', () => {
- imgSrcOpaq
- .clone()
- .mask(maskColor, 1, 1)
- .getJGDSync()
- .should.be.sameJGD({
- width: 6,
- height: 4,
- data: [
- 0xff0000ff,
- 0xffffffff,
- 0x0000ffff,
- 0xffffffff,
- 0x000000ff,
- 0xffffffff,
- 0x000000ff,
- 0xff000055,
- 0x00000055,
- 0x0000ff55,
- 0x00000055,
- 0xffffffff,
- 0x000000ff,
- 0xffffffaa,
- 0xff0000aa,
- 0xffffffaa,
- 0x0000ffaa,
- 0xffffffff,
- 0x000000ff,
- 0xffffffff,
- 0x000000ff,
- 0xff0000ff,
- 0x000000ff,
- 0x0000ffff
- ]
- });
+ it("Affect opaque image with a colored mask", () => {
+ expectToBeJGD(imgSrcOpaq.clone().mask(maskColor, 1, 1).getJGDSync(), {
+ width: 6,
+ height: 4,
+ data: [
+ 0xff0000ff, 0xffffffff, 0x0000ffff, 0xffffffff, 0x000000ff, 0xffffffff,
+ 0x000000ff, 0xff000055, 0x00000055, 0x0000ff55, 0x00000055, 0xffffffff,
+ 0x000000ff, 0xffffffaa, 0xff0000aa, 0xffffffaa, 0x0000ffaa, 0xffffffff,
+ 0x000000ff, 0xffffffff, 0x000000ff, 0xff0000ff, 0x000000ff, 0x0000ffff,
+ ],
+ });
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md
index 26394e0f..3d839517 100644
--- a/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md
@@ -1,3 +1,65 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +74,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +82,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-normalize/README.md b/project starter code/node_modules/@jimp/plugin-normalize/README.md
index bca72509..19ba914d 100644
--- a/project starter code/node_modules/@jimp/plugin-normalize/README.md
+++ b/project starter code/node_modules/@jimp/plugin-normalize/README.md
@@ -12,10 +12,10 @@ Normalizes an images color by computing a histogram.
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.normalize();
}
diff --git a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js b/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js
index d5a04e60..be2453a6 100644
--- a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js
@@ -3,16 +3,14 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Get an image's histogram
* @return {object} An object with an array of color occurrence counts for each channel (r,g,b)
*/
function histogram() {
- var histogram = {
+ const histogram = {
r: new Array(256).fill(0),
g: new Array(256).fill(0),
b: new Array(256).fill(0)
@@ -24,6 +22,7 @@ function histogram() {
});
return histogram;
}
+
/**
* Normalize values
* @param {integer} value Pixel channel value.
@@ -31,55 +30,45 @@ function histogram() {
* @param {integer} max Maximum value for channel
* @return {integer} normalized values
*/
-
-
-var _normalize = function normalize(value, min, max) {
+const normalize = function (value, min, max) {
return (value - min) * 255 / (max - min);
};
-
-var getBounds = function getBounds(histogramChannel) {
- return [histogramChannel.findIndex(function (value) {
- return value > 0;
- }), 255 - histogramChannel.slice().reverse().findIndex(function (value) {
- return value > 0;
- })];
+const getBounds = function (histogramChannel) {
+ return [histogramChannel.findIndex(value => value > 0), 255 - histogramChannel.slice().reverse().findIndex(value => value > 0)];
};
+
/**
* Normalizes the image
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
+var _default = () => ({
+ normalize(cb) {
+ const h = histogram.call(this);
+ // store bounds (minimum and maximum values)
+ const bounds = {
+ r: getBounds(h.r),
+ g: getBounds(h.g),
+ b: getBounds(h.b)
+ };
-var _default = function _default() {
- return {
- normalize: function normalize(cb) {
- var h = histogram.call(this); // store bounds (minimum and maximum values)
-
- var bounds = {
- r: getBounds(h.r),
- g: getBounds(h.g),
- b: getBounds(h.b)
- }; // apply value transformations
-
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var r = this.bitmap.data[idx + 0];
- var g = this.bitmap.data[idx + 1];
- var b = this.bitmap.data[idx + 2];
- this.bitmap.data[idx + 0] = _normalize(r, bounds.r[0], bounds.r[1]);
- this.bitmap.data[idx + 1] = _normalize(g, bounds.g[0], bounds.g[1]);
- this.bitmap.data[idx + 2] = _normalize(b, bounds.b[0], bounds.b[1]);
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+ // apply value transformations
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ const r = this.bitmap.data[idx + 0];
+ const g = this.bitmap.data[idx + 1];
+ const b = this.bitmap.data[idx + 2];
+ this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);
+ this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);
+ this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map
index 4d6f08af..acaa5ff3 100644
--- a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAIA,SAASA,SAAT,GAAqB;AACnB,MAAMA,SAAS,GAAG;AAChBC,IAAAA,CAAC,EAAE,IAAIC,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB,CADa;AAEhBC,IAAAA,CAAC,EAAE,IAAIF,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB,CAFa;AAGhBE,IAAAA,CAAC,EAAE,IAAIH,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB;AAHa,GAAlB;AAMA,OAAKG,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,KAH0D,EAI1D;AACAZ,IAAAA,SAAS,CAACC,CAAV,CAAY,KAA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AAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DgB,GAH0D,EAI1D;AACA,YAAM1B,CAAC,GAAG,KAAKM,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,CAAV;AACA,YAAMvB,CAAC,GAAG,KAAKG,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,CAAV;AACA,YAAMtB,CAAC,GAAG,KAAKE,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,CAAV;AAEA,aAAKpB,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACb,CAAD,EAAIyB,MAAM,CAACzB,CAAP,CAAS,CAAT,CAAJ,EAAiByB,MAAM,CAACzB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACA,aAAKM,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACV,CAAD,EAAIsB,MAAM,CAACtB,CAAP,CAAS,CAAT,CAAJ,EAAiBsB,MAAM,CAACtB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACA,aAAKG,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACT,CAAD,EAAIqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAJ,EAAiBqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACD,OAZD;;AAcA,UAAI,0BAAckB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA/BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0)\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n index\n ) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n });\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function(value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function(histogramChannel) {\n return [\n histogramChannel.findIndex(value => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex(value => value > 0)\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b)\n };\n\n // apply value transformations\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0),\n };\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, index) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n }\n );\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function (value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function (histogramChannel) {\n return [\n histogramChannel.findIndex((value) => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex((value) => value > 0),\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b),\n };\n\n // apply value transformations\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\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AM,CAACtB,CAAC,CAAC,CAAC,CAAC,CAAC;MAClE,IAAI,CAACG,MAAM,CAACM,IAAI,CAACc,GAAG,GAAG,CAAC,CAAC,GAAGb,SAAS,CAACT,CAAC,EAAEqB,MAAM,CAACrB,CAAC,CAAC,CAAC,CAAC,EAAEqB,MAAM,CAACrB,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC,CACF;IAED,IAAI,IAAAuB,oBAAa,EAACL,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js b/project starter code/node_modules/@jimp/plugin-normalize/es/index.js
index 7333fa33..49a86e31 100644
--- a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-normalize/es/index.js
@@ -1,18 +1,11 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern } from "@jimp/utils";
/**
* Get an image's histogram
* @return {object} An object with an array of color occurrence counts for each channel (r,g,b)
*/
function histogram() {
- var histogram = {
+ const histogram = {
r: new Array(256).fill(0),
g: new Array(256).fill(0),
b: new Array(256).fill(0)
@@ -24,6 +17,7 @@ function histogram() {
});
return histogram;
}
+
/**
* Normalize values
* @param {integer} value Pixel channel value.
@@ -31,54 +25,42 @@ function histogram() {
* @param {integer} max Maximum value for channel
* @return {integer} normalized values
*/
-
-
-var _normalize = function normalize(value, min, max) {
+const normalize = function (value, min, max) {
return (value - min) * 255 / (max - min);
};
-
-var getBounds = function getBounds(histogramChannel) {
- return [histogramChannel.findIndex(function (value) {
- return value > 0;
- }), 255 - histogramChannel.slice().reverse().findIndex(function (value) {
- return value > 0;
- })];
+const getBounds = function (histogramChannel) {
+ return [histogramChannel.findIndex(value => value > 0), 255 - histogramChannel.slice().reverse().findIndex(value => value > 0)];
};
+
/**
* Normalizes the image
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
+export default (() => ({
+ normalize(cb) {
+ const h = histogram.call(this);
+ // store bounds (minimum and maximum values)
+ const bounds = {
+ r: getBounds(h.r),
+ g: getBounds(h.g),
+ b: getBounds(h.b)
+ };
-var _default = function _default() {
- return {
- normalize: function normalize(cb) {
- var h = histogram.call(this); // store bounds (minimum and maximum values)
-
- var bounds = {
- r: getBounds(h.r),
- g: getBounds(h.g),
- b: getBounds(h.b)
- }; // apply value transformations
-
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var r = this.bitmap.data[idx + 0];
- var g = this.bitmap.data[idx + 1];
- var b = this.bitmap.data[idx + 2];
- this.bitmap.data[idx + 0] = _normalize(r, bounds.r[0], bounds.r[1]);
- this.bitmap.data[idx + 1] = _normalize(g, bounds.g[0], bounds.g[1]);
- this.bitmap.data[idx + 2] = _normalize(b, bounds.b[0], bounds.b[1]);
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+ // apply value transformations
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
+ const r = this.bitmap.data[idx + 0];
+ const g = this.bitmap.data[idx + 1];
+ const b = this.bitmap.data[idx + 2];
+ this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);
+ this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);
+ this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map b/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map
index 4d6f08af..b937f6f4 100644
--- a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAIA,SAASA,SAAT,GAAqB;AACnB,MAAMA,SAAS,GAAG;AAChBC,IAAAA,CAAC,EAAE,IAAIC,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB,CADa;AAEhBC,IAAAA,CAAC,EAAE,IAAIF,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB,CAFa;AAGhBE,IAAAA,CAAC,EAAE,IAAIH,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB;AAHa,GAAlB;AAMA,OAAKG,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,KAH0D,EAI1D;AACAZ,IAAAA,SAAS,CAACC,CAAV,CAAY,KAAKM,MAAL,CAAYM,IAAZ,CAAiBD,KAAK,GAAG,CAAzB,CAAZ;AACAZ,IAAAA,SAAS,CAACI,CAAV,CAAY,KAAKG,MAAL,CAAYM,IAAZ,CAAiBD,KAAK,GAAG,CAAzB,CAAZ;AACAZ,IAAAA,SAAS,CAACK,CAAV,CAAY,KAAKE,MAAL,CAAYM,IAAZ,CAAiBD,KAAK,GAAG,CAAzB,CAAZ;AACD,GARD;AAUA,SAAOZ,SAAP;AACD;AAED;;;;;;;;;AAOA,IAAMc,UAAS,GAAG,SAAZA,SAAY,CAASC,KAAT,EAAgBC,GAAhB,EAAq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AG,GAAG,CAAvB,CAAV;AAEA,aAAKpB,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACb,CAAD,EAAIyB,MAAM,CAACzB,CAAP,CAAS,CAAT,CAAJ,EAAiByB,MAAM,CAACzB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACA,aAAKM,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACV,CAAD,EAAIsB,MAAM,CAACtB,CAAP,CAAS,CAAT,CAAJ,EAAiBsB,MAAM,CAACtB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACA,aAAKG,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACT,CAAD,EAAIqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAJ,EAAiBqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACD,OAZD;;AAcA,UAAI,0BAAckB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA/BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0)\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n index\n ) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n });\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function(value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function(histogramChannel) {\n return [\n histogramChannel.findIndex(value => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex(value => value > 0)\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b)\n };\n\n // apply value transformations\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0),\n };\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, index) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n }\n );\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function (value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function (histogramChannel) {\n return [\n histogramChannel.findIndex((value) => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex((value) => value > 0),\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b),\n };\n\n // apply value transformations\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA,SAASC,SAAS,GAAG;EACnB,MAAMA,SAAS,GAAG;IAChBC,CAAC,EAAE,IAAIC,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;IACzBC,CAAC,EAAE,IAAIF,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;IACzBE,CAAC,EAAE,IAAIH,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC;EAC1B,CAAC;EAED,IAAI,CAACG,SA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C3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts b/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts
index abdf1839..1ae996dc 100644
--- a/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts
@@ -1,7 +1,7 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Normalize {
- normalize(cb ?: ImageCallback): this;
+ normalize(cb?: ImageCallback): this;
}
-export default function(): Normalize;
+export default function (): Normalize;
diff --git a/project starter code/node_modules/@jimp/plugin-normalize/package.json b/project starter code/node_modules/@jimp/plugin-normalize/package.json
index 4f66a0f0..3ada8c8d 100644
--- a/project starter code/node_modules/@jimp/plugin-normalize/package.json
+++ b/project starter code/node_modules/@jimp/plugin-normalize/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-normalize",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "normalize an image.",
"main": "dist/index.js",
"module": "es/index.js",
"types": "index.d.ts",
+ "repository": "jimp-dev/jimp",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,18 +21,17 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-normalize/src/index.js b/project starter code/node_modules/@jimp/plugin-normalize/src/index.js
index ba73ff42..57a696ca 100644
--- a/project starter code/node_modules/@jimp/plugin-normalize/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-normalize/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern } from '@jimp/utils';
+import { isNodePattern } from "@jimp/utils";
/**
* Get an image's histogram
@@ -8,18 +8,20 @@ function histogram() {
const histogram = {
r: new Array(256).fill(0),
g: new Array(256).fill(0),
- b: new Array(256).fill(0)
+ b: new Array(256).fill(0),
};
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- index
- ) {
- histogram.r[this.bitmap.data[index + 0]]++;
- histogram.g[this.bitmap.data[index + 1]]++;
- histogram.b[this.bitmap.data[index + 2]]++;
- });
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, index) {
+ histogram.r[this.bitmap.data[index + 0]]++;
+ histogram.g[this.bitmap.data[index + 1]]++;
+ histogram.b[this.bitmap.data[index + 2]]++;
+ }
+ );
return histogram;
}
@@ -31,18 +33,18 @@ function histogram() {
* @param {integer} max Maximum value for channel
* @return {integer} normalized values
*/
-const normalize = function(value, min, max) {
+const normalize = function (value, min, max) {
return ((value - min) * 255) / (max - min);
};
-const getBounds = function(histogramChannel) {
+const getBounds = function (histogramChannel) {
return [
- histogramChannel.findIndex(value => value > 0),
+ histogramChannel.findIndex((value) => value > 0),
255 -
histogramChannel
.slice()
.reverse()
- .findIndex(value => value > 0)
+ .findIndex((value) => value > 0),
];
};
@@ -59,28 +61,30 @@ export default () => ({
const bounds = {
r: getBounds(h.r),
g: getBounds(h.g),
- b: getBounds(h.b)
+ b: getBounds(h.b),
};
// apply value transformations
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- const r = this.bitmap.data[idx + 0];
- const g = this.bitmap.data[idx + 1];
- const b = this.bitmap.data[idx + 2];
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ const r = this.bitmap.data[idx + 0];
+ const g = this.bitmap.data[idx + 1];
+ const b = this.bitmap.data[idx + 2];
- this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);
- this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);
- this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);
- });
+ this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);
+ this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);
+ this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);
+ }
+ );
if (isNodePattern(cb)) {
cb.call(this, null, this);
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js b/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js
index 858f4189..2d8a885a 100644
--- a/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js
+++ b/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js
@@ -1,48 +1,33 @@
-import { Jimp, mkJGD } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, mkJGD } from "@jimp/test-utils";
+import configure from "@jimp/custom";
-import normalize from '../src';
+import normalize from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [normalize] }, Jimp);
-describe('Normalize', () => {
- it('change grayscale image', async () => {
- const image = await jimp.read(mkJGD('36▦', '6▦9', '▦9C'));
+describe("Normalize", () => {
+ it("change grayscale image", async () => {
+ const image = await jimp.read(mkJGD("36▦", "6▦9", "▦9C"));
- image
- .normalize()
- .getJGDSync()
- .should.be.sameJGD(mkJGD('■5▦', '5▦A', '▦A□'));
+ expectToBeJGD(image.normalize().getJGDSync(), mkJGD("■5▦", "5▦A", "▦A□"));
});
- it('change red/blue image', async () => {
+ it("change red/blue image", async () => {
const image = await jimp.read({
width: 3,
height: 2,
data: [
- 0x000000ff,
- 0x400022ff,
- 0x40002200,
- 0x400000ff,
- 0x000022ff,
- 0x800055ff
- ]
+ 0x000000ff, 0x400022ff, 0x40002200, 0x400000ff, 0x000022ff, 0x800055ff,
+ ],
});
- image
- .normalize()
- .getJGDSync()
- .should.be.sameJGD({
- width: 3,
- height: 2,
- data: [
- 0x000000ff,
- 0x7f0066ff,
- 0x7f006600,
- 0x7f0000ff,
- 0x000066ff,
- 0xff00ffff
- ]
- });
+ expectToBeJGD(image.normalize().getJGDSync(), {
+ width: 3,
+ height: 2,
+ data: [
+ 0x000000ff, 0x7f0066ff, 0x7f006600, 0x7f0000ff, 0x000066ff, 0xff00ffff,
+ ],
+ });
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md
index 8db97314..cb1f398a 100644
--- a/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md
@@ -1,3 +1,143 @@
+# v0.22.11 (Fri Feb 23 2024)
+
+:tada: This release contains work from a new contributor! :tada:
+
+Thank you, Rob Juurlink ([@kozmoz](https://github.com/kozmoz)), for all your work!
+
+#### 🚀 Enhancement
+
+- Add \n support for image.print #865 [#1265](https://github.com/jimp-dev/jimp/pull/1265) (juurr00@juurlink.org [@kozmoz](https://github.com/kozmoz) [@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 3
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- juurr00 (juurr00@juurlink.org)
+- Rob Juurlink ([@kozmoz](https://github.com/kozmoz))
+
+---
+
+# v0.22.9 (Wed Jul 26 2023)
+
+:tada: This release contains work from a new contributor! :tada:
+
+Thank you, Tim O. (macer) ([@gitmacer](https://github.com/gitmacer)), for all your work!
+
+#### 🚀 Enhancement
+
+- Add € to extended Fonts [#1249](https://github.com/jimp-dev/jimp/pull/1249) ([@gitmacer](https://github.com/gitmacer))
+
+#### Authors: 1
+
+- Tim O. (macer) ([@gitmacer](https://github.com/gitmacer))
+
+---
+
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.17.6 (Sat Feb 04 2023)
+
+#### 🐛 Bug Fix
+
+- Update ordering of overrides so ReturnType pulls correct typing. [#1077](https://github.com/jimp-dev/jimp/pull/1077) ([@dcbartlett](https://github.com/dcbartlett) [@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Dennis Bartlett ([@dcbartlett](https://github.com/dcbartlett))
+
+---
+
+# v0.17.2 (Sat Feb 04 2023)
+
+#### 🐛 Bug Fix
+
+- remove extra bm-font dep [#1134](https://github.com/jimp-dev/jimp/pull/1134) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.17.1 (Sat Feb 04 2023)
+
+#### 🐛 Bug Fix
+
+- use a consistent text layouting algorithm [#1133](https://github.com/jimp-dev/jimp/pull/1133) ([@iliazeus](https://github.com/iliazeus) [@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Ilia Pozdnyakov ([@iliazeus](https://github.com/iliazeus))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### 🐛 Bug Fix
+
+- Update README.md [#1120](https://github.com/jimp-dev/jimp/pull/1120) ([@mfuatnuroglu](https://github.com/mfuatnuroglu))
+
+#### ⚠️ Pushed to `main`
+
+- try this ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 2
+
+- [@mfuatnuroglu](https://github.com/mfuatnuroglu)
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -24,12 +164,12 @@
# v0.9.5 (Tue Mar 03 2020)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/plugin-print`
- Export font type [#838](https://github.com/oliver-moran/jimp/pull/838) ([@DomiR](https://github.com/DomiR))
-#### 📝 Documentation
+#### 📝 Documentation
- `@jimp/plugin-print`
- Added ttf2fnt.com to the list [#845](https://github.com/oliver-moran/jimp/pull/845) ([@mbejda](https://github.com/mbejda))
@@ -42,7 +182,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -50,4 +190,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-print/README.md b/project starter code/node_modules/@jimp/plugin-print/README.md
index ebbb1d31..4d395c87 100644
--- a/project starter code/node_modules/@jimp/plugin-print/README.md
+++ b/project starter code/node_modules/@jimp/plugin-print/README.md
@@ -9,7 +9,6 @@ Jimp supports basic typography using BMFont format (.fnt) even ones in different
Online tools are also available to convert TTF fonts to BMFont format. They can be used to create color font or sprite packs.
-
:star: [ttf2fnt](https://ttf2fnt.com/)
:star: [Littera](http://kvazars.com/littera/)
@@ -41,7 +40,7 @@ Loads a bitmap font from a file
- @returns {Promise} a promise
```js
-import Jimp from 'jimp';
+import Jimp from "jimp";
async function main() {
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
@@ -59,16 +58,17 @@ Draws a text on a image on a given boundary
- @param {number} y the y position to start drawing the text
- @param {string} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)
- @param {number} maxWidth (optional) the boundary width to draw in
-- @param {number} maxHeight (optional) the boundary height to draw in - @param {function(Error, Jimp)} cb (optional) a function to call when the text is written
+- @param {number} maxHeight (optional) the boundary height to draw in
+- @param {function(Error, Jimp)} cb (optional) a function to call when the text is written
```js
-import Jimp from 'jimp';
+import Jimp from "jimp";
async function main() {
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
const image = await Jimp.read(1000, 1000, 0x0000ffff);
- image.print(font, 10, 10, 'Hello World!');
+ image.print(font, 10, 10, "Hello World!");
}
main();
@@ -108,16 +108,16 @@ image.print(
x,
y,
{
- text: 'Hello world!',
+ text: "Hello world!",
alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER,
- alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE
+ alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE,
},
maxWidth,
maxHeight
);
```
-__Note__: although `maxWidth` and `maxHeight` parameters are optional to `print()`, they are needed to correctly align the text using the requested alignment mode.
+**Note**: although `maxWidth` and `maxHeight` parameters are optional to `print()`, they are needed to correctly align the text using the requested alignment mode.
#### Staggering Text
@@ -130,10 +130,10 @@ image.print(
font,
10,
10,
- 'Hello world that wraps!',
+ "Hello world that wraps!",
50,
(err, image, { x, y }) => {
- image.print(font, x, y + 20, 'More text on another line', 50);
+ image.print(font, x, y + 20, "More text on another line", 50);
}
);
```
@@ -143,13 +143,13 @@ image.print(
Measure how wide a piece of text will be.
```js
-import Jimp from 'jimp';
+import Jimp from "jimp";
async function main() {
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
const image = await Jimp.read(1000, 1000, 0x0000ffff);
- Jimp.measureText(font, 'Hello World!');
+ Jimp.measureText(font, "Hello World!");
}
main();
@@ -160,13 +160,13 @@ main();
Measure how tall a piece of text will be.
```js
-import Jimp from 'jimp';
+import Jimp from "jimp";
async function main() {
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
const image = await Jimp.read(1000, 1000, 0x0000ffff);
- Jimp.measureTextHeight(font, 'Hello World!', 100);
+ Jimp.measureTextHeight(font, "Hello World!", 100);
}
main();
diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/index.js b/project starter code/node_modules/@jimp/plugin-print/dist/index.js
index 8392c072..0615d1e2 100644
--- a/project starter code/node_modules/@jimp/plugin-print/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-print/dist/index.js
@@ -1,261 +1,189 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
-
-var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
-
+exports.default = void 0;
var _path = _interopRequireDefault(require("path"));
-
var _loadBmfont = _interopRequireDefault(require("load-bmfont"));
-
var _utils = require("@jimp/utils");
-
var _measureText = require("./measure-text");
-
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {
if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {
return 0;
}
-
if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {
return (maxWidth - (0, _measureText.measureText)(font, line)) / 2;
}
-
return maxWidth - (0, _measureText.measureText)(font, line);
}
-
-function drawCharacter(image, font, x, y, _char) {
- if (_char.width > 0 && _char.height > 0) {
- var characterPage = font.pages[_char.page];
- image.blit(characterPage, x + _char.xoffset, y + _char.yoffset, _char.x, _char.y, _char.width, _char.height);
+function drawCharacter(image, font, x, y, char) {
+ if (char.width > 0 && char.height > 0) {
+ const characterPage = font.pages[char.page];
+ image.blit(characterPage, x + char.xoffset, y + char.yoffset, char.x, char.y, char.width, char.height);
}
-
return image;
}
-
function printText(font, x, y, text, defaultCharWidth) {
- for (var i = 0; i < text.length; i++) {
- var _char2 = void 0;
-
+ for (let i = 0; i < text.length; i++) {
+ let char;
if (font.chars[text[i]]) {
- _char2 = text[i];
+ char = text[i];
} else if (/\s/.test(text[i])) {
- _char2 = '';
+ char = "";
} else {
- _char2 = '?';
+ char = "?";
}
-
- var fontChar = font.chars[_char2] || {};
- var fontKerning = font.kernings[_char2];
+ const fontChar = font.chars[char] || {};
+ const fontKerning = font.kernings[char];
drawCharacter(this, font, x, y, fontChar || {});
- var kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;
+ const kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;
x += kerning + (fontChar.xadvance || defaultCharWidth);
}
}
-
-function splitLines(font, text, maxWidth) {
- var words = text.split(' ');
- var lines = [];
- var currentLine = [];
- var longestLine = 0;
- words.forEach(function (word) {
- var line = [].concat((0, _toConsumableArray2["default"])(currentLine), [word]).join(' ');
- var length = (0, _measureText.measureText)(font, line);
-
- if (length <= maxWidth) {
- if (length > longestLine) {
- longestLine = length;
- }
-
- currentLine.push(word);
- } else {
- lines.push(currentLine);
- currentLine = [word];
- }
- });
- lines.push(currentLine);
- return {
- lines: lines,
- longestLine: longestLine
- };
-}
-
function loadPages(Jimp, dir, pages) {
- var newPages = pages.map(function (page) {
- return Jimp.read(dir + '/' + page);
+ const newPages = pages.map(page => {
+ return Jimp.read(dir + "/" + page);
});
return Promise.all(newPages);
}
-
-var dir = process.env.DIRNAME || "".concat(__dirname, "/../");
-
-var _default = function _default() {
- return {
- constants: {
- measureText: _measureText.measureText,
- measureTextHeight: _measureText.measureTextHeight,
- FONT_SANS_8_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'),
- FONT_SANS_10_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'),
- FONT_SANS_12_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'),
- FONT_SANS_14_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'),
- FONT_SANS_16_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'),
- FONT_SANS_32_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'),
- FONT_SANS_64_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'),
- FONT_SANS_128_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'),
- FONT_SANS_8_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'),
- FONT_SANS_16_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'),
- FONT_SANS_32_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'),
- FONT_SANS_64_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'),
- FONT_SANS_128_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'),
-
- /**
- * Loads a bitmap font from a file
- * @param {string} file the file path of a .fnt file
- * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded
- * @returns {Promise} a promise
- */
- loadFont: function loadFont(file, cb) {
- var _this = this;
-
- if (typeof file !== 'string') return _utils.throwError.call(this, 'file must be a string', cb);
- return new Promise(function (resolve, reject) {
- cb = cb || function (err, font) {
- if (err) reject(err);else resolve(font);
- };
-
- (0, _loadBmfont["default"])(file, function (err, font) {
- var chars = {};
- var kernings = {};
-
- if (err) {
- return _utils.throwError.call(_this, err, cb);
- }
-
- for (var i = 0; i < font.chars.length; i++) {
- chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];
- }
-
- for (var _i = 0; _i < font.kernings.length; _i++) {
- var firstString = String.fromCharCode(font.kernings[_i].first);
- kernings[firstString] = kernings[firstString] || {};
- kernings[firstString][String.fromCharCode(font.kernings[_i].second)] = font.kernings[_i].amount;
- }
-
- loadPages(_this, _path["default"].dirname(file), font.pages).then(function (pages) {
- cb(null, {
- chars: chars,
- kernings: kernings,
- pages: pages,
- common: font.common,
- info: font.info
- });
+const dir = process.env.DIRNAME || `${__dirname}/../`;
+var _default = () => ({
+ constants: {
+ measureText: _measureText.measureText,
+ measureTextHeight: _measureText.measureTextHeight,
+ FONT_SANS_8_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt"),
+ FONT_SANS_10_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt"),
+ FONT_SANS_12_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt"),
+ FONT_SANS_14_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt"),
+ FONT_SANS_16_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt"),
+ FONT_SANS_32_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt"),
+ FONT_SANS_64_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt"),
+ FONT_SANS_128_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt"),
+ FONT_SANS_8_WHITE: _path.default.join(dir, "fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt"),
+ FONT_SANS_16_WHITE: _path.default.join(dir, "fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt"),
+ FONT_SANS_32_WHITE: _path.default.join(dir, "fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt"),
+ FONT_SANS_64_WHITE: _path.default.join(dir, "fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt"),
+ FONT_SANS_128_WHITE: _path.default.join(dir, "fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt"),
+ /**
+ * Loads a bitmap font from a file
+ * @param {string} file the file path of a .fnt file
+ * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded
+ * @returns {Promise} a promise
+ */
+ loadFont(file, cb) {
+ if (typeof file !== "string") return _utils.throwError.call(this, "file must be a string", cb);
+ return new Promise((resolve, reject) => {
+ cb = cb || function (err, font) {
+ if (err) reject(err);else resolve(font);
+ };
+ (0, _loadBmfont.default)(file, (err, font) => {
+ const chars = {};
+ const kernings = {};
+ if (err) {
+ return _utils.throwError.call(this, err, cb);
+ }
+ for (let i = 0; i < font.chars.length; i++) {
+ chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];
+ }
+ for (let i = 0; i < font.kernings.length; i++) {
+ const firstString = String.fromCharCode(font.kernings[i].first);
+ kernings[firstString] = kernings[firstString] || {};
+ kernings[firstString][String.fromCharCode(font.kernings[i].second)] = font.kernings[i].amount;
+ }
+ loadPages(this, _path.default.dirname(file), font.pages).then(pages => {
+ cb(null, {
+ chars,
+ kernings,
+ pages,
+ common: font.common,
+ info: font.info
});
});
});
+ });
+ }
+ },
+ class: {
+ /**
+ * Draws a text on a image on a given boundary
+ * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command
+ * @param {number} x the x position to start drawing the text
+ * @param {number} y the y position to start drawing the text
+ * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)
+ * @param {number} maxWidth (optional) the boundary width to draw in
+ * @param {number} maxHeight (optional) the boundary height to draw in
+ * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written
+ * @returns {Jimp} this for chaining of methods
+ */
+ print(font, x, y, text, maxWidth, maxHeight, cb) {
+ if (typeof maxWidth === "function" && typeof cb === "undefined") {
+ cb = maxWidth;
+ maxWidth = Infinity;
}
- },
- "class": {
- /**
- * Draws a text on a image on a given boundary
- * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command
- * @param {number} x the x position to start drawing the text
- * @param {number} y the y position to start drawing the text
- * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)
- * @param {number} maxWidth (optional) the boundary width to draw in
- * @param {number} maxHeight (optional) the boundary height to draw in
- * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written
- * @returns {Jimp} this for chaining of methods
- */
- print: function print(font, x, y, text, maxWidth, maxHeight, cb) {
- var _this2 = this;
-
- if (typeof maxWidth === 'function' && typeof cb === 'undefined') {
- cb = maxWidth;
- maxWidth = Infinity;
- }
-
- if (typeof maxWidth === 'undefined') {
- maxWidth = Infinity;
- }
-
- if (typeof maxHeight === 'function' && typeof cb === 'undefined') {
- cb = maxHeight;
- maxHeight = Infinity;
- }
-
- if (typeof maxHeight === 'undefined') {
- maxHeight = Infinity;
- }
-
- if ((0, _typeof2["default"])(font) !== 'object') {
- return _utils.throwError.call(this, 'font must be a Jimp loadFont', cb);
- }
-
- if (typeof x !== 'number' || typeof y !== 'number' || typeof maxWidth !== 'number') {
- return _utils.throwError.call(this, 'x, y and maxWidth must be numbers', cb);
- }
-
- if (typeof maxWidth !== 'number') {
- return _utils.throwError.call(this, 'maxWidth must be a number', cb);
- }
-
- if (typeof maxHeight !== 'number') {
- return _utils.throwError.call(this, 'maxHeight must be a number', cb);
- }
-
- var alignmentX;
- var alignmentY;
-
- if ((0, _typeof2["default"])(text) === 'object' && text.text !== null && text.text !== undefined) {
- alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;
- alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;
- var _text = text;
- text = _text.text;
- } else {
- alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;
- alignmentY = this.constructor.VERTICAL_ALIGN_TOP;
- text = text.toString();
- }
-
- if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) {
- y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth);
- } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) {
- y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2;
- }
-
- var defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;
-
- var _splitLines = splitLines(font, text, maxWidth),
- lines = _splitLines.lines,
- longestLine = _splitLines.longestLine;
-
- lines.forEach(function (line) {
- var lineString = line.join(' ');
- var alignmentWidth = xOffsetBasedOnAlignment(_this2.constructor, font, lineString, maxWidth, alignmentX);
- printText.call(_this2, font, x + alignmentWidth, y, lineString, defaultCharWidth);
- y += font.common.lineHeight;
+ if (typeof maxWidth === "undefined") {
+ maxWidth = Infinity;
+ }
+ if (typeof maxHeight === "function" && typeof cb === "undefined") {
+ cb = maxHeight;
+ maxHeight = Infinity;
+ }
+ if (typeof maxHeight === "undefined") {
+ maxHeight = Infinity;
+ }
+ if (typeof font !== "object") {
+ return _utils.throwError.call(this, "font must be a Jimp loadFont", cb);
+ }
+ if (typeof x !== "number" || typeof y !== "number" || typeof maxWidth !== "number") {
+ return _utils.throwError.call(this, "x, y and maxWidth must be numbers", cb);
+ }
+ if (typeof maxWidth !== "number") {
+ return _utils.throwError.call(this, "maxWidth must be a number", cb);
+ }
+ if (typeof maxHeight !== "number") {
+ return _utils.throwError.call(this, "maxHeight must be a number", cb);
+ }
+ let alignmentX;
+ let alignmentY;
+ if (typeof text === "object" && text.text !== null && text.text !== undefined) {
+ alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;
+ alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;
+ ({
+ text
+ } = text);
+ } else {
+ alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;
+ alignmentY = this.constructor.VERTICAL_ALIGN_TOP;
+ text = text.toString();
+ }
+ if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) {
+ y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth);
+ } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) {
+ y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2;
+ }
+ const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;
+ const {
+ lines,
+ longestLine
+ } = (0, _measureText.splitLines)(font, text, maxWidth);
+ lines.forEach(line => {
+ const lineString = line.join(" ");
+ const alignmentWidth = xOffsetBasedOnAlignment(this.constructor, font, lineString, maxWidth, alignmentX);
+ printText.call(this, font, x + alignmentWidth, y, lineString, defaultCharWidth);
+ y += font.common.lineHeight;
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this, {
+ x: x + longestLine,
+ y
});
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this, {
- x: x + longestLine,
- y: y
- });
- }
-
- return this;
}
+ return this;
}
- };
-};
-
-exports["default"] = _default;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map
index e5583103..d9b5bbd4 100644
--- a/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","splitLines","words","split","lines","currentLine","longestLine","forEach","word","join","push","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","measureText","measureTextHeight","FONT_SANS_8_BLACK","Path","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","throwError","call","resolve","reject","err","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lineString","alignmentWidth","lineHeight"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,SAASA,uBAAT,CAAiCC,SAAjC,EAA4CC,IAA5C,EAAkDC,IAAlD,EAAwDC,QAAxD,EAAkEC,SAAlE,EAA6E;AAC3E,MAAIA,SAAS,KAAKJ,SAAS,CAACK,qBAA5B,EAAmD;AACjD,WAAO,CAAP;AACD;;AAED,MAAID,SAAS,KAAKJ,SAAS,CAACM,uBAA5B,EAAqD;AACnD,WAAO,CAACH,QAAQ,GAAG,8BAAYF,IAAZ,EAAkBC,IAAlB,CAAZ,IAAuC,CAA9C;AACD;;AAED,SAAOC,QAAQ,GAAG,8BAAYF,IAAZ,EAAkBC,IAAlB,CAAlB;AACD;;AAED,SAASK,aAAT,CAAuBC,KAAvB,EAA8BP,IAA9B,EAAoCQ,CAApC,EAAuCC,CAAvC,EAA0CC,KAA1C,EAAgD;AAC9C,MAAIA,KAAI,CAACC,KAAL,GAAa,CAAb,IAAkBD,KAAI,CAACE,MAAL,GAAc,CAApC,EAAuC;AACrC,QAAMC,aAAa,GAAGb,IAAI,CAACc,KAAL,CAAWJ,KAAI,CAACK,IAAhB,CAAtB;AAEAR,IAAAA,KAAK,CA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BANF;AASAZ,UAAAA,CAAC,IAAIT,IAAI,CAACsF,MAAL,CAAYiB,UAAjB;AACD,SApBD;;AAsBA,YAAI,0BAAchC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB,EAA0B;AAAEjE,YAAAA,CAAC,EAAEA,CAAC,GAAG4B,WAAT;AAAsB3B,YAAAA,CAAC,EAADA;AAAtB,WAA1B;AACD;;AAED,eAAO,IAAP;AACD;AA9GI;AA9Ga,GAAP;AAAA,C","sourcesContent":["import Path from 'path';\nimport bMFont from 'load-bmfont';\nimport { isNodePattern, throwError } from '@jimp/utils';\nimport { measureText, measureTextHeight } from './measure-text';\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = '';\n } else {\n char = '?';\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction splitLines(font, text, maxWidth) {\n const words = text.split(' ');\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach(word => {\n const line = [...currentLine, word].join(' ');\n const length = measureText(font, line);\n\n if (length <= maxWidth) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word];\n }\n });\n\n lines.push(currentLine);\n\n return {\n lines,\n longestLine\n };\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map(page => {\n return Jimp.read(dir + '/' + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== 'string')\n return throwError.call(this, 'file must be a string', cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function(err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then(pages => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info\n });\n });\n });\n });\n }\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === 'function' && typeof cb === 'undefined') {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === 'undefined') {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === 'function' && typeof cb === 'undefined') {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === 'undefined') {\n maxHeight = Infinity;\n }\n\n if (typeof font !== 'object') {\n return throwError.call(this, 'font must be a Jimp loadFont', cb);\n }\n\n if (\n typeof x !== 'number' ||\n typeof y !== 'number' ||\n typeof maxWidth !== 'number'\n ) {\n return throwError.call(this, 'x, y and maxWidth must be numbers', cb);\n }\n\n if (typeof maxWidth !== 'number') {\n return throwError.call(this, 'maxWidth must be a number', cb);\n }\n\n if (typeof maxHeight !== 'number') {\n return throwError.call(this, 'maxHeight must be a number', cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === 'object' &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach(line => {\n const lineString = line.join(' ');\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","measureText","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","measureTextHeight","FONT_SANS_8_BLACK","Path","join","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","throwError","call","resolve","reject","err","bMFont","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","class","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lines","longestLine","splitLines","forEach","lineString","alignmentWidth","lineHeight","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import Path from \"path\";\nimport bMFont from \"load-bmfont\";\nimport { isNodePattern, throwError } from \"@jimp/utils\";\nimport { measureText, measureTextHeight, splitLines } from \"./measure-text\";\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = \"\";\n } else {\n char = \"?\";\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map((page) => {\n return Jimp.read(dir + \"/\" + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt\"\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt\"\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt\"\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt\"\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt\"\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt\"\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt\"\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt\"\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt\"\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt\"\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt\"\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt\"\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt\"\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== \"string\")\n return throwError.call(this, \"file must be a string\", cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function (err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then((pages) => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info,\n });\n });\n });\n });\n },\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === \"function\" && typeof cb === \"undefined\") {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === \"undefined\") {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === \"function\" && typeof cb === \"undefined\") {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === \"undefined\") {\n maxHeight = Infinity;\n }\n\n if (typeof font !== \"object\") {\n return throwError.call(this, \"font must be a Jimp loadFont\", cb);\n }\n\n if (\n typeof x !== \"number\" ||\n typeof y !== \"number\" ||\n typeof maxWidth !== \"number\"\n ) {\n return throwError.call(this, \"x, y and maxWidth must be numbers\", cb);\n }\n\n if (typeof maxWidth !== \"number\") {\n return throwError.call(this, \"maxWidth must be a number\", cb);\n }\n\n if (typeof maxHeight !== \"number\") {\n return throwError.call(this, \"maxHeight must be a number\", cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === \"object\" &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach((line) => {\n const lineString = line.join(\" \");\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAA4E;AAE5E,SAASA,uBAAuB,CAACC,SAAS,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAE;EAC3E,IAAIA,SAAS,KAAKJ,SAAS,CAACK,qBAAqB,EAAE;IACjD,OAAO,CAAC;EACV;EAEA,IAAID,SAAS,KAAKJ,SAAS,CAACM,uBAAuB,EAAE;IACnD,OAAO,CAACH,QAAQ,GAAG,IAAAI,wBAAW,EAACN,IAAI,EAAEC,IAAI,CAAC,IAAI,CAAC;EACjD;EAEA,OAAOC,QAAQ,GAAG,IAAAI,wBAAW,EAACN,IAAI,EAAEC,IAAI,CAAC;AAC3C;AAEA,SAASM,aAAa,CAACC,KAAK,EAAER,IAAI,EAAES,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAE;EAC9C,IAAIA,IAAI,CAACC,KAAK,GAAG,CAAC,IAAID,IAAI,CAACE,MAAM,GAAG,CAAC,EAAE;IACrC,MAAMC,aAAa,GAAGd,IAAI,CAACe,KAAK,CAACJ,IAAI,CAACK,IAAI,CAAC;IAE3CR,KAAK,CAACS,IAAI,CACRH,aAAa,EACbL,CAAC,GAAGE,IAAI,CAACO,OAAO,EAChBR,CAAC,GAAGC,IAAI,CAACQ,OAAO,EAChBR,IAAI,CAACF,CAAC,EACNE,IAAI,CAACD,CAAC,EACNC,IAAI,CAACC,KAAK,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E,IAAI,EAAE;UAAEvD,CAAC,EAAEA,CAAC,GAAGsF,WAAW;UAAErF;QAAE,CAAC,CAAC;MACtD;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js b/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js
index b75ac795..85ec9380 100644
--- a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js
+++ b/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js
@@ -5,37 +5,45 @@ Object.defineProperty(exports, "__esModule", {
});
exports.measureText = measureText;
exports.measureTextHeight = measureTextHeight;
-
+exports.splitLines = splitLines;
function measureText(font, text) {
- var x = 0;
-
- for (var i = 0; i < text.length; i++) {
+ let x = 0;
+ for (let i = 0; i < text.length; i++) {
if (font.chars[text[i]]) {
- var kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0;
+ const kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0;
x += (font.chars[text[i]].xadvance || 0) + kerning;
}
}
-
return x;
}
-
-function measureTextHeight(font, text, maxWidth) {
- var words = text.split(' ');
- var line = '';
- var textTotalHeight = font.common.lineHeight;
-
- for (var n = 0; n < words.length; n++) {
- var testLine = line + words[n] + ' ';
- var testWidth = measureText(font, testLine);
-
- if (testWidth > maxWidth && n > 0) {
- textTotalHeight += font.common.lineHeight;
- line = words[n] + ' ';
+function splitLines(font, text, maxWidth) {
+ const words = text.replace(/[\r\n]+/g, " \n").split(" ");
+ const lines = [];
+ let currentLine = [];
+ let longestLine = 0;
+ words.forEach(word => {
+ const line = [...currentLine, word].join(" ");
+ const length = measureText(font, line);
+ if (length <= maxWidth && !word.includes("\n")) {
+ if (length > longestLine) {
+ longestLine = length;
+ }
+ currentLine.push(word);
} else {
- line = testLine;
+ lines.push(currentLine);
+ currentLine = [word.replace("\n", "")];
}
- }
-
- return textTotalHeight;
+ });
+ lines.push(currentLine);
+ return {
+ lines,
+ longestLine
+ };
+}
+function measureTextHeight(font, text, maxWidth) {
+ const {
+ lines
+ } = splitLines(font, text, maxWidth);
+ return lines.length * font.common.lineHeight;
}
//# sourceMappingURL=measure-text.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map b/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map
index 56209773..d8a9f5a4 100644
--- a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map
+++ b/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/measure-text.js"],"names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","measureTextHeight","maxWidth","words","split","line","textTotalHeight","common","lineHeight","n","testLine","testWidth"],"mappings":";;;;;;;;AAAO,SAASA,WAAT,CAAqBC,IAArB,EAA2BC,IAA3B,EAAiC;AACtC,MAAIC,CAAC,GAAG,CAAR;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,IAAI,CAACG,MAAzB,EAAiCD,CAAC,EAAlC,EAAsC;AACpC,QAAIH,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,CAAJ,EAAyB;AACvB,UAAMG,OAAO,GACXN,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,KAA0BH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CAA1B,GACIH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CADJ,GAEI,CAHN;AAKAD,MAAAA,CAAC,IAAI,CAACF,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,EAAoBK,QAApB,IAAgC,CAAjC,IAAsCF,OAA3C;AACD;AACF;;AAED,SAAOJ,CAAP;AACD;;AAEM,SAASO,iBAAT,CAA2BT,IAA3B,EAAiCC,IAAjC,EAAuCS,QAAvC,EAAiD;AACtD,MAAMC,KAAK,GAAGV,IAAI,CAACW,KAAL,CAAW,GAAX,CAAd;AACA,MAAIC,IAAI,GAAG,EAAX;AACA,MAAIC,eAAe,GAAGd,IAAI,CAACe,MAAL,CAAYC,UAAlC;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,KAAK,CAACP,MAA1B,EAAkCa,CAAC,EAAnC,EAAuC;AACrC,QAAMC,QAAQ,GAAGL,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAZ,GAAkB,GAAnC;AACA,QAAME,SAAS,GAAGpB,WAAW,CAACC,IAAD,EAAOkB,QAAP,CAA7B;;AAEA,QAAIC,SAAS,GAAGT,QAAZ,IAAwBO,CAAC,GAAG,CAAhC,EAAmC;AACjCH,MAAAA,eAAe,IAAId,IAAI,CAACe,MAAL,CAAYC,UAA/B;AACAH,MAAAA,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAL,GAAW,GAAlB;AACD,KAHD,MAGO;AACLJ,MAAAA,IAAI,GAAGK,QAAP;AACD;AACF;;AAED,SAAOJ,eAAP;AACD","sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const words = text.split(' ');\n let line = '';\n let textTotalHeight = font.common.lineHeight;\n\n for (let n = 0; n < words.length; n++) {\n const testLine = line + words[n] + ' ';\n const testWidth = measureText(font, testLine);\n\n if (testWidth > maxWidth && n > 0) {\n textTotalHeight += font.common.lineHeight;\n line = words[n] + ' ';\n } else {\n line = testLine;\n }\n }\n\n return textTotalHeight;\n}\n"],"file":"measure-text.js"}
\ No newline at end of file
+{"version":3,"file":"measure-text.js","names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","splitLines","maxWidth","words","replace","split","lines","currentLine","longestLine","forEach","word","line","join","includes","push","measureTextHeight","common","lineHeight"],"sources":["../src/measure-text.js"],"sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function splitLines(font, text, maxWidth) {\n const words = text.replace(/[\\r\\n]+/g, \" \\n\").split(\" \");\n\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach((word) => {\n const line = [...currentLine, word].join(\" \");\n const length = measureText(font, line);\n\n if (length <= maxWidth && !word.includes(\"\\n\")) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word.replace(\"\\n\", \"\")];\n }\n });\n lines.push(currentLine);\n return {\n lines,\n longestLine,\n };\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const { lines } = splitLines(font, text, maxWidth);\n\n return lines.length * font.common.lineHeight;\n}\n"],"mappings":";;;;;;;;AAAO,SAASA,WAAW,CAACC,IAAI,EAAEC,IAAI,EAAE;EACtC,IAAIC,CAAC,GAAG,CAAC;EAET,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACpC,IAAIH,IAAI,CAACK,KAAK,CAACJ,IAAI,CAACE,CAAC,CAAC,CAAC,EAAE;MACvB,MAAMG,OAAO,GACXN,IAA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,IAAI,EAAE,EAAE,CAAC,CAAC;IACxC;EACF,CAAC,CAAC;EACFE,KAAK,CAACQ,IAAI,CAACP,WAAW,CAAC;EACvB,OAAO;IACLD,KAAK;IACLE;EACF,CAAC;AACH;AAEO,SAASO,iBAAiB,CAACvB,IAAI,EAAEC,IAAI,EAAES,QAAQ,EAAE;EACtD,MAAM;IAAEI;EAAM,CAAC,GAAGL,UAAU,CAACT,IAAI,EAAEC,IAAI,EAAES,QAAQ,CAAC;EAElD,OAAOI,KAAK,CAACV,MAAM,GAAGJ,IAAI,CAACwB,MAAM,CAACC,UAAU;AAC9C"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-print/es/index.js b/project starter code/node_modules/@jimp/plugin-print/es/index.js
index 28011073..fe798370 100644
--- a/project starter code/node_modules/@jimp/plugin-print/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-print/es/index.js
@@ -1,260 +1,179 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
-
-var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
-
-var _path = _interopRequireDefault(require("path"));
-
-var _loadBmfont = _interopRequireDefault(require("load-bmfont"));
-
-var _utils = require("@jimp/utils");
-
-var _measureText = require("./measure-text");
-
+import Path from "path";
+import bMFont from "load-bmfont";
+import { isNodePattern, throwError } from "@jimp/utils";
+import { measureText, measureTextHeight, splitLines } from "./measure-text";
function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {
if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {
return 0;
}
-
if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {
- return (maxWidth - (0, _measureText.measureText)(font, line)) / 2;
+ return (maxWidth - measureText(font, line)) / 2;
}
-
- return maxWidth - (0, _measureText.measureText)(font, line);
+ return maxWidth - measureText(font, line);
}
-
-function drawCharacter(image, font, x, y, _char) {
- if (_char.width > 0 && _char.height > 0) {
- var characterPage = font.pages[_char.page];
- image.blit(characterPage, x + _char.xoffset, y + _char.yoffset, _char.x, _char.y, _char.width, _char.height);
+function drawCharacter(image, font, x, y, char) {
+ if (char.width > 0 && char.height > 0) {
+ const characterPage = font.pages[char.page];
+ image.blit(characterPage, x + char.xoffset, y + char.yoffset, char.x, char.y, char.width, char.height);
}
-
return image;
}
-
function printText(font, x, y, text, defaultCharWidth) {
- for (var i = 0; i < text.length; i++) {
- var _char2 = void 0;
-
+ for (let i = 0; i < text.length; i++) {
+ let char;
if (font.chars[text[i]]) {
- _char2 = text[i];
+ char = text[i];
} else if (/\s/.test(text[i])) {
- _char2 = '';
+ char = "";
} else {
- _char2 = '?';
+ char = "?";
}
-
- var fontChar = font.chars[_char2] || {};
- var fontKerning = font.kernings[_char2];
+ const fontChar = font.chars[char] || {};
+ const fontKerning = font.kernings[char];
drawCharacter(this, font, x, y, fontChar || {});
- var kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;
+ const kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;
x += kerning + (fontChar.xadvance || defaultCharWidth);
}
}
-
-function splitLines(font, text, maxWidth) {
- var words = text.split(' ');
- var lines = [];
- var currentLine = [];
- var longestLine = 0;
- words.forEach(function (word) {
- var line = [].concat((0, _toConsumableArray2["default"])(currentLine), [word]).join(' ');
- var length = (0, _measureText.measureText)(font, line);
-
- if (length <= maxWidth) {
- if (length > longestLine) {
- longestLine = length;
- }
-
- currentLine.push(word);
- } else {
- lines.push(currentLine);
- currentLine = [word];
- }
- });
- lines.push(currentLine);
- return {
- lines: lines,
- longestLine: longestLine
- };
-}
-
function loadPages(Jimp, dir, pages) {
- var newPages = pages.map(function (page) {
- return Jimp.read(dir + '/' + page);
+ const newPages = pages.map(page => {
+ return Jimp.read(dir + "/" + page);
});
return Promise.all(newPages);
}
-
-var dir = process.env.DIRNAME || "".concat(__dirname, "/../");
-
-var _default = function _default() {
- return {
- constants: {
- measureText: _measureText.measureText,
- measureTextHeight: _measureText.measureTextHeight,
- FONT_SANS_8_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'),
- FONT_SANS_10_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'),
- FONT_SANS_12_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'),
- FONT_SANS_14_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'),
- FONT_SANS_16_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'),
- FONT_SANS_32_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'),
- FONT_SANS_64_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'),
- FONT_SANS_128_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'),
- FONT_SANS_8_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'),
- FONT_SANS_16_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'),
- FONT_SANS_32_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'),
- FONT_SANS_64_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'),
- FONT_SANS_128_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'),
-
- /**
- * Loads a bitmap font from a file
- * @param {string} file the file path of a .fnt file
- * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded
- * @returns {Promise} a promise
- */
- loadFont: function loadFont(file, cb) {
- var _this = this;
-
- if (typeof file !== 'string') return _utils.throwError.call(this, 'file must be a string', cb);
- return new Promise(function (resolve, reject) {
- cb = cb || function (err, font) {
- if (err) reject(err);else resolve(font);
- };
-
- (0, _loadBmfont["default"])(file, function (err, font) {
- var chars = {};
- var kernings = {};
-
- if (err) {
- return _utils.throwError.call(_this, err, cb);
- }
-
- for (var i = 0; i < font.chars.length; i++) {
- chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];
- }
-
- for (var _i = 0; _i < font.kernings.length; _i++) {
- var firstString = String.fromCharCode(font.kernings[_i].first);
- kernings[firstString] = kernings[firstString] || {};
- kernings[firstString][String.fromCharCode(font.kernings[_i].second)] = font.kernings[_i].amount;
- }
-
- loadPages(_this, _path["default"].dirname(file), font.pages).then(function (pages) {
- cb(null, {
- chars: chars,
- kernings: kernings,
- pages: pages,
- common: font.common,
- info: font.info
- });
+const dir = process.env.DIRNAME || `${__dirname}/../`;
+export default (() => ({
+ constants: {
+ measureText,
+ measureTextHeight,
+ FONT_SANS_8_BLACK: Path.join(dir, "fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt"),
+ FONT_SANS_10_BLACK: Path.join(dir, "fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt"),
+ FONT_SANS_12_BLACK: Path.join(dir, "fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt"),
+ FONT_SANS_14_BLACK: Path.join(dir, "fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt"),
+ FONT_SANS_16_BLACK: Path.join(dir, "fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt"),
+ FONT_SANS_32_BLACK: Path.join(dir, "fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt"),
+ FONT_SANS_64_BLACK: Path.join(dir, "fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt"),
+ FONT_SANS_128_BLACK: Path.join(dir, "fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt"),
+ FONT_SANS_8_WHITE: Path.join(dir, "fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt"),
+ FONT_SANS_16_WHITE: Path.join(dir, "fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt"),
+ FONT_SANS_32_WHITE: Path.join(dir, "fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt"),
+ FONT_SANS_64_WHITE: Path.join(dir, "fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt"),
+ FONT_SANS_128_WHITE: Path.join(dir, "fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt"),
+ /**
+ * Loads a bitmap font from a file
+ * @param {string} file the file path of a .fnt file
+ * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded
+ * @returns {Promise} a promise
+ */
+ loadFont(file, cb) {
+ if (typeof file !== "string") return throwError.call(this, "file must be a string", cb);
+ return new Promise((resolve, reject) => {
+ cb = cb || function (err, font) {
+ if (err) reject(err);else resolve(font);
+ };
+ bMFont(file, (err, font) => {
+ const chars = {};
+ const kernings = {};
+ if (err) {
+ return throwError.call(this, err, cb);
+ }
+ for (let i = 0; i < font.chars.length; i++) {
+ chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];
+ }
+ for (let i = 0; i < font.kernings.length; i++) {
+ const firstString = String.fromCharCode(font.kernings[i].first);
+ kernings[firstString] = kernings[firstString] || {};
+ kernings[firstString][String.fromCharCode(font.kernings[i].second)] = font.kernings[i].amount;
+ }
+ loadPages(this, Path.dirname(file), font.pages).then(pages => {
+ cb(null, {
+ chars,
+ kernings,
+ pages,
+ common: font.common,
+ info: font.info
});
});
});
+ });
+ }
+ },
+ class: {
+ /**
+ * Draws a text on a image on a given boundary
+ * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command
+ * @param {number} x the x position to start drawing the text
+ * @param {number} y the y position to start drawing the text
+ * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)
+ * @param {number} maxWidth (optional) the boundary width to draw in
+ * @param {number} maxHeight (optional) the boundary height to draw in
+ * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written
+ * @returns {Jimp} this for chaining of methods
+ */
+ print(font, x, y, text, maxWidth, maxHeight, cb) {
+ if (typeof maxWidth === "function" && typeof cb === "undefined") {
+ cb = maxWidth;
+ maxWidth = Infinity;
+ }
+ if (typeof maxWidth === "undefined") {
+ maxWidth = Infinity;
+ }
+ if (typeof maxHeight === "function" && typeof cb === "undefined") {
+ cb = maxHeight;
+ maxHeight = Infinity;
+ }
+ if (typeof maxHeight === "undefined") {
+ maxHeight = Infinity;
}
- },
- "class": {
- /**
- * Draws a text on a image on a given boundary
- * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command
- * @param {number} x the x position to start drawing the text
- * @param {number} y the y position to start drawing the text
- * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)
- * @param {number} maxWidth (optional) the boundary width to draw in
- * @param {number} maxHeight (optional) the boundary height to draw in
- * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written
- * @returns {Jimp} this for chaining of methods
- */
- print: function print(font, x, y, text, maxWidth, maxHeight, cb) {
- var _this2 = this;
-
- if (typeof maxWidth === 'function' && typeof cb === 'undefined') {
- cb = maxWidth;
- maxWidth = Infinity;
- }
-
- if (typeof maxWidth === 'undefined') {
- maxWidth = Infinity;
- }
-
- if (typeof maxHeight === 'function' && typeof cb === 'undefined') {
- cb = maxHeight;
- maxHeight = Infinity;
- }
-
- if (typeof maxHeight === 'undefined') {
- maxHeight = Infinity;
- }
-
- if ((0, _typeof2["default"])(font) !== 'object') {
- return _utils.throwError.call(this, 'font must be a Jimp loadFont', cb);
- }
-
- if (typeof x !== 'number' || typeof y !== 'number' || typeof maxWidth !== 'number') {
- return _utils.throwError.call(this, 'x, y and maxWidth must be numbers', cb);
- }
-
- if (typeof maxWidth !== 'number') {
- return _utils.throwError.call(this, 'maxWidth must be a number', cb);
- }
-
- if (typeof maxHeight !== 'number') {
- return _utils.throwError.call(this, 'maxHeight must be a number', cb);
- }
-
- var alignmentX;
- var alignmentY;
-
- if ((0, _typeof2["default"])(text) === 'object' && text.text !== null && text.text !== undefined) {
- alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;
- alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;
- var _text = text;
- text = _text.text;
- } else {
- alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;
- alignmentY = this.constructor.VERTICAL_ALIGN_TOP;
- text = text.toString();
- }
-
- if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) {
- y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth);
- } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) {
- y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2;
- }
-
- var defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;
-
- var _splitLines = splitLines(font, text, maxWidth),
- lines = _splitLines.lines,
- longestLine = _splitLines.longestLine;
-
- lines.forEach(function (line) {
- var lineString = line.join(' ');
- var alignmentWidth = xOffsetBasedOnAlignment(_this2.constructor, font, lineString, maxWidth, alignmentX);
- printText.call(_this2, font, x + alignmentWidth, y, lineString, defaultCharWidth);
- y += font.common.lineHeight;
+ if (typeof font !== "object") {
+ return throwError.call(this, "font must be a Jimp loadFont", cb);
+ }
+ if (typeof x !== "number" || typeof y !== "number" || typeof maxWidth !== "number") {
+ return throwError.call(this, "x, y and maxWidth must be numbers", cb);
+ }
+ if (typeof maxWidth !== "number") {
+ return throwError.call(this, "maxWidth must be a number", cb);
+ }
+ if (typeof maxHeight !== "number") {
+ return throwError.call(this, "maxHeight must be a number", cb);
+ }
+ let alignmentX;
+ let alignmentY;
+ if (typeof text === "object" && text.text !== null && text.text !== undefined) {
+ alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;
+ alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;
+ ({
+ text
+ } = text);
+ } else {
+ alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;
+ alignmentY = this.constructor.VERTICAL_ALIGN_TOP;
+ text = text.toString();
+ }
+ if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) {
+ y += maxHeight - measureTextHeight(font, text, maxWidth);
+ } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) {
+ y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;
+ }
+ const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;
+ const {
+ lines,
+ longestLine
+ } = splitLines(font, text, maxWidth);
+ lines.forEach(line => {
+ const lineString = line.join(" ");
+ const alignmentWidth = xOffsetBasedOnAlignment(this.constructor, font, lineString, maxWidth, alignmentX);
+ printText.call(this, font, x + alignmentWidth, y, lineString, defaultCharWidth);
+ y += font.common.lineHeight;
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this, {
+ x: x + longestLine,
+ y
});
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this, {
- x: x + longestLine,
- y: y
- });
- }
-
- return this;
}
+ return this;
}
- };
-};
-
-exports["default"] = _default;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-print/es/index.js.map b/project starter code/node_modules/@jimp/plugin-print/es/index.js.map
index e5583103..c76733f4 100644
--- a/project starter code/node_modules/@jimp/plugin-print/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-print/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","splitLines","words","split","lines","currentLine","longestLine","forEach","word","join","push","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","measureText","measureTextHeight","FONT_SANS_8_BLACK","Path","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","throwError","call","resolve","reject","err","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lineString","alignmentWidth","lineHeight"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,SAASA,uBAAT,CAAiCC,SAAjC,EAA4CC,IAA5C,EAAkDC,IAAlD,EAAwDC,QAAxD,EAAkEC,SAAlE,EAA6E;AAC3E,MAAIA,SAAS,KAAKJ,SAAS,CAACK,qBAA5B,EAAmD;AACjD,WAAO,CAAP;AACD;;AAED,MAAID,SAAS,KAAKJ,SAAS,CAACM,uBAA5B,EAAqD;AACnD,WAAO,CAACH,QAAQ,GAAG,8BAAYF,IAAZ,EAAkBC,IAAlB,CAAZ,IAAuC,CAA9C;AACD;;AAED,SAAOC,QAAQ,GAAG,8BAAYF,IAAZ,EAAkBC,IAAlB,CAAlB;AACD;;AAED,SAASK,aAAT,CAAuBC,KAAvB,EAA8BP,IAA9B,EAAoCQ,CAApC,EAAuCC,CAAvC,EAA0CC,KAA1C,EAAgD;AAC9C,MAAIA,KAAI,CAACC,KAAL,GAAa,CAAb,IAAkBD,KAAI,CAACE,MAAL,GAAc,CAApC,EAAuC;AACrC,QAAMC,aAAa,GAAGb,IAAI,CAACc,KAAL,CAAWJ,KAAI,CAACK,IAAhB,CAAtB;AAEAR,IAAAA,KAAK,CAACS,IAAN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Z,UAAAA,CAAC,IAAIT,IAAI,CAACsF,MAAL,CAAYiB,UAAjB;AACD,SApBD;;AAsBA,YAAI,0BAAchC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB,EAA0B;AAAEjE,YAAAA,CAAC,EAAEA,CAAC,GAAG4B,WAAT;AAAsB3B,YAAAA,CAAC,EAADA;AAAtB,WAA1B;AACD;;AAED,eAAO,IAAP;AACD;AA9GI;AA9Ga,GAAP;AAAA,C","sourcesContent":["import Path from 'path';\nimport bMFont from 'load-bmfont';\nimport { isNodePattern, throwError } from '@jimp/utils';\nimport { measureText, measureTextHeight } from './measure-text';\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = '';\n } else {\n char = '?';\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction splitLines(font, text, maxWidth) {\n const words = text.split(' ');\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach(word => {\n const line = [...currentLine, word].join(' ');\n const length = measureText(font, line);\n\n if (length <= maxWidth) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word];\n }\n });\n\n lines.push(currentLine);\n\n return {\n lines,\n longestLine\n };\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map(page => {\n return Jimp.read(dir + '/' + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== 'string')\n return throwError.call(this, 'file must be a string', cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function(err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then(pages => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info\n });\n });\n });\n });\n }\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === 'function' && typeof cb === 'undefined') {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === 'undefined') {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === 'function' && typeof cb === 'undefined') {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === 'undefined') {\n maxHeight = Infinity;\n }\n\n if (typeof font !== 'object') {\n return throwError.call(this, 'font must be a Jimp loadFont', cb);\n }\n\n if (\n typeof x !== 'number' ||\n typeof y !== 'number' ||\n typeof maxWidth !== 'number'\n ) {\n return throwError.call(this, 'x, y and maxWidth must be numbers', cb);\n }\n\n if (typeof maxWidth !== 'number') {\n return throwError.call(this, 'maxWidth must be a number', cb);\n }\n\n if (typeof maxHeight !== 'number') {\n return throwError.call(this, 'maxHeight must be a number', cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === 'object' &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach(line => {\n const lineString = line.join(' ');\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["Path","bMFont","isNodePattern","throwError","measureText","measureTextHeight","splitLines","xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","FONT_SANS_8_BLACK","join","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","call","resolve","reject","err","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","class","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lines","longestLine","forEach","lineString","alignmentWidth","lineHeight"],"sources":["../src/index.js"],"sourcesContent":["import Path from \"path\";\nimport bMFont from \"load-bmfont\";\nimport { isNodePattern, throwError } from \"@jimp/utils\";\nimport { measureText, measureTextHeight, splitLines } from \"./measure-text\";\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = \"\";\n } else {\n char = \"?\";\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map((page) => {\n return Jimp.read(dir + \"/\" + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt\"\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt\"\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt\"\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt\"\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt\"\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt\"\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt\"\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt\"\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt\"\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt\"\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt\"\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt\"\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt\"\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== \"string\")\n return throwError.call(this, \"file must be a string\", cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function (err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then((pages) => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info,\n });\n });\n });\n });\n },\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === \"function\" && typeof cb === \"undefined\") {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === \"undefined\") {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === \"function\" && typeof cb === \"undefined\") {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === \"undefined\") {\n maxHeight = Infinity;\n }\n\n if (typeof font !== \"object\") {\n return throwError.call(this, \"font must be a Jimp loadFont\", cb);\n }\n\n if (\n typeof x !== \"number\" ||\n typeof y !== \"number\" ||\n typeof maxWidth !== \"number\"\n ) {\n return throwError.call(this, \"x, y and maxWidth must be numbers\", cb);\n }\n\n if (typeof maxWidth !== \"number\") {\n return throwError.call(this, \"maxWidth must be a number\", cb);\n }\n\n if (typeof maxHeight !== \"number\") {\n return throwError.call(this, \"maxHeight must be a number\", cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === \"object\" &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach((line) => {\n const lineString = line.join(\" \");\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n },\n },\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,MAAM,MAAM,aAAa;AAChC,SAASC,aAAa,EAAEC,UAAU,QAAQ,aAAa;AACvD,SAASC,WAAW,EAAEC,iBAAiB,EAAEC,UAAU,QAAQ,gBAAgB;AAE3E,SAASC,uBAAuB,CAACC,SAAS,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAE;EAC3E,IAAIA,SAAS,KAAKJ,SAAS,CAACK,qBAAqB,EAAE;IACjD,OAAO,CAAC;EACV;EAEA,IAAID,SAAS,KAAKJ,SAAS,CAACM,uBAAuB,EAAE;IACnD,OAAO,CAACH,QAAQ,GAAGP,WAAW,CAACK,IAAI,EAAEC,IAAI,CAAC,IAAI,CAAC;EACjD;EAEA,OAAOC,QAAQ,GAAGP,WAAW,CAACK,IAAI,EAAEC,IAAI,CAAC;AAC3C;AAEA,SAASK,aAAa,CAACC,KAAK,EAAEP,IAAI,EAAEQ,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAE;EAC9C,IAAIA,IAAI,CAACC,KAAK,GAAG,CAAC,IAAID,IAAI,CAACE,MAAM,GAAG,CAAC,EAAE;IACrC,MAAMC,aAAa,GAAGb,IAAI,CAACc,KAAK,CAACJ,IAAI,CAACK,IAAI,CAAC;IAE3CR,KAAK,CAACS,IAAI,CACRH,aAAa,EACbL,CAAC,GAAGE,IAAI,CAACO,OA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ACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;UAAEpD,CAAC,EAAEA,CAAC,GAAGkF,WAAW;UAAEjF;QAAE,CAAC,CAAC;MACtD;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js b/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js
index b75ac795..7d493bd4 100644
--- a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js
+++ b/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js
@@ -1,41 +1,41 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.measureText = measureText;
-exports.measureTextHeight = measureTextHeight;
-
-function measureText(font, text) {
- var x = 0;
-
- for (var i = 0; i < text.length; i++) {
+export function measureText(font, text) {
+ let x = 0;
+ for (let i = 0; i < text.length; i++) {
if (font.chars[text[i]]) {
- var kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0;
+ const kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0;
x += (font.chars[text[i]].xadvance || 0) + kerning;
}
}
-
return x;
}
-
-function measureTextHeight(font, text, maxWidth) {
- var words = text.split(' ');
- var line = '';
- var textTotalHeight = font.common.lineHeight;
-
- for (var n = 0; n < words.length; n++) {
- var testLine = line + words[n] + ' ';
- var testWidth = measureText(font, testLine);
-
- if (testWidth > maxWidth && n > 0) {
- textTotalHeight += font.common.lineHeight;
- line = words[n] + ' ';
+export function splitLines(font, text, maxWidth) {
+ const words = text.replace(/[\r\n]+/g, " \n").split(" ");
+ const lines = [];
+ let currentLine = [];
+ let longestLine = 0;
+ words.forEach(word => {
+ const line = [...currentLine, word].join(" ");
+ const length = measureText(font, line);
+ if (length <= maxWidth && !word.includes("\n")) {
+ if (length > longestLine) {
+ longestLine = length;
+ }
+ currentLine.push(word);
} else {
- line = testLine;
+ lines.push(currentLine);
+ currentLine = [word.replace("\n", "")];
}
- }
-
- return textTotalHeight;
+ });
+ lines.push(currentLine);
+ return {
+ lines,
+ longestLine
+ };
+}
+export function measureTextHeight(font, text, maxWidth) {
+ const {
+ lines
+ } = splitLines(font, text, maxWidth);
+ return lines.length * font.common.lineHeight;
}
//# sourceMappingURL=measure-text.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map b/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map
index 56209773..24304226 100644
--- a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map
+++ b/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/measure-text.js"],"names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","measureTextHeight","maxWidth","words","split","line","textTotalHeight","common","lineHeight","n","testLine","testWidth"],"mappings":";;;;;;;;AAAO,SAASA,WAAT,CAAqBC,IAArB,EAA2BC,IAA3B,EAAiC;AACtC,MAAIC,CAAC,GAAG,CAAR;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,IAAI,CAACG,MAAzB,EAAiCD,CAAC,EAAlC,EAAsC;AACpC,QAAIH,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,CAAJ,EAAyB;AACvB,UAAMG,OAAO,GACXN,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,KAA0BH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CAA1B,GACIH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CADJ,GAEI,CAHN;AAKAD,MAAAA,CAAC,IAAI,CAACF,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,EAAoBK,QAApB,IAAgC,CAAjC,IAAsCF,OAA3C;AACD;AACF;;AAED,SAAOJ,CAAP;AACD;;AAEM,SAASO,iBAAT,CAA2BT,IAA3B,EAAiCC,IAAjC,EAAuCS,QAAvC,EAAiD;AACtD,MAAMC,KAAK,GAAGV,IAAI,CAACW,KAAL,CAAW,GAAX,CAAd;AACA,MAAIC,IAAI,GAAG,EAAX;AACA,MAAIC,eAAe,GAAGd,IAAI,CAACe,MAAL,CAAYC,UAAlC;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,KAAK,CAACP,MAA1B,EAAkCa,CAAC,EAAnC,EAAuC;AACrC,QAAMC,QAAQ,GAAGL,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAZ,GAAkB,GAAnC;AACA,QAAME,SAAS,GAAGpB,WAAW,CAACC,IAAD,EAAOkB,QAAP,CAA7B;;AAEA,QAAIC,SAAS,GAAGT,QAAZ,IAAwBO,CAAC,GAAG,CAAhC,EAAmC;AACjCH,MAAAA,eAAe,IAAId,IAAI,CAACe,MAAL,CAAYC,UAA/B;AACAH,MAAAA,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAL,GAAW,GAAlB;AACD,KAHD,MAGO;AACLJ,MAAAA,IAAI,GAAGK,QAAP;AACD;AACF;;AAED,SAAOJ,eAAP;AACD","sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const words = text.split(' ');\n let line = '';\n let textTotalHeight = font.common.lineHeight;\n\n for (let n = 0; n < words.length; n++) {\n const testLine = line + words[n] + ' ';\n const testWidth = measureText(font, testLine);\n\n if (testWidth > maxWidth && n > 0) {\n textTotalHeight += font.common.lineHeight;\n line = words[n] + ' ';\n } else {\n line = testLine;\n }\n }\n\n return textTotalHeight;\n}\n"],"file":"measure-text.js"}
\ No newline at end of file
+{"version":3,"file":"measure-text.js","names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","splitLines","maxWidth","words","replace","split","lines","currentLine","longestLine","forEach","word","line","join","includes","push","measureTextHeight","common","lineHeight"],"sources":["../src/measure-text.js"],"sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function splitLines(font, text, maxWidth) {\n const words = text.replace(/[\\r\\n]+/g, \" \\n\").split(\" \");\n\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach((word) => {\n const line = [...currentLine, word].join(\" \");\n const length = measureText(font, line);\n\n if (length <= maxWidth && !word.includes(\"\\n\")) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word.replace(\"\\n\", \"\")];\n }\n });\n lines.push(currentLine);\n return {\n lines,\n longestLine,\n };\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const { lines } = splitLines(font, text, maxWidth);\n\n return lines.length * font.common.lineHeight;\n}\n"],"mappings":"AAAA,OAAO,SAASA,WAAW,CAACC,IAAI,EAAEC,IAAI,EAAE;EACtC,IAAIC,CAAC,GAAG,CAAC;EAET,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACpC,IAAIH,IAAI,CAACK,KAAK,CAACJ,IAAI,CAACE,CAAC,CAAC,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ACvBA,WAAW,GAAG,CAACG,IAAI,CAACN,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACxC;EACF,CAAC,CAAC;EACFE,KAAK,CAACQ,IAAI,CAACP,WAAW,CAAC;EACvB,OAAO;IACLD,KAAK;IACLE;EACF,CAAC;AACH;AAEA,OAAO,SAASO,iBAAiB,CAACvB,IAAI,EAAEC,IAAI,EAAES,QAAQ,EAAE;EACtD,MAAM;IAAEI;EAAM,CAAC,GAAGL,UAAU,CAACT,IAAI,EAAEC,IAAI,EAAES,QAAQ,CAAC;EAElD,OAAOI,KAAK,CAACV,MAAM,GAAGJ,IAAI,CAACwB,MAAM,CAACC,UAAU;AAC9C"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt
index 6175b9cb..2bb22b19 100644
--- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt
+++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt
@@ -4,7 +4,8 @@
-
+
+
@@ -193,7 +194,7 @@
-
+
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png
index 77cd5ed6..7e9986e2 100644
Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt
index 9c89b440..5e8811e6 100644
--- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt
+++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt
@@ -4,7 +4,8 @@
-
+
+
@@ -193,7 +194,7 @@
-
+
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png
index 461af9a0..64b949b1 100644
Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt
index 602a3a4e..afb29970 100644
--- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt
+++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt
@@ -1,10 +1,11 @@
-
+
-
+
+
@@ -193,7 +194,7 @@
-
+
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png
index 4f7e287b..99171bea 100644
Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt
index c78ccdce..2b6cbe79 100644
--- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt
+++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt
@@ -1,10 +1,11 @@
-
+
-
+
+
@@ -193,7 +194,7 @@
-
+
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png
index 039206cf..ccb1e3c9 100644
Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt
index 3733597b..f2d9bf4a 100644
--- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt
+++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt
@@ -1,10 +1,11 @@
-
+
-
+
+
@@ -193,7 +194,7 @@
-
+
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png
index a064a112..50ff1b41 100644
Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt
index 6b51c7c0..35c3584d 100644
--- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt
+++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt
@@ -1,10 +1,11 @@
-
+
-
+
+
@@ -193,7 +194,7 @@
-
+
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png
index 4ecce3e5..5900c354 100644
Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt
index 500c923e..f4580f3c 100644
--- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt
+++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt
@@ -4,7 +4,8 @@
-
+
+
@@ -193,7 +194,7 @@
-
+
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png
index 25fe95fe..47af5238 100644
Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt
index 19a72453..dca72ad3 100644
--- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt
+++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt
@@ -4,7 +4,8 @@
-
+
+
@@ -193,7 +194,7 @@
-
+
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png
index 1baf1f50..de9a88aa 100644
Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt
index 15b6be3a..34f0e621 100644
--- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt
+++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt
@@ -1,10 +1,11 @@
-
+
-
+
+
@@ -193,7 +194,7 @@
-
+
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png
index 71a55514..b0579858 100644
Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt
index 3264cc42..6d437678 100644
--- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt
+++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt
@@ -4,7 +4,8 @@
-
+
+
@@ -193,7 +194,7 @@
-
+
diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png
index ed1eb48b..435f6d5e 100644
Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/index.d.ts b/project starter code/node_modules/@jimp/plugin-print/index.d.ts
index 5d0273bb..d906616d 100644
--- a/project starter code/node_modules/@jimp/plugin-print/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-print/index.d.ts
@@ -1,4 +1,4 @@
-import { GenericCallback, ImageCallback } from '@jimp/core';
+import { GenericCallback, ImageCallback } from "@jimp/core";
export interface FontChar {
id: number;
@@ -57,10 +57,10 @@ export interface Font {
type PrintableText =
| any
| {
- text: string;
- alignmentX: number;
- alignmentY: number;
-};
+ text: string;
+ alignmentX: number;
+ alignmentY: number;
+ };
interface PrintClass {
// Text methods
@@ -93,7 +93,11 @@ interface PrintClass {
interface Print {
constants: {
measureText(font: Font, text: PrintableText): number;
- measureTextHeight(font: Font, text: PrintableText, maxWidth: number): number;
+ measureTextHeight(
+ font: Font,
+ text: PrintableText,
+ maxWidth: number
+ ): number;
// Font locations
FONT_SANS_8_BLACK: string;
@@ -111,11 +115,11 @@ interface Print {
FONT_SANS_64_WHITE: string;
FONT_SANS_128_WHITE: string;
- loadFont(file: string): Promise;
loadFont(file: string, cb: GenericCallback): Promise;
+ loadFont(file: string): Promise;
}
- class: PrintClass
+ class: PrintClass;
}
-export default function(): Print;
+export default function (): Print;
diff --git a/project starter code/node_modules/@jimp/plugin-print/package.json b/project starter code/node_modules/@jimp/plugin-print/package.json
index e48e4e63..240ff6cb 100644
--- a/project starter code/node_modules/@jimp/plugin-print/package.json
+++ b/project starter code/node_modules/@jimp/plugin-print/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-print",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "print an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,21 +21,20 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
- "load-bmfont": "^1.4.0"
+ "@jimp/utils": "^0.22.12",
+ "load-bmfont": "^1.4.1"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
"@jimp/plugin-blit": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/plugin-blit": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/plugin-blit": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-print/src/index.js b/project starter code/node_modules/@jimp/plugin-print/src/index.js
index c8e97936..baf8a5c4 100644
--- a/project starter code/node_modules/@jimp/plugin-print/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-print/src/index.js
@@ -1,7 +1,7 @@
-import Path from 'path';
-import bMFont from 'load-bmfont';
-import { isNodePattern, throwError } from '@jimp/utils';
-import { measureText, measureTextHeight } from './measure-text';
+import Path from "path";
+import bMFont from "load-bmfont";
+import { isNodePattern, throwError } from "@jimp/utils";
+import { measureText, measureTextHeight, splitLines } from "./measure-text";
function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {
if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {
@@ -40,9 +40,9 @@ function printText(font, x, y, text, defaultCharWidth) {
if (font.chars[text[i]]) {
char = text[i];
} else if (/\s/.test(text[i])) {
- char = '';
+ char = "";
} else {
- char = '?';
+ char = "?";
}
const fontChar = font.chars[char] || {};
@@ -57,39 +57,9 @@ function printText(font, x, y, text, defaultCharWidth) {
}
}
-function splitLines(font, text, maxWidth) {
- const words = text.split(' ');
- const lines = [];
- let currentLine = [];
- let longestLine = 0;
-
- words.forEach(word => {
- const line = [...currentLine, word].join(' ');
- const length = measureText(font, line);
-
- if (length <= maxWidth) {
- if (length > longestLine) {
- longestLine = length;
- }
-
- currentLine.push(word);
- } else {
- lines.push(currentLine);
- currentLine = [word];
- }
- });
-
- lines.push(currentLine);
-
- return {
- lines,
- longestLine
- };
-}
-
function loadPages(Jimp, dir, pages) {
- const newPages = pages.map(page => {
- return Jimp.read(dir + '/' + page);
+ const newPages = pages.map((page) => {
+ return Jimp.read(dir + "/" + page);
});
return Promise.all(newPages);
@@ -103,56 +73,56 @@ export default () => ({
measureTextHeight,
FONT_SANS_8_BLACK: Path.join(
dir,
- 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'
+ "fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt"
),
FONT_SANS_10_BLACK: Path.join(
dir,
- 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'
+ "fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt"
),
FONT_SANS_12_BLACK: Path.join(
dir,
- 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'
+ "fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt"
),
FONT_SANS_14_BLACK: Path.join(
dir,
- 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'
+ "fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt"
),
FONT_SANS_16_BLACK: Path.join(
dir,
- 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'
+ "fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt"
),
FONT_SANS_32_BLACK: Path.join(
dir,
- 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'
+ "fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt"
),
FONT_SANS_64_BLACK: Path.join(
dir,
- 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'
+ "fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt"
),
FONT_SANS_128_BLACK: Path.join(
dir,
- 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'
+ "fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt"
),
FONT_SANS_8_WHITE: Path.join(
dir,
- 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'
+ "fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt"
),
FONT_SANS_16_WHITE: Path.join(
dir,
- 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'
+ "fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt"
),
FONT_SANS_32_WHITE: Path.join(
dir,
- 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'
+ "fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt"
),
FONT_SANS_64_WHITE: Path.join(
dir,
- 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'
+ "fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt"
),
FONT_SANS_128_WHITE: Path.join(
dir,
- 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'
+ "fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt"
),
/**
@@ -162,13 +132,13 @@ export default () => ({
* @returns {Promise} a promise
*/
loadFont(file, cb) {
- if (typeof file !== 'string')
- return throwError.call(this, 'file must be a string', cb);
+ if (typeof file !== "string")
+ return throwError.call(this, "file must be a string", cb);
return new Promise((resolve, reject) => {
cb =
cb ||
- function(err, font) {
+ function (err, font) {
if (err) reject(err);
else resolve(font);
};
@@ -193,18 +163,18 @@ export default () => ({
] = font.kernings[i].amount;
}
- loadPages(this, Path.dirname(file), font.pages).then(pages => {
+ loadPages(this, Path.dirname(file), font.pages).then((pages) => {
cb(null, {
chars,
kernings,
pages,
common: font.common,
- info: font.info
+ info: font.info,
});
});
});
});
- }
+ },
},
class: {
@@ -220,49 +190,49 @@ export default () => ({
* @returns {Jimp} this for chaining of methods
*/
print(font, x, y, text, maxWidth, maxHeight, cb) {
- if (typeof maxWidth === 'function' && typeof cb === 'undefined') {
+ if (typeof maxWidth === "function" && typeof cb === "undefined") {
cb = maxWidth;
maxWidth = Infinity;
}
- if (typeof maxWidth === 'undefined') {
+ if (typeof maxWidth === "undefined") {
maxWidth = Infinity;
}
- if (typeof maxHeight === 'function' && typeof cb === 'undefined') {
+ if (typeof maxHeight === "function" && typeof cb === "undefined") {
cb = maxHeight;
maxHeight = Infinity;
}
- if (typeof maxHeight === 'undefined') {
+ if (typeof maxHeight === "undefined") {
maxHeight = Infinity;
}
- if (typeof font !== 'object') {
- return throwError.call(this, 'font must be a Jimp loadFont', cb);
+ if (typeof font !== "object") {
+ return throwError.call(this, "font must be a Jimp loadFont", cb);
}
if (
- typeof x !== 'number' ||
- typeof y !== 'number' ||
- typeof maxWidth !== 'number'
+ typeof x !== "number" ||
+ typeof y !== "number" ||
+ typeof maxWidth !== "number"
) {
- return throwError.call(this, 'x, y and maxWidth must be numbers', cb);
+ return throwError.call(this, "x, y and maxWidth must be numbers", cb);
}
- if (typeof maxWidth !== 'number') {
- return throwError.call(this, 'maxWidth must be a number', cb);
+ if (typeof maxWidth !== "number") {
+ return throwError.call(this, "maxWidth must be a number", cb);
}
- if (typeof maxHeight !== 'number') {
- return throwError.call(this, 'maxHeight must be a number', cb);
+ if (typeof maxHeight !== "number") {
+ return throwError.call(this, "maxHeight must be a number", cb);
}
let alignmentX;
let alignmentY;
if (
- typeof text === 'object' &&
+ typeof text === "object" &&
text.text !== null &&
text.text !== undefined
) {
@@ -290,8 +260,8 @@ export default () => ({
const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;
const { lines, longestLine } = splitLines(font, text, maxWidth);
- lines.forEach(line => {
- const lineString = line.join(' ');
+ lines.forEach((line) => {
+ const lineString = line.join(" ");
const alignmentWidth = xOffsetBasedOnAlignment(
this.constructor,
font,
@@ -317,6 +287,6 @@ export default () => ({
}
return this;
- }
- }
+ },
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js b/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js
index bf14bed8..c1790881 100644
--- a/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js
+++ b/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js
@@ -15,22 +15,37 @@ export function measureText(font, text) {
return x;
}
-export function measureTextHeight(font, text, maxWidth) {
- const words = text.split(' ');
- let line = '';
- let textTotalHeight = font.common.lineHeight;
+export function splitLines(font, text, maxWidth) {
+ const words = text.replace(/[\r\n]+/g, " \n").split(" ");
+
+ const lines = [];
+ let currentLine = [];
+ let longestLine = 0;
- for (let n = 0; n < words.length; n++) {
- const testLine = line + words[n] + ' ';
- const testWidth = measureText(font, testLine);
+ words.forEach((word) => {
+ const line = [...currentLine, word].join(" ");
+ const length = measureText(font, line);
- if (testWidth > maxWidth && n > 0) {
- textTotalHeight += font.common.lineHeight;
- line = words[n] + ' ';
+ if (length <= maxWidth && !word.includes("\n")) {
+ if (length > longestLine) {
+ longestLine = length;
+ }
+
+ currentLine.push(word);
} else {
- line = testLine;
+ lines.push(currentLine);
+ currentLine = [word.replace("\n", "")];
}
- }
+ });
+ lines.push(currentLine);
+ return {
+ lines,
+ longestLine,
+ };
+}
+
+export function measureTextHeight(font, text, maxWidth) {
+ const { lines } = splitLines(font, text, maxWidth);
- return textTotalHeight;
+ return lines.length * font.common.lineHeight;
}
diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/with-newlines.png b/project starter code/node_modules/@jimp/plugin-print/test/images/with-newlines.png
new file mode 100644
index 00000000..8da2d115
Binary files /dev/null and b/project starter code/node_modules/@jimp/plugin-print/test/images/with-newlines.png differ
diff --git a/project starter code/node_modules/@jimp/plugin-print/test/print.test.js b/project starter code/node_modules/@jimp/plugin-print/test/print.test.js
index 36a16669..dee02fea 100644
--- a/project starter code/node_modules/@jimp/plugin-print/test/print.test.js
+++ b/project starter code/node_modules/@jimp/plugin-print/test/print.test.js
@@ -1,10 +1,11 @@
/* eslint key-spacing: ["error", { "align": "value" }] */
-import { Jimp, getTestDir, hasOwnProp } from '@jimp/test-utils';
-import configure from '@jimp/custom';
-import blit from '@jimp/plugin-blit';
+import { Jimp, getTestDir, hasOwnProp } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import blit from "@jimp/plugin-blit";
+import expect from "@storybook/expect";
-import print from '../src';
+import print from "../src";
const jimp = configure({ plugins: [print, blit] }, Jimp);
@@ -20,7 +21,7 @@ async function createTextImage(
return image.print(loadedFont, x, y, text, maxWidth, maxHeight);
}
-describe('Write text over image', function() {
+describe("Write text over image", function () {
this.timeout(30000);
const fontDefs = {
@@ -34,229 +35,230 @@ describe('Write text over image', function() {
SANS_16_WHITE: { w: 54, h: 54, bg: 0x000000ff },
SANS_32_WHITE: { w: 114, h: 114, bg: 0x000000ff },
- SANS_64_WHITE: { w: 220, h: 220, bg: 0x000000ff }
+ SANS_64_WHITE: { w: 220, h: 220, bg: 0x000000ff },
};
for (const fontName in fontDefs)
if (hasOwnProp(fontDefs, fontName))
((fontName, conf) => {
- it('Jimp preset ' + fontName + ' bitmap font', async () => {
- const font = await jimp.loadFont(Jimp['FONT_' + fontName]);
+ it("Jimp preset " + fontName + " bitmap font", async () => {
+ const font = await jimp.loadFont(Jimp["FONT_" + fontName]);
const expected =
- getTestDir(__dirname) + '/images/' + fontName + '.png';
+ getTestDir(__dirname) + "/images/" + fontName + ".png";
const expectedImg = await Jimp.read(expected);
const image = await Jimp.create(conf.w, conf.h, conf.bg);
- image
- .print(font, 0, 0, 'This is only a test.', image.bitmap.width)
- .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(
+ image.print(font, 0, 0, "This is only a test.", image.bitmap.width)
+ .bitmap.data
+ ).toEqual(expectedImg.bitmap.data);
});
})(fontName, fontDefs[fontName]);
- it('Jimp preset SANS_16_BLACK bitmap font positioned', async () => {
+ it("Jimp preset SANS_16_BLACK bitmap font positioned", async () => {
const font = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK);
const expected =
- getTestDir(__dirname) + '/images/SANS_16_BLACK-positioned.png';
+ getTestDir(__dirname) + "/images/SANS_16_BLACK-positioned.png";
const expectedImg = await Jimp.read(expected);
- const image = await Jimp.create('300', '100', 0xff8800ff);
+ const image = await Jimp.create("300", "100", 0xff8800ff);
- image
- .print(font, 150, 50, 'This is only a test.', 100)
- .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(
+ image.print(font, 150, 50, "This is only a test.", 100).bitmap.data
+ ).toEqual(expectedImg.bitmap.data);
});
- it('Jimp loads font from URL', async () => {
+ it("Jimp loads font from URL", async () => {
const font = await Jimp.loadFont(
- 'https://raw.githubusercontent.com/oliver-moran/jimp/master/packages/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'
+ "https://raw.githubusercontent.com/jimp-dev/jimp/main/packages/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt"
);
const expected =
- getTestDir(__dirname) + '/images/SANS_16_BLACK-positioned.png';
+ getTestDir(__dirname) + "/images/SANS_16_BLACK-positioned.png";
const expectedImg = await Jimp.read(expected);
- const image = await Jimp.create('300', '100', 0xff8800ff);
+ const image = await Jimp.create("300", "100", 0xff8800ff);
- image
- .print(font, 150, 50, 'This is only a test.', 100)
- .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(
+ image.print(font, 150, 50, "This is only a test.", 100).bitmap.data
+ ).toEqual(expectedImg.bitmap.data);
});
- it('Jimp renders ? for unknown characters', async () => {
+ it("Jimp renders ? for unknown characters", async () => {
const font = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK);
- const expected = getTestDir(__dirname) + '/images/unknown-char-test.png';
+ const expected = getTestDir(__dirname) + "/images/unknown-char-test.png";
const expectedImg = await Jimp.read(expected);
- const image = await Jimp.read('300', '100', 0xff8800ff);
+ const image = await Jimp.read("300", "100", 0xff8800ff);
- image
- .print(font, 0, 0, 'ツ ツ ツ', 100)
- .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(image.print(font, 0, 0, "ツ ツ ツ", 100).bitmap.data).toEqual(
+ expectedImg.bitmap.data
+ );
});
- it('Jimp can print numbers too', async () => {
+ it("Jimp can print numbers too", async () => {
const font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK);
- const expected = getTestDir(__dirname) + '/images/print-number.png';
+ const expected = getTestDir(__dirname) + "/images/print-number.png";
const expectedImg = await Jimp.read(expected);
- const image = await Jimp.read('300', '100', 0xff8800ff);
+ const image = await Jimp.read("300", "100", 0xff8800ff);
- image
- .print(font, 0, 0, 12345678, 100)
- .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(image.print(font, 0, 0, 12345678, 100).bitmap.data).toEqual(
+ expectedImg.bitmap.data
+ );
});
- it('left-align text by default', async () => {
+ it("left-align text by default", async () => {
const expectedImage = await Jimp.read(
- getTestDir(__dirname) + '/images/left-aligned.png'
+ getTestDir(__dirname) + "/images/left-aligned.png"
);
const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, {
- text: 'This is only a test.',
+ text: "This is only a test.",
- maxWidth: 100
+ maxWidth: 100,
});
- expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data);
+ expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
- it('left-align text by default when passing object', async () => {
+ it("left-align text by default when passing object", async () => {
const expectedImage = await Jimp.read(
- getTestDir(__dirname) + '/images/left-aligned.png'
+ getTestDir(__dirname) + "/images/left-aligned.png"
);
const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, {
- text: { text: 'This is only a test.' },
+ text: { text: "This is only a test." },
- maxWidth: 100
+ maxWidth: 100,
});
- expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data);
+ expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
- it('left-align text when passing object with alignmentX', async () => {
+ it("left-align text when passing object with alignmentX", async () => {
const expectedImage = await Jimp.read(
- getTestDir(__dirname) + '/images/left-aligned.png'
+ getTestDir(__dirname) + "/images/left-aligned.png"
);
const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, {
text: {
- text: 'This is only a test.',
+ text: "This is only a test.",
- alignmentX: Jimp.HORIZONTAL_ALIGN_LEFT
+ alignmentX: Jimp.HORIZONTAL_ALIGN_LEFT,
},
- maxWidth: 100
+ maxWidth: 100,
});
- expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data);
+ expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
- it('center-align text when passing object with alignmentX', async () => {
+ it("center-align text when passing object with alignmentX", async () => {
const expectedImage = await Jimp.read(
- getTestDir(__dirname) + '/images/center-aligned.png'
+ getTestDir(__dirname) + "/images/center-aligned.png"
);
const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, {
text: {
- text: 'This is only a test.',
+ text: "This is only a test.",
- alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER
+ alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER,
},
- maxWidth: 100
+ maxWidth: 100,
});
- expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data);
+ expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
- it('right-align text when passing object with alignmentX', async () => {
+ it("right-align text when passing object with alignmentX", async () => {
const expectedImage = await Jimp.read(
- getTestDir(__dirname) + '/images/right-aligned.png'
+ getTestDir(__dirname) + "/images/right-aligned.png"
);
const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, {
text: {
- text: 'This is only a test.',
+ text: "This is only a test.",
- alignmentX: Jimp.HORIZONTAL_ALIGN_RIGHT
+ alignmentX: Jimp.HORIZONTAL_ALIGN_RIGHT,
},
- maxWidth: 100
+ maxWidth: 100,
});
- expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data);
+ expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
- it('middle-align text when passing object with alignmentY', async () => {
+ it("middle-align text when passing object with alignmentY", async () => {
const expectedImage = await Jimp.read(
- getTestDir(__dirname) + '/images/middle-aligned.png'
+ getTestDir(__dirname) + "/images/middle-aligned.png"
);
const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, {
text: {
- text: 'This is only a test.',
+ text: "This is only a test.",
- alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE
+ alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE,
},
maxWidth: 100,
- maxHeight: 240
+ maxHeight: 240,
});
- expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data);
+ expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
- it('middle-align text when passing object with alignmentY can offset y', async () => {
+ it("middle-align text when passing object with alignmentY can offset y", async () => {
const expectedImage = await Jimp.read(
- getTestDir(__dirname) + '/images/middle-aligned-y.png'
+ getTestDir(__dirname) + "/images/middle-aligned-y.png"
);
const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, {
y: 50,
text: {
- text: 'This is only a test.',
+ text: "This is only a test.",
- alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE
+ alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE,
},
maxWidth: 100,
- maxHeight: 240
+ maxHeight: 240,
});
- expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data);
+ expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
- it('bottom-align text when passing object with alignmentY', async () => {
+ it("bottom-align text when passing object with alignmentY", async () => {
const expectedImage = await Jimp.read(
- getTestDir(__dirname) + '/images/bottom-aligned.png'
+ getTestDir(__dirname) + "/images/bottom-aligned.png"
);
const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, {
text: {
- text: 'This is only a test.',
+ text: "This is only a test.",
- alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM
+ alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM,
},
maxWidth: 100,
- maxHeight: 240
+ maxHeight: 240,
});
- expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data);
+ expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
- it('bottom-align text when passing object with alignmentY offset y', async () => {
+ it("bottom-align text when passing object with alignmentY offset y", async () => {
const expectedImage = await Jimp.read(
- getTestDir(__dirname) + '/images/bottom-aligned-y.png'
+ getTestDir(__dirname) + "/images/bottom-aligned-y.png"
);
const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, {
y: 100,
text: {
- text: 'This is only a test.',
+ text: "This is only a test.",
- alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM
+ alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM,
},
maxWidth: 100,
- maxHeight: 100
+ maxHeight: 100,
});
- expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data);
+ expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
- it('exposes print y position in cb', async () => {
+ it("exposes print y position in cb", async () => {
const expectedImage = await Jimp.read(
- getTestDir(__dirname) + '/images/spacing.png'
+ getTestDir(__dirname) + "/images/spacing.png"
);
const loadedFont = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK);
@@ -266,19 +268,44 @@ describe('Write text over image', function() {
loadedFont,
0,
0,
- 'One two three four fix six seven eight nine ten eleven twelve',
+ "One two three four fix six seven eight nine ten eleven twelve",
250,
(err, image, { x, y }) => {
image.print(
loadedFont,
x,
y + 50,
- 'thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty',
+ "thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty",
250
);
}
);
- expectedImage.bitmap.data.should.be.deepEqual(image.bitmap.data);
+ expect(image.bitmap.data).toEqual(expectedImage.bitmap.data);
+ });
+
+ it("measureText is consistent with measureTextWidth", async () => {
+ const font = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK);
+
+ const text = "n n n";
+ const width = jimp.measureText(font, text);
+ const height = jimp.measureTextHeight(font, text, width);
+ const lineHeight = jimp.measureTextHeight(font, text, Infinity);
+
+ expect(height).toEqual(lineHeight);
+ });
+
+ it("text with newlines, default alignment", async () => {
+ const expectedImage = await Jimp.read(
+ getTestDir(__dirname) + "/images/with-newlines.png"
+ );
+
+ const textImage = await createTextImage(100, 240, Jimp.FONT_SANS_16_BLACK, {
+ text: "This \nis only \na \ntest.",
+
+ maxWidth: 300,
+ });
+
+ expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md
index 26394e0f..d50c15d9 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md
@@ -1,3 +1,94 @@
+# v0.22.5 (Tue Feb 21 2023)
+
+:tada: This release contains work from a new contributor! :tada:
+
+Thank you, Charly Poirier ([@charlypoirier](https://github.com/charlypoirier)), for all your work!
+
+#### 🐛 Bug Fix
+
+- Fix resizing issue with Jimp.AUTO [#1202](https://github.com/jimp-dev/jimp/pull/1202) ([@charlypoirier](https://github.com/charlypoirier))
+
+#### Authors: 1
+
+- Charly Poirier ([@charlypoirier](https://github.com/charlypoirier))
+
+---
+
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- delete CLI package [#1162](https://github.com/jimp-dev/jimp/pull/1162) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.2 (Sun Feb 05 2023)
+
+#### 🐛 Bug Fix
+
+- Change some exports to move towards more ESM compatibility [#1154](https://github.com/jimp-dev/jimp/pull/1154) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 1
+
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +103,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +111,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-resize/README.md b/project starter code/node_modules/@jimp/plugin-resize/README.md
index 9185cc83..a74dbdff 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/README.md
+++ b/project starter code/node_modules/@jimp/plugin-resize/README.md
@@ -15,17 +15,17 @@ Resizes the image to a set width and height using a 2-pass bilinear algorithm/
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- // Read the image.
- const image = await jimp.read('test/image.png');
+ // Read the image.
+ const image = await jimp.read("test/image.png");
- // Resize the image to width 150 and auto height.
- await image.resize(150, jimp.AUTO);
+ // Resize the image to width 150 and auto height.
+ await image.resize(150, jimp.AUTO);
- // Save and overwrite the image
- await image.writeAsync('test/image.png');
+ // Save and overwrite the image
+ await image.writeAsync("test/image.png");
}
main();
diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js b/project starter code/node_modules/@jimp/plugin-resize/dist/index.js
index 8d645992..cfbd3bde 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-resize/dist/index.js
@@ -1,96 +1,79 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
var _resize = _interopRequireDefault(require("./modules/resize"));
-
var _resize2 = _interopRequireDefault(require("./modules/resize2"));
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+var _default = () => ({
+ constants: {
+ RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor",
+ RESIZE_BILINEAR: "bilinearInterpolation",
+ RESIZE_BICUBIC: "bicubicInterpolation",
+ RESIZE_HERMITE: "hermiteInterpolation",
+ RESIZE_BEZIER: "bezierInterpolation"
+ },
+ class: {
+ /**
+ * Resizes the image to a set width and height using a 2-pass bilinear algorithm
+ * @param {number} w the width to resize the image to (or Jimp.AUTO)
+ * @param {number} h the height to resize the image to (or Jimp.AUTO)
+ * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ resize(w, h, mode, cb) {
+ if (typeof w !== "number" || typeof h !== "number") {
+ return _utils.throwError.call(this, "w and h must be numbers", cb);
+ }
+ if (typeof mode === "function" && typeof cb === "undefined") {
+ cb = mode;
+ mode = null;
+ }
+ if (w === this.constructor.AUTO && h === this.constructor.AUTO) {
+ return _utils.throwError.call(this, "w and h cannot both be set to auto", cb);
+ }
+ if (w === this.constructor.AUTO) {
+ w = this.bitmap.width * (h / this.bitmap.height);
+ }
+ if (h === this.constructor.AUTO) {
+ h = this.bitmap.height * (w / this.bitmap.width);
+ }
+ if (w < 0 || h < 0) {
+ return _utils.throwError.call(this, "w and h must be positive numbers", cb);
+ }
-var _default = function _default() {
- return {
- constants: {
- RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor',
- RESIZE_BILINEAR: 'bilinearInterpolation',
- RESIZE_BICUBIC: 'bicubicInterpolation',
- RESIZE_HERMITE: 'hermiteInterpolation',
- RESIZE_BEZIER: 'bezierInterpolation'
- },
- "class": {
- /**
- * Resizes the image to a set width and height using a 2-pass bilinear algorithm
- * @param {number} w the width to resize the image to (or Jimp.AUTO)
- * @param {number} h the height to resize the image to (or Jimp.AUTO)
- * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- resize: function resize(w, h, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers', cb);
- }
-
- if (typeof mode === 'function' && typeof cb === 'undefined') {
- cb = mode;
- mode = null;
- }
-
- if (w === this.constructor.AUTO && h === this.constructor.AUTO) {
- return _utils.throwError.call(this, 'w and h cannot both be set to auto', cb);
- }
-
- if (w === this.constructor.AUTO) {
- w = this.bitmap.width * (h / this.bitmap.height);
- }
-
- if (h === this.constructor.AUTO) {
- h = this.bitmap.height * (w / this.bitmap.width);
- }
-
- if (w < 0 || h < 0) {
- return _utils.throwError.call(this, 'w and h must be positive numbers', cb);
- } // round inputs
-
-
- w = Math.round(w);
- h = Math.round(h);
-
- if (typeof _resize2["default"][mode] === 'function') {
- var dst = {
- data: Buffer.alloc(w * h * 4),
- width: w,
- height: h
- };
-
- _resize2["default"][mode](this.bitmap, dst);
-
- this.bitmap = dst;
- } else {
- var image = this;
- var resize = new _resize["default"](this.bitmap.width, this.bitmap.height, w, h, true, true, function (buffer) {
- image.bitmap.data = Buffer.from(buffer);
- image.bitmap.width = w;
- image.bitmap.height = h;
- });
- resize.resize(this.bitmap.data);
- }
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+ // round inputs
+ w = Math.round(w) || 1;
+ h = Math.round(h) || 1;
+ if (typeof _resize2.default[mode] === "function") {
+ const dst = {
+ data: Buffer.alloc(w * h * 4),
+ width: w,
+ height: h
+ };
+ _resize2.default[mode](this.bitmap, dst);
+ this.bitmap = dst;
+ } else {
+ const image = this;
+ const resize = new _resize.default(this.bitmap.width, this.bitmap.height, w, h, true, true, buffer => {
+ image.bitmap.data = Buffer.from(buffer);
+ image.bitmap.width = w;
+ image.bitmap.height = h;
+ });
+ resize.resize(this.bitmap.data);
}
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
}
- };
-};
-
-exports["default"] = _default;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map
index 36caf764..a2a30459 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","resize","w","h","mode","cb","throwError","call","constructor","AUTO","bitmap","width","height","Math","round","Res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BA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtEI;AATa,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nimport Resize from './modules/resize';\nimport Resize2 from './modules/resize2';\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor',\n RESIZE_BILINEAR: 'bilinearInterpolation',\n RESIZE_BICUBIC: 'bicubicInterpolation',\n RESIZE_HERMITE: 'hermiteInterpolation',\n RESIZE_BEZIER: 'bezierInterpolation'\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, 'w and h cannot both be set to auto', cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, 'w and h must be positive numbers', cb);\n }\n\n // round inputs\n w = Math.round(w);\n h = Math.round(h);\n\n if (typeof Resize2[mode] === 'function') {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n buffer => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","class","resize","w","h","mode","cb","throwError","call","constructor","AUTO","bitmap","width","height","Math","round","Resize2","dst","data","Buffer","alloc","image","Resize","buffer","from","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nimport Resize from \"./modules/resize\";\nimport Resize2 from \"./modules/resize2\";\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: \"nearestNeighbor\",\n RESIZE_BILINEAR: \"bilinearInterpolation\",\n RESIZE_BICUBIC: \"bicubicInterpolation\",\n RESIZE_HERMITE: \"hermiteInterpolation\",\n RESIZE_BEZIER: \"bezierInterpolation\",\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, \"w and h cannot both be set to auto\", cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, \"w and h must be positive numbers\", cb);\n }\n\n // round inputs\n w = Math.round(w) || 1;\n h = Math.round(h) || 1;\n\n if (typeof Resize2[mode] === \"function\") {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h,\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n (buffer) => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AAAwC;AAAA,eAEzB,OAAO;EACpBA,SAAS,EAAE;IACTC,uBAAuB,EAAE,iBAAiB;IAC1CC,eAAe,EAAE,uBAAuB;IACxCC,cAAc,EAAE,sBAAsB;IACtCC,cAAc,EAAE,sBAAsB;IACtCC,aAAa,EAAE;EACjB,CAAC;EAEDC,KAAK,EAAE;IACL;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,MAAM,CAACC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAEC,EAAE,EAAE;MACrB,IAAI,OAAOH,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;QAClD,OAAOG,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;MAC7D;MAEA,IAAI,OAAOD,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;QAC3DA,EAAE,GAAGD,IAAI;QACTA,IAAI,GAAG,IAAI;MACb;MAEA,IAAIF,CAAC,KAAK,IAAI,CAACM,WAAW,CAACC,IAAI,IAAIN,CAAC,KAA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jB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClBV,CAAC,EACDC,CAAC,EACD,IAAI,EACJ,IAAI,EACHmB,MAAM,IAAK;UACVF,KAAK,CAACV,MAAM,CAACO,IAAI,GAAGC,MAAM,CAACK,IAAI,CAACD,MAAM,CAAC;UACvCF,KAAK,CAACV,MAAM,CAACC,KAAK,GAAGT,CAAC;UACtBkB,KAAK,CAACV,MAAM,CAACE,MAAM,GAAGT,CAAC;QACzB,CAAC,CACF;QACDF,MAAM,CAACA,MAAM,CAAC,IAAI,CAACS,MAAM,CAACO,IAAI,CAAC;MACjC;MAEA,IAAI,IAAAO,oBAAa,EAACnB,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js
index 8dbb005b..a0e0c47a 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js
+++ b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js
@@ -1,7 +1,12 @@
"use strict";
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
// JavaScript Image Resizer (c) 2012 - Grant Galitz
// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4
+
function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendAlpha, interpolationPass, resizeCallback) {
this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);
this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);
@@ -9,7 +14,7 @@ function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendA
this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);
this.colorChannels = blendAlpha ? 4 : 3;
this.interpolationPass = Boolean(interpolationPass);
- this.resizeCallback = typeof resizeCallback === 'function' ? resizeCallback : function () {};
+ this.resizeCallback = typeof resizeCallback === "function" ? resizeCallback : function () {};
this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;
this.originalWidthMultipliedByChannels = this.widthOriginal * this.colorChannels;
this.originalHeightMultipliedByChannels = this.heightOriginal * this.colorChannels;
@@ -17,16 +22,14 @@ function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendA
this.finalResultSize = this.targetWidthMultipliedByChannels * this.targetHeight;
this.initialize();
}
-
Resize.prototype.initialize = function () {
// Perform some checks:
if (this.widthOriginal > 0 && this.heightOriginal > 0 && this.targetWidth > 0 && this.targetHeight > 0) {
this.configurePasses();
} else {
- throw new Error('Invalid settings specified for the resizer.');
+ throw new Error("Invalid settings specified for the resizer.");
}
};
-
Resize.prototype.configurePasses = function () {
if (this.widthOriginal === this.targetWidth) {
// Bypass the width resizer pass:
@@ -34,7 +37,6 @@ Resize.prototype.configurePasses = function () {
} else {
// Setup the width resizer pass:
this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;
-
if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {
this.initializeFirstPassBuffers(true);
this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthInterpolatedRGBA : this.resizeWidthInterpolatedRGB;
@@ -43,14 +45,12 @@ Resize.prototype.configurePasses = function () {
this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;
}
}
-
if (this.heightOriginal === this.targetHeight) {
// Bypass the height resizer pass:
this.resizeHeight = this.bypassResizer;
} else {
// Setup the height resizer pass:
this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;
-
if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {
this.initializeSecondPassBuffers(true);
this.resizeHeight = this.resizeHeightInterpolated;
@@ -60,18 +60,18 @@ Resize.prototype.configurePasses = function () {
}
}
};
-
Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthChannel) {
- var channelsNum = fourthChannel ? 4 : 3;
- var ratioWeight = this.ratioWeightWidthPass;
- var outputBuffer = this.widthBuffer;
- var weight = 0;
- var finalOffset = 0;
- var pixelOffset = 0;
- var firstWeight = 0;
- var secondWeight = 0;
- var targetPosition; // Handle for only one interpolation input being valid for start calculation:
-
+ const channelsNum = fourthChannel ? 4 : 3;
+ const ratioWeight = this.ratioWeightWidthPass;
+ const outputBuffer = this.widthBuffer;
+ let weight = 0;
+ let finalOffset = 0;
+ let pixelOffset = 0;
+ let firstWeight = 0;
+ let secondWeight = 0;
+ let targetPosition;
+
+ // Handle for only one interpolation input being valid for start calculation:
for (targetPosition = 0; weight < 1 / 3; targetPosition += channelsNum, weight += ratioWeight) {
for (finalOffset = targetPosition, pixelOffset = 0; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) {
outputBuffer[finalOffset] = buffer[pixelOffset];
@@ -79,26 +79,25 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthC
outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];
if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];
}
- } // Adjust for overshoot of the last pass's counter:
-
+ }
+ // Adjust for overshoot of the last pass's counter:
weight -= 1 / 3;
- var interpolationWidthSourceReadStop;
-
+ let interpolationWidthSourceReadStop;
for (interpolationWidthSourceReadStop = this.widthOriginal - 1; weight < interpolationWidthSourceReadStop; targetPosition += channelsNum, weight += ratioWeight) {
// Calculate weightings:
secondWeight = weight % 1;
- firstWeight = 1 - secondWeight; // Interpolate:
-
+ firstWeight = 1 - secondWeight;
+ // Interpolate:
for (finalOffset = targetPosition, pixelOffset = Math.floor(weight) * channelsNum; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) {
outputBuffer[finalOffset + 0] = buffer[pixelOffset + 0] * firstWeight + buffer[pixelOffset + channelsNum + 0] * secondWeight;
outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1] * firstWeight + buffer[pixelOffset + channelsNum + 1] * secondWeight;
outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2] * firstWeight + buffer[pixelOffset + channelsNum + 2] * secondWeight;
if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3] * firstWeight + buffer[pixelOffset + channelsNum + 3] * secondWeight;
}
- } // Handle for only one interpolation input being valid for end calculation:
-
+ }
+ // Handle for only one interpolation input being valid for end calculation:
for (interpolationWidthSourceReadStop = this.originalWidthMultipliedByChannels - channelsNum; targetPosition < this.targetWidthMultipliedByChannels; targetPosition += channelsNum) {
for (finalOffset = targetPosition, pixelOffset = interpolationWidthSourceReadStop; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) {
outputBuffer[finalOffset] = buffer[pixelOffset];
@@ -107,66 +106,57 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthC
if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];
}
}
-
return outputBuffer;
};
-
Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {
- var channelsNum = fourthChannel ? 4 : 3;
- var ratioWeight = this.ratioWeightWidthPass;
- var ratioWeightDivisor = 1 / ratioWeight;
- var nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1;
- var nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1;
- var output = this.outputWidthWorkBench;
- var outputBuffer = this.widthBuffer;
- var trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;
- var weight = 0;
- var amountToNext = 0;
- var actualPosition = 0;
- var currentPosition = 0;
- var line = 0;
- var pixelOffset = 0;
- var outputOffset = 0;
- var multiplier = 1;
- var r = 0;
- var g = 0;
- var b = 0;
- var a = 0;
-
+ const channelsNum = fourthChannel ? 4 : 3;
+ const ratioWeight = this.ratioWeightWidthPass;
+ const ratioWeightDivisor = 1 / ratioWeight;
+ const nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1;
+ const nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1;
+ const output = this.outputWidthWorkBench;
+ const outputBuffer = this.widthBuffer;
+ const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;
+ let weight = 0;
+ let amountToNext = 0;
+ let actualPosition = 0;
+ let currentPosition = 0;
+ let line = 0;
+ let pixelOffset = 0;
+ let outputOffset = 0;
+ let multiplier = 1;
+ let r = 0;
+ let g = 0;
+ let b = 0;
+ let a = 0;
do {
for (line = 0; line < this.originalHeightMultipliedByChannels;) {
output[line++] = 0;
output[line++] = 0;
output[line++] = 0;
-
if (fourthChannel) {
output[line++] = 0;
trustworthyColorsCount[line / channelsNum - 1] = 0;
}
}
-
weight = ratioWeight;
-
do {
amountToNext = 1 + actualPosition - currentPosition;
multiplier = Math.min(weight, amountToNext);
-
for (line = 0, pixelOffset = actualPosition; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetOriginalWidth) {
r = buffer[pixelOffset];
g = buffer[++pixelOffset];
b = buffer[++pixelOffset];
- a = fourthChannel ? buffer[++pixelOffset] : 255; // Ignore RGB values if pixel is completely transparent
-
+ a = fourthChannel ? buffer[++pixelOffset] : 255;
+ // Ignore RGB values if pixel is completely transparent
output[line++] += (a ? r : 0) * multiplier;
output[line++] += (a ? g : 0) * multiplier;
output[line++] += (a ? b : 0) * multiplier;
-
if (fourthChannel) {
output[line++] += a * multiplier;
trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;
}
}
-
if (weight >= amountToNext) {
actualPosition += channelsNum;
currentPosition = actualPosition;
@@ -176,7 +166,6 @@ Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {
break;
}
} while (weight > 0 && actualPosition < this.originalWidthMultipliedByChannels);
-
for (line = 0, pixelOffset = outputOffset; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetTargetWidth) {
weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;
multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor;
@@ -185,67 +174,57 @@ Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {
outputBuffer[++pixelOffset] = output[line++] * multiplier;
if (fourthChannel) outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;
}
-
outputOffset += channelsNum;
} while (outputOffset < this.targetWidthMultipliedByChannels);
-
return outputBuffer;
};
-
Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {
- var ratioWeight = this.ratioWeightHeightPass;
- var ratioWeightDivisor = 1 / ratioWeight;
- var output = this.outputHeightWorkBench;
- var outputBuffer = this.heightBuffer;
- var trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;
- var weight = 0;
- var amountToNext = 0;
- var actualPosition = 0;
- var currentPosition = 0;
- var pixelOffset = 0;
- var outputOffset = 0;
- var caret = 0;
- var multiplier = 1;
- var r = 0;
- var g = 0;
- var b = 0;
- var a = 0;
-
+ const ratioWeight = this.ratioWeightHeightPass;
+ const ratioWeightDivisor = 1 / ratioWeight;
+ const output = this.outputHeightWorkBench;
+ const outputBuffer = this.heightBuffer;
+ const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;
+ let weight = 0;
+ let amountToNext = 0;
+ let actualPosition = 0;
+ let currentPosition = 0;
+ let pixelOffset = 0;
+ let outputOffset = 0;
+ let caret = 0;
+ let multiplier = 1;
+ let r = 0;
+ let g = 0;
+ let b = 0;
+ let a = 0;
do {
for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {
output[pixelOffset++] = 0;
output[pixelOffset++] = 0;
output[pixelOffset++] = 0;
-
if (fourthChannel) {
output[pixelOffset++] = 0;
trustworthyColorsCount[pixelOffset / 4 - 1] = 0;
}
}
-
weight = ratioWeight;
-
do {
amountToNext = 1 + actualPosition - currentPosition;
multiplier = Math.min(weight, amountToNext);
caret = actualPosition;
-
for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {
r = buffer[caret++];
g = buffer[caret++];
b = buffer[caret++];
- a = fourthChannel ? buffer[caret++] : 255; // Ignore RGB values if pixel is completely transparent
-
+ a = fourthChannel ? buffer[caret++] : 255;
+ // Ignore RGB values if pixel is completely transparent
output[pixelOffset++] += (a ? r : 0) * multiplier;
output[pixelOffset++] += (a ? g : 0) * multiplier;
output[pixelOffset++] += (a ? b : 0) * multiplier;
-
if (fourthChannel) {
output[pixelOffset++] += a * multiplier;
trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;
}
}
-
if (weight >= amountToNext) {
actualPosition = caret;
currentPosition = actualPosition;
@@ -255,126 +234,105 @@ Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {
break;
}
} while (weight > 0 && actualPosition < this.widthPassResultSize);
-
for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {
weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;
multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor;
outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier);
outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier);
outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier);
-
if (fourthChannel) {
outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * ratioWeightDivisor);
}
}
} while (outputOffset < this.finalResultSize);
-
return outputBuffer;
};
-
Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) {
return this._resizeWidthInterpolatedRGBChannels(buffer, false);
};
-
Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) {
return this._resizeWidthInterpolatedRGBChannels(buffer, true);
};
-
Resize.prototype.resizeWidthRGB = function (buffer) {
return this._resizeWidthRGBChannels(buffer, false);
};
-
Resize.prototype.resizeWidthRGBA = function (buffer) {
return this._resizeWidthRGBChannels(buffer, true);
};
-
Resize.prototype.resizeHeightInterpolated = function (buffer) {
- var ratioWeight = this.ratioWeightHeightPass;
- var outputBuffer = this.heightBuffer;
- var weight = 0;
- var finalOffset = 0;
- var pixelOffset = 0;
- var pixelOffsetAccumulated = 0;
- var pixelOffsetAccumulated2 = 0;
- var firstWeight = 0;
- var secondWeight = 0;
- var interpolationHeightSourceReadStop; // Handle for only one interpolation input being valid for start calculation:
-
+ const ratioWeight = this.ratioWeightHeightPass;
+ const outputBuffer = this.heightBuffer;
+ let weight = 0;
+ let finalOffset = 0;
+ let pixelOffset = 0;
+ let pixelOffsetAccumulated = 0;
+ let pixelOffsetAccumulated2 = 0;
+ let firstWeight = 0;
+ let secondWeight = 0;
+ let interpolationHeightSourceReadStop;
+
+ // Handle for only one interpolation input being valid for start calculation:
for (; weight < 1 / 3; weight += ratioWeight) {
for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {
outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);
}
- } // Adjust for overshoot of the last pass's counter:
-
+ }
+ // Adjust for overshoot of the last pass's counter:
weight -= 1 / 3;
-
for (interpolationHeightSourceReadStop = this.heightOriginal - 1; weight < interpolationHeightSourceReadStop; weight += ratioWeight) {
// Calculate weightings:
secondWeight = weight % 1;
- firstWeight = 1 - secondWeight; // Interpolate:
-
+ firstWeight = 1 - secondWeight;
+ // Interpolate:
pixelOffsetAccumulated = Math.floor(weight) * this.targetWidthMultipliedByChannels;
pixelOffsetAccumulated2 = pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;
-
for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) {
outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++] * firstWeight + buffer[pixelOffsetAccumulated2++] * secondWeight);
}
- } // Handle for only one interpolation input being valid for end calculation:
-
+ }
+ // Handle for only one interpolation input being valid for end calculation:
while (finalOffset < this.finalResultSize) {
for (pixelOffset = 0, pixelOffsetAccumulated = interpolationHeightSourceReadStop * this.targetWidthMultipliedByChannels; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) {
outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++]);
}
}
-
return outputBuffer;
};
-
Resize.prototype.resizeHeightRGB = function (buffer) {
return this._resizeHeightRGBChannels(buffer, false);
};
-
Resize.prototype.resizeHeightRGBA = function (buffer) {
return this._resizeHeightRGBChannels(buffer, true);
};
-
Resize.prototype.resize = function (buffer) {
this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));
};
-
Resize.prototype.bypassResizer = function (buffer) {
// Just return the buffer passed:
return buffer;
};
-
Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) {
// Initialize the internal width pass buffers:
this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);
-
if (!BILINEARAlgo) {
this.outputWidthWorkBench = this.generateFloatBuffer(this.originalHeightMultipliedByChannels);
-
if (this.colorChannels > 3) {
this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.heightOriginal);
}
}
};
-
Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) {
// Initialize the internal height pass buffers:
this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);
-
if (!BILINEARAlgo) {
this.outputHeightWorkBench = this.generateFloatBuffer(this.targetWidthMultipliedByChannels);
-
if (this.colorChannels > 3) {
this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.targetWidth);
}
}
};
-
Resize.prototype.generateFloatBuffer = function (bufferLength) {
// Generate a float32 typed array buffer:
try {
@@ -383,7 +341,6 @@ Resize.prototype.generateFloatBuffer = function (bufferLength) {
return [];
}
};
-
Resize.prototype.generateFloat64Buffer = function (bufferLength) {
// Generate a float64 typed array buffer:
try {
@@ -392,7 +349,6 @@ Resize.prototype.generateFloat64Buffer = function (bufferLength) {
return [];
}
};
-
Resize.prototype.generateUint8Buffer = function (bufferLength) {
// Generate a uint8 typed array buffer:
try {
@@ -401,6 +357,8 @@ Resize.prototype.generateUint8Buffer = function (bufferLength) {
return [];
}
};
-
-module.exports = Resize;
+var _default = Resize;
+exports.default = _default;
+module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=resize.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map
index 39e5ae34..1e35b5d3 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map
+++ b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/modules/resize.js"],"names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array","module","exports"],"mappings":";;AAAA;AACA;AAEA,SAASA,MAAT,CACEC,aADF,EAEEC,cAFF,EAGEC,WAHF,EAIEC,YAJF,EAKEC,UALF,EAMEC,iBANF,EAOEC,cAPF,EAQE;AACA,OAAKN,aAAL,GAAqBO,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWT,aAAX,KAA6B,CAAtC,CAArB;AACA,OAAKC,cAAL,GAAsBM,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWR,cAAX,KAA8B,CAAvC,CAAtB;AACA,OAAKC,WAAL,GAAmBK,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWP,WAAX,KAA2B,CAApC,CAAnB;AACA,OAAKC,YAAL,GAAoBI,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWN,YAAX,KAA4B,CAArC,CAApB;AACA,OAAKO,aAAL,GAAqBN,UAAU,GAAG,CAAH,GAAO,CAAtC;AACA,OAAKC,iBAAL,GAAyBM,OAAO,CAACN,iBAAD,CAAhC;AACA,OAAKC,cAAL,GACE,OAAOA,cAAP,KAA0B,UAA1B,GAAuCA,cAAvC,GAAwD,YAAW,CAAE,CADvE;AAGA,OAAKM,+BAAL,GAAuC,KAAKV,WAAL,GAAmB,KAAKQ,aAA/D;AACA,OAAKG,iCAAL,GACE,KAAKb,aAAL,GAAqB,KAAKU,aAD5B;AAEA,OAAKI,kCAAL,GACE,KAAKb,cAAL,GAAsB,KAAKS,aAD7B;AAEA,OAAKK,mBAAL,GACE,KAAKH,+BAAL,GAAuC,KAAKX,cAD9C;AAEA,OAAKe,eAAL,GACE,KAAKJ,+BAAL,GAAuC,KAAKT,YAD9C;AAEA,OAAKc,UAAL;AACD;;AAEDlB,MAAM,CAACmB,SAAP,CAAiBD,UAAjB,GAA8B,YAAW;AACvC;AACA,MACE,K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// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === 'function' ? resizeCallback : function() {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function() {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error('Invalid settings specified for the resizer.');\n }\n};\n\nResize.prototype.configurePasses = function() {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function(\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function(buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function(buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function(buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function(bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function(bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function(bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nmodule.exports = Resize;\n"],"file":"resize.js"}
\ No newline at end of file
+{"version":3,"file":"resize.js","names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array"],"sources":["../../src/modules/resize.js"],"sourcesContent":["// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === \"function\" ? resizeCallback : function () {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function () {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error(\"Invalid settings specified for the resizer.\");\n }\n};\n\nResize.prototype.configurePasses = function () {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function (\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function (buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function (buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function (buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function (bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function (bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function (bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nexport default Resize;\n"],"mappings":";;;;;;AAAA;AACA;;AAEA,SAASA,MAAM,CACbC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,iBAAiB,EACjBC,cAAc,EACd;EACA,IAAI,CAACN,aAAa,GAAGO,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,KAAK,CAACT,aAAa,CAAC,IAAI,CAAC,CAAC;EAC7D,IAAI,CAACC,cAAc,GAAGM,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,KAAK,CAACR,cAAc,CAAC,IAAI,CAAC,CAAC;EAC/D,IAAI,CAACC,WAAW,GAAGK,IAAI,C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OAAO,IAAIC,YAAY,CAACD,YAAY,CAAC;EACvC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAEDrF,MAAM,CAACmB,SAAS,CAAC8D,qBAAqB,GAAG,UAAUE,YAAY,EAAE;EAC/D;EACA,IAAI;IACF,OAAO,IAAIG,YAAY,CAACH,YAAY,CAAC;EACvC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAEDrF,MAAM,CAACmB,SAAS,CAAC+D,mBAAmB,GAAG,UAAUC,YAAY,EAAE;EAC7D;EACA,IAAI;IACF,OAAO,IAAII,UAAU,CAACJ,YAAY,CAAC;EACrC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAAC,eAEarF,MAAM;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js
index a1b6abdc..dfafce83 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js
+++ b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js
@@ -1,5 +1,9 @@
"use strict";
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
/**
* Copyright (c) 2015 Guyon Roche
*
@@ -21,21 +25,21 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-module.exports = {
- nearestNeighbor: function nearestNeighbor(src, dst) {
- var wSrc = src.width;
- var hSrc = src.height;
- var wDst = dst.width;
- var hDst = dst.height;
- var bufSrc = src.data;
- var bufDst = dst.data;
- for (var i = 0; i < hDst; i++) {
- for (var j = 0; j < wDst; j++) {
- var posDst = (i * wDst + j) * 4;
- var iSrc = Math.floor(i * hSrc / hDst);
- var jSrc = Math.floor(j * wSrc / wDst);
- var posSrc = (iSrc * wSrc + jSrc) * 4;
+const operations = {
+ nearestNeighbor(src, dst) {
+ const wSrc = src.width;
+ const hSrc = src.height;
+ const wDst = dst.width;
+ const hDst = dst.height;
+ const bufSrc = src.data;
+ const bufDst = dst.data;
+ for (let i = 0; i < hDst; i++) {
+ for (let j = 0; j < wDst; j++) {
+ let posDst = (i * wDst + j) * 4;
+ const iSrc = Math.floor(i * hSrc / hDst);
+ const jSrc = Math.floor(j * wSrc / wDst);
+ let posSrc = (iSrc * wSrc + jSrc) * 4;
bufDst[posDst++] = bufSrc[posSrc++];
bufDst[posDst++] = bufSrc[posSrc++];
bufDst[posDst++] = bufSrc[posSrc++];
@@ -43,48 +47,45 @@ module.exports = {
}
}
},
- bilinearInterpolation: function bilinearInterpolation(src, dst) {
- var wSrc = src.width;
- var hSrc = src.height;
- var wDst = dst.width;
- var hDst = dst.height;
- var bufSrc = src.data;
- var bufDst = dst.data;
-
- var interpolate = function interpolate(k, kMin, vMin, kMax, vMax) {
+ bilinearInterpolation(src, dst) {
+ const wSrc = src.width;
+ const hSrc = src.height;
+ const wDst = dst.width;
+ const hDst = dst.height;
+ const bufSrc = src.data;
+ const bufDst = dst.data;
+ const interpolate = function (k, kMin, vMin, kMax, vMax) {
// special case - k is integer
if (kMin === kMax) {
return vMin;
}
-
return Math.round((k - kMin) * vMax + (kMax - k) * vMin);
};
+ const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) {
+ let posMin = (yMin * wSrc + xMin) * 4 + offset;
+ let posMax = (yMin * wSrc + xMax) * 4 + offset;
+ const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);
- var assign = function assign(pos, offset, x, xMin, xMax, y, yMin, yMax) {
- var posMin = (yMin * wSrc + xMin) * 4 + offset;
- var posMax = (yMin * wSrc + xMax) * 4 + offset;
- var vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); // special case, y is integer
-
+ // special case, y is integer
if (yMax === yMin) {
bufDst[pos + offset] = vMin;
} else {
posMin = (yMax * wSrc + xMin) * 4 + offset;
posMax = (yMax * wSrc + xMax) * 4 + offset;
- var vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);
+ const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);
bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);
}
};
-
- for (var i = 0; i < hDst; i++) {
- for (var j = 0; j < wDst; j++) {
- var posDst = (i * wDst + j) * 4; // x & y in src coordinates
-
- var x = j * wSrc / wDst;
- var xMin = Math.floor(x);
- var xMax = Math.min(Math.ceil(x), wSrc - 1);
- var y = i * hSrc / hDst;
- var yMin = Math.floor(y);
- var yMax = Math.min(Math.ceil(y), hSrc - 1);
+ for (let i = 0; i < hDst; i++) {
+ for (let j = 0; j < wDst; j++) {
+ const posDst = (i * wDst + j) * 4;
+ // x & y in src coordinates
+ const x = j * wSrc / wDst;
+ const xMin = Math.floor(x);
+ const xMax = Math.min(Math.ceil(x), wSrc - 1);
+ const y = i * hSrc / hDst;
+ const yMin = Math.floor(y);
+ const yMax = Math.min(Math.ceil(y), hSrc - 1);
assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);
assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);
assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);
@@ -92,117 +93,106 @@ module.exports = {
}
}
},
- _interpolate2D: function _interpolate2D(src, dst, options, interpolate) {
- var bufSrc = src.data;
- var bufDst = dst.data;
- var wSrc = src.width;
- var hSrc = src.height;
- var wDst = dst.width;
- var hDst = dst.height; // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares
+ _interpolate2D(src, dst, options, interpolate) {
+ const bufSrc = src.data;
+ const bufDst = dst.data;
+ const wSrc = src.width;
+ const hSrc = src.height;
+ const wDst = dst.width;
+ const hDst = dst.height;
+
+ // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares
+ const wM = Math.max(1, Math.floor(wSrc / wDst));
+ const wDst2 = wDst * wM;
+ const hM = Math.max(1, Math.floor(hSrc / hDst));
+ const hDst2 = hDst * hM;
- var wM = Math.max(1, Math.floor(wSrc / wDst));
- var wDst2 = wDst * wM;
- var hM = Math.max(1, Math.floor(hSrc / hDst));
- var hDst2 = hDst * hM; // ===========================================================
+ // ===========================================================
// Pass 1 - interpolate rows
// buf1 has width of dst2 and height of src
-
- var buf1 = Buffer.alloc(wDst2 * hSrc * 4);
-
- for (var i = 0; i < hSrc; i++) {
- for (var j = 0; j < wDst2; j++) {
+ const buf1 = Buffer.alloc(wDst2 * hSrc * 4);
+ for (let i = 0; i < hSrc; i++) {
+ for (let j = 0; j < wDst2; j++) {
// i in src coords, j in dst coords
+
// calculate x in src coords
// this interpolation requires 4 sample points and the two inner ones must be real
// the outer points can be fudged for the edges.
// therefore (wSrc-1)/wDst2
- var x = j * (wSrc - 1) / wDst2;
- var xPos = Math.floor(x);
- var t = x - xPos;
- var srcPos = (i * wSrc + xPos) * 4;
- var buf1Pos = (i * wDst2 + j) * 4;
-
- for (var k = 0; k < 4; k++) {
- var kPos = srcPos + k;
- var x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];
- var x1 = bufSrc[kPos];
- var x2 = bufSrc[kPos + 4];
- var x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos];
+ const x = j * (wSrc - 1) / wDst2;
+ const xPos = Math.floor(x);
+ const t = x - xPos;
+ const srcPos = (i * wSrc + xPos) * 4;
+ const buf1Pos = (i * wDst2 + j) * 4;
+ for (let k = 0; k < 4; k++) {
+ const kPos = srcPos + k;
+ const x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];
+ const x1 = bufSrc[kPos];
+ const x2 = bufSrc[kPos + 4];
+ const x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos];
buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);
}
}
- } // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg");
+ }
+ // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg");
+
// ===========================================================
// Pass 2 - interpolate columns
// buf2 has width and height of dst2
-
-
- var buf2 = Buffer.alloc(wDst2 * hDst2 * 4);
-
- for (var _i = 0; _i < hDst2; _i++) {
- for (var _j = 0; _j < wDst2; _j++) {
+ const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);
+ for (let i = 0; i < hDst2; i++) {
+ for (let j = 0; j < wDst2; j++) {
// i&j in dst2 coords
+
// calculate y in buf1 coords
// this interpolation requires 4 sample points and the two inner ones must be real
// the outer points can be fudged for the edges.
// therefore (hSrc-1)/hDst2
- var y = _i * (hSrc - 1) / hDst2;
- var yPos = Math.floor(y);
-
- var _t = y - yPos;
-
- var _buf1Pos = (yPos * wDst2 + _j) * 4;
-
- var buf2Pos = (_i * wDst2 + _j) * 4;
-
- for (var _k = 0; _k < 4; _k++) {
- var _kPos = _buf1Pos + _k;
-
- var y0 = yPos > 0 ? buf1[_kPos - wDst2 * 4] : 2 * buf1[_kPos] - buf1[_kPos + wDst2 * 4];
- var y1 = buf1[_kPos];
- var y2 = buf1[_kPos + wDst2 * 4];
- var y3 = yPos < hSrc - 2 ? buf1[_kPos + wDst2 * 8] : 2 * buf1[_kPos + wDst2 * 4] - buf1[_kPos];
- buf2[buf2Pos + _k] = interpolate(y0, y1, y2, y3, _t);
+ const y = i * (hSrc - 1) / hDst2;
+ const yPos = Math.floor(y);
+ const t = y - yPos;
+ const buf1Pos = (yPos * wDst2 + j) * 4;
+ const buf2Pos = (i * wDst2 + j) * 4;
+ for (let k = 0; k < 4; k++) {
+ const kPos = buf1Pos + k;
+ const y0 = yPos > 0 ? buf1[kPos - wDst2 * 4] : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];
+ const y1 = buf1[kPos];
+ const y2 = buf1[kPos + wDst2 * 4];
+ const y3 = yPos < hSrc - 2 ? buf1[kPos + wDst2 * 8] : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];
+ buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);
}
}
- } // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg");
+ }
+ // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg");
+
// ===========================================================
// Pass 3 - scale to dst
-
-
- var m = wM * hM;
-
+ const m = wM * hM;
if (m > 1) {
- for (var _i2 = 0; _i2 < hDst; _i2++) {
- for (var _j2 = 0; _j2 < wDst; _j2++) {
+ for (let i = 0; i < hDst; i++) {
+ for (let j = 0; j < wDst; j++) {
// i&j in dst bounded coords
- var r = 0;
- var g = 0;
- var b = 0;
- var a = 0;
- var realColors = 0;
-
- for (var _y = 0; _y < hM; _y++) {
- var _yPos = _i2 * hM + _y;
-
- for (var _x = 0; _x < wM; _x++) {
- var _xPos = _j2 * wM + _x;
-
- var xyPos = (_yPos * wDst2 + _xPos) * 4;
- var pixelAlpha = buf2[xyPos + 3];
-
+ let r = 0;
+ let g = 0;
+ let b = 0;
+ let a = 0;
+ let realColors = 0;
+ for (let y = 0; y < hM; y++) {
+ const yPos = i * hM + y;
+ for (let x = 0; x < wM; x++) {
+ const xPos = j * wM + x;
+ const xyPos = (yPos * wDst2 + xPos) * 4;
+ const pixelAlpha = buf2[xyPos + 3];
if (pixelAlpha) {
r += buf2[xyPos];
g += buf2[xyPos + 1];
b += buf2[xyPos + 2];
realColors++;
}
-
a += pixelAlpha;
}
}
-
- var pos = (_i2 * wDst + _j2) * 4;
+ const pos = (i * wDst + j) * 4;
bufDst[pos] = realColors ? Math.round(r / realColors) : 0;
bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;
bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;
@@ -214,29 +204,27 @@ module.exports = {
dst.data = buf2;
}
},
- bicubicInterpolation: function bicubicInterpolation(src, dst, options) {
- var interpolateCubic = function interpolateCubic(x0, x1, x2, x3, t) {
- var a0 = x3 - x2 - x0 + x1;
- var a1 = x0 - x1 - a0;
- var a2 = x2 - x0;
- var a3 = x1;
+ bicubicInterpolation(src, dst, options) {
+ const interpolateCubic = function (x0, x1, x2, x3, t) {
+ const a0 = x3 - x2 - x0 + x1;
+ const a1 = x0 - x1 - a0;
+ const a2 = x2 - x0;
+ const a3 = x1;
return Math.max(0, Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3));
};
-
return this._interpolate2D(src, dst, options, interpolateCubic);
},
- hermiteInterpolation: function hermiteInterpolation(src, dst, options) {
- var interpolateHermite = function interpolateHermite(x0, x1, x2, x3, t) {
- var c0 = x1;
- var c1 = 0.5 * (x2 - x0);
- var c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;
- var c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);
+ hermiteInterpolation(src, dst, options) {
+ const interpolateHermite = function (x0, x1, x2, x3, t) {
+ const c0 = x1;
+ const c1 = 0.5 * (x2 - x0);
+ const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;
+ const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);
return Math.max(0, Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0)));
};
-
return this._interpolate2D(src, dst, options, interpolateHermite);
},
- bezierInterpolation: function bezierInterpolation(src, dst, options) {
+ bezierInterpolation(src, dst, options) {
// between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)
// to predict control points (a & b) to be placed at n+0.5
// ya(n) = y(n) + (y(n+1)-y(n-1))/4
@@ -248,19 +236,22 @@ module.exports = {
// y(-1) = y(0) - 2*(y(1)-y(0))
// y(w) = y(w-1) + 2*(y(w-1)-y(w-2))
// but can go with y(-1) = y(0) and y(w) = y(w-1)
- var interpolateBezier = function interpolateBezier(x0, x1, x2, x3, t) {
+ const interpolateBezier = function (x0, x1, x2, x3, t) {
// x1, x2 are the knots, use x0 and x3 to calculate control points
- var cp1 = x1 + (x2 - x0) / 4;
- var cp2 = x2 - (x3 - x1) / 4;
- var nt = 1 - t;
- var c0 = x1 * nt * nt * nt;
- var c1 = 3 * cp1 * nt * nt * t;
- var c2 = 3 * cp2 * nt * t * t;
- var c3 = x2 * t * t * t;
+ const cp1 = x1 + (x2 - x0) / 4;
+ const cp2 = x2 - (x3 - x1) / 4;
+ const nt = 1 - t;
+ const c0 = x1 * nt * nt * nt;
+ const c1 = 3 * cp1 * nt * nt * t;
+ const c2 = 3 * cp2 * nt * t * t;
+ const c3 = x2 * t * t * t;
return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));
};
-
return this._interpolate2D(src, dst, options, interpolateBezier);
}
};
+var _default = operations;
+exports.default = _default;
+module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=resize2.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map
index 4f96dcce..ed590e46 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map
+++ b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/modules/resize2.js"],"names":["module","exports","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","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vC,CAAf;AACA,UAAM+B,EAAE,GAAG1B,EAAE,GAAGkC,EAAL,GAAUA,EAAV,GAAeA,EAA1B;AACA,UAAMP,EAAE,GAAG,IAAIK,GAAJ,GAAUE,EAAV,GAAeA,EAAf,GAAoBvC,CAA/B;AACA,UAAMiC,EAAE,GAAG,IAAIK,GAAJ,GAAUC,EAAV,GAAevC,CAAf,GAAmBA,CAA9B;AACA,UAAMkC,EAAE,GAAG5B,EAAE,GAAGN,CAAL,GAASA,CAAT,GAAaA,CAAxB;AACA,aAAOpC,IAAI,CAAC4B,GAAL,CAAS,CAAT,EAAY5B,IAAI,CAACuB,GAAL,CAAS,GAAT,EAAcvB,IAAI,CAACW,KAAL,CAAWwD,EAAE,GAAGC,EAAL,GAAUC,EAAV,GAAeC,EAA1B,CAAd,CAAZ,CAAP;AACD,KAVD;;AAYA,WAAO,KAAK7C,cAAL,CAAoBxC,GAApB,EAAyBC,GAAzB,EAA8BwC,OAA9B,EAAuC8C,iBAAvC,CAAP;AACD;AA7Qc,CAAjB","sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:
\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nmodule.exports = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function(k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function(pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function(x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function(x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function(x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n }\n};\n"],"file":"resize2.js"}
\ No newline at end of file
+{"version":3,"file":"resize2.js","names":["operations","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","interpolateBezier","cp1","cp2","nt"],"sources":["../../src/modules/resize2.js"],"sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nconst operations = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function (k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function (x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function (x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function (x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n },\n};\n\nexport default operations;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,UAAU,GAAG;EACjBC,eAAe,CAACC,GAAG,EAAEC,GAAG,EAAE;IACxB,MAAMC,IAAI,GAAGF,GAAG,CAACG,KAAK;IACtB,MAAMC,IAAI,GAAGJ,GAAG,CAACK,MAAM;IAEvB,MAAMC,IAAI,GAAGL,GAAG,CAACE,KAAK;IACtB,MAAMI,IAAI,GAAGN,GAAG,CAACI,MAAM;IAEvB,MAAMG,MAAM,GAAGR,GAAG,CAACS,IAAI;IACvB,MAAMC,MAAM,GAAGT,GAAG,CAACQ,IAAI;IAEvB,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,IAAI,EAAEI,CAAC,EAAE,EAAE;MAC7B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,IAAI,EAAEM,CAAC,EAAE,EAAE;QAC7B,IAAIC,MAAM,GAAG,CAACF,CAAC,GAAGL,IAAI,GAAGM,CAAC,IAAI,CAAC;QAE/B,MAAME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AAGkC,EAAE,GAAGA,EAAE,GAAGA,EAAE;MAC5B,MAAMP,EAAE,GAAG,CAAC,GAAGK,GAAG,GAAGE,EAAE,GAAGA,EAAE,GAAGvC,CAAC;MAChC,MAAMiC,EAAE,GAAG,CAAC,GAAGK,GAAG,GAAGC,EAAE,GAAGvC,CAAC,GAAGA,CAAC;MAC/B,MAAMkC,EAAE,GAAG5B,EAAE,GAAGN,CAAC,GAAGA,CAAC,GAAGA,CAAC;MACzB,OAAOpC,IAAI,CAAC4B,GAAG,CAAC,CAAC,EAAE5B,IAAI,CAACuB,GAAG,CAAC,GAAG,EAAEvB,IAAI,CAACW,KAAK,CAACwD,EAAE,GAAGC,EAAE,GAAGC,EAAE,GAAGC,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,IAAI,CAAC7C,cAAc,CAACxC,GAAG,EAAEC,GAAG,EAAEwC,OAAO,EAAE8C,iBAAiB,CAAC;EAClE;AACF,CAAC;AAAC,eAEazF,UAAU;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/index.js b/project starter code/node_modules/@jimp/plugin-resize/es/index.js
index eb848757..dd4ecb4c 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-resize/es/index.js
@@ -1,95 +1,69 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
-
-var _resize = _interopRequireDefault(require("./modules/resize"));
-
-var _resize2 = _interopRequireDefault(require("./modules/resize2"));
-
-var _default = function _default() {
- return {
- constants: {
- RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor',
- RESIZE_BILINEAR: 'bilinearInterpolation',
- RESIZE_BICUBIC: 'bicubicInterpolation',
- RESIZE_HERMITE: 'hermiteInterpolation',
- RESIZE_BEZIER: 'bezierInterpolation'
- },
- "class": {
- /**
- * Resizes the image to a set width and height using a 2-pass bilinear algorithm
- * @param {number} w the width to resize the image to (or Jimp.AUTO)
- * @param {number} h the height to resize the image to (or Jimp.AUTO)
- * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- resize: function resize(w, h, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers', cb);
- }
-
- if (typeof mode === 'function' && typeof cb === 'undefined') {
- cb = mode;
- mode = null;
- }
-
- if (w === this.constructor.AUTO && h === this.constructor.AUTO) {
- return _utils.throwError.call(this, 'w and h cannot both be set to auto', cb);
- }
-
- if (w === this.constructor.AUTO) {
- w = this.bitmap.width * (h / this.bitmap.height);
- }
-
- if (h === this.constructor.AUTO) {
- h = this.bitmap.height * (w / this.bitmap.width);
- }
-
- if (w < 0 || h < 0) {
- return _utils.throwError.call(this, 'w and h must be positive numbers', cb);
- } // round inputs
-
-
- w = Math.round(w);
- h = Math.round(h);
-
- if (typeof _resize2["default"][mode] === 'function') {
- var dst = {
- data: Buffer.alloc(w * h * 4),
- width: w,
- height: h
- };
-
- _resize2["default"][mode](this.bitmap, dst);
-
- this.bitmap = dst;
- } else {
- var image = this;
- var resize = new _resize["default"](this.bitmap.width, this.bitmap.height, w, h, true, true, function (buffer) {
- image.bitmap.data = Buffer.from(buffer);
- image.bitmap.width = w;
- image.bitmap.height = h;
- });
- resize.resize(this.bitmap.data);
- }
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
+import { throwError, isNodePattern } from "@jimp/utils";
+import Resize from "./modules/resize";
+import Resize2 from "./modules/resize2";
+export default (() => ({
+ constants: {
+ RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor",
+ RESIZE_BILINEAR: "bilinearInterpolation",
+ RESIZE_BICUBIC: "bicubicInterpolation",
+ RESIZE_HERMITE: "hermiteInterpolation",
+ RESIZE_BEZIER: "bezierInterpolation"
+ },
+ class: {
+ /**
+ * Resizes the image to a set width and height using a 2-pass bilinear algorithm
+ * @param {number} w the width to resize the image to (or Jimp.AUTO)
+ * @param {number} h the height to resize the image to (or Jimp.AUTO)
+ * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ resize(w, h, mode, cb) {
+ if (typeof w !== "number" || typeof h !== "number") {
+ return throwError.call(this, "w and h must be numbers", cb);
+ }
+ if (typeof mode === "function" && typeof cb === "undefined") {
+ cb = mode;
+ mode = null;
+ }
+ if (w === this.constructor.AUTO && h === this.constructor.AUTO) {
+ return throwError.call(this, "w and h cannot both be set to auto", cb);
+ }
+ if (w === this.constructor.AUTO) {
+ w = this.bitmap.width * (h / this.bitmap.height);
+ }
+ if (h === this.constructor.AUTO) {
+ h = this.bitmap.height * (w / this.bitmap.width);
+ }
+ if (w < 0 || h < 0) {
+ return throwError.call(this, "w and h must be positive numbers", cb);
+ }
- return this;
+ // round inputs
+ w = Math.round(w) || 1;
+ h = Math.round(h) || 1;
+ if (typeof Resize2[mode] === "function") {
+ const dst = {
+ data: Buffer.alloc(w * h * 4),
+ width: w,
+ height: h
+ };
+ Resize2[mode](this.bitmap, dst);
+ this.bitmap = dst;
+ } else {
+ const image = this;
+ const resize = new Resize(this.bitmap.width, this.bitmap.height, w, h, true, true, buffer => {
+ image.bitmap.data = Buffer.from(buffer);
+ image.bitmap.width = w;
+ image.bitmap.height = h;
+ });
+ resize.resize(this.bitmap.data);
+ }
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
}
+ return this;
}
- };
-};
-
-exports["default"] = _default;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map b/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map
index 36caf764..af90280c 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","resize","w","h","mode","cb","throwError","call","constructor","AUTO","bitmap","width","height","Math","round","Resize2","dst","data","Buffer","alloc","image","Resize","buffer","from"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe;AAAA,SAAO;AACpBA,IAAAA,SAAS,EAAE;AACTC,MAAAA,uBAAuB,EAAE,iBADhB;AAETC,MAAAA,eAAe,EAAE,uBAFR;AAGTC,MAAAA,cAAc,EAAE,sBAHP;AAITC,MAAAA,cAAc,EAAE,sBAJP;AAKTC,MAAAA,aAAa,EAAE;AALN,KADS;AASpB,aAAO;AACL;;;;;;;;AAQAC,MAAAA,MATK,kBASEC,CATF,EASKC,CATL,EASQC,IATR,EAScC,EATd,EASkB;AACrB,YAAI,OAAOH,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,iBAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,YAAI,OAAOD,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAC3DA,UAAAA,EAAE,GAAGD,IAAL;AACAA,UAAAA,IAAI,GAAG,IAAP;AACD;;AAED,YAAIF,CAAC,KAAK,KAAKM,WAAL,CAAiBC,IAAvB,IAA+BN,CAAC,KAAK,KAAKK,WAAL,CAAiBC,IAA1D,EAAgE;AAC9D,iBAAOH,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oCAAtB,EAA4DF,EAA5D,CAAP;AACD;;AAED,YAAIH,CAAC,KAAK,KAAKM,WAAL,CAAiBC,IAA3B,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K,IAAP,CAAYD,MAAZ,CAApB;AACAF,YAAAA,KAAK,CAACV,MAAN,CAAaC,KAAb,GAAqBT,CAArB;AACAkB,YAAAA,KAAK,CAACV,MAAN,CAAaE,MAAb,GAAsBT,CAAtB;AACD,WAXY,CAAf;AAaAF,UAAAA,MAAM,CAACA,MAAP,CAAc,KAAKS,MAAL,CAAYO,IAA1B;AACD;;AAED,YAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtEI;AATa,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nimport Resize from './modules/resize';\nimport Resize2 from './modules/resize2';\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor',\n RESIZE_BILINEAR: 'bilinearInterpolation',\n RESIZE_BICUBIC: 'bicubicInterpolation',\n RESIZE_HERMITE: 'hermiteInterpolation',\n RESIZE_BEZIER: 'bezierInterpolation'\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, 'w and h cannot both be set to auto', cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, 'w and h must be positive numbers', cb);\n }\n\n // round inputs\n w = Math.round(w);\n h = Math.round(h);\n\n if (typeof Resize2[mode] === 'function') {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n buffer => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["throwError","isNodePattern","Resize","Resize2","constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","class","resize","w","h","mode","cb","call","constructor","AUTO","bitmap","width","height","Math","round","dst","data","Buffer","alloc","image","buffer","from"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nimport Resize from \"./modules/resize\";\nimport Resize2 from \"./modules/resize2\";\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: \"nearestNeighbor\",\n RESIZE_BILINEAR: \"bilinearInterpolation\",\n RESIZE_BICUBIC: \"bicubicInterpolation\",\n RESIZE_HERMITE: \"hermiteInterpolation\",\n RESIZE_BEZIER: \"bezierInterpolation\",\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, \"w and h cannot both be set to auto\", cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, \"w and h must be positive numbers\", cb);\n }\n\n // round inputs\n w = Math.round(w) || 1;\n h = Math.round(h) || 1;\n\n if (typeof Resize2[mode] === \"function\") {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h,\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n (buffer) => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,OAAOC,MAAM,MAAM,kBAAkB;AACrC,OAAOC,OAAO,MAAM,mBAAmB;AAEvC,gBAAe,OAAO;EACpBC,SAAS,EAAE;IACTC,uBAAuB,EAAE,iBAAiB;IAC1CC,eAAe,EAAE,uBAAuB;IACxCC,cAAc,EAAE,sBAAsB;IACtCC,cAAc,EAAE,sBAAsB;IACtCC,aAAa,EAAE;EACjB,CAAC;EAEDC,KAAK,EAAE;IACL;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,MAAM,CAACC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAEC,EAAE,EAAE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MAAM,CAACC,KAAK,CAACf,CAAC,GAAGC,CAAC,GAAG,CAAC,CAAC;UAC7BO,KAAK,EAAER,CAAC;UACRS,MAAM,EAAER;QACV,CAAC;QACDV,OAAO,CAACW,IAAI,CAAC,CAAC,IAAI,CAACK,MAAM,EAAEK,GAAG,CAAC;QAC/B,IAAI,CAACL,MAAM,GAAGK,GAAG;MACnB,CAAC,MAAM;QACL,MAAMI,KAAK,GAAG,IAAI;QAClB,MAAMjB,MAAM,GAAG,IAAIT,MAAM,CACvB,IAAI,CAACiB,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClBT,CAAC,EACDC,CAAC,EACD,IAAI,EACJ,IAAI,EACHgB,MAAM,IAAK;UACVD,KAAK,CAACT,MAAM,CAACM,IAAI,GAAGC,MAAM,CAACI,IAAI,CAACD,MAAM,CAAC;UACvCD,KAAK,CAACT,MAAM,CAACC,KAAK,GAAGR,CAAC;UACtBgB,KAAK,CAACT,MAAM,CAACE,MAAM,GAAGR,CAAC;QACzB,CAAC,CACF;QACDF,MAAM,CAACA,MAAM,CAAC,IAAI,CAACQ,MAAM,CAACM,IAAI,CAAC;MACjC;MAEA,IAAIxB,aAAa,CAACc,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js
index 8dbb005b..619c6b8c 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js
+++ b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js
@@ -1,7 +1,6 @@
-"use strict";
-
// JavaScript Image Resizer (c) 2012 - Grant Galitz
// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4
+
function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendAlpha, interpolationPass, resizeCallback) {
this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);
this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);
@@ -9,7 +8,7 @@ function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendA
this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);
this.colorChannels = blendAlpha ? 4 : 3;
this.interpolationPass = Boolean(interpolationPass);
- this.resizeCallback = typeof resizeCallback === 'function' ? resizeCallback : function () {};
+ this.resizeCallback = typeof resizeCallback === "function" ? resizeCallback : function () {};
this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;
this.originalWidthMultipliedByChannels = this.widthOriginal * this.colorChannels;
this.originalHeightMultipliedByChannels = this.heightOriginal * this.colorChannels;
@@ -17,16 +16,14 @@ function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendA
this.finalResultSize = this.targetWidthMultipliedByChannels * this.targetHeight;
this.initialize();
}
-
Resize.prototype.initialize = function () {
// Perform some checks:
if (this.widthOriginal > 0 && this.heightOriginal > 0 && this.targetWidth > 0 && this.targetHeight > 0) {
this.configurePasses();
} else {
- throw new Error('Invalid settings specified for the resizer.');
+ throw new Error("Invalid settings specified for the resizer.");
}
};
-
Resize.prototype.configurePasses = function () {
if (this.widthOriginal === this.targetWidth) {
// Bypass the width resizer pass:
@@ -34,7 +31,6 @@ Resize.prototype.configurePasses = function () {
} else {
// Setup the width resizer pass:
this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;
-
if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {
this.initializeFirstPassBuffers(true);
this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthInterpolatedRGBA : this.resizeWidthInterpolatedRGB;
@@ -43,14 +39,12 @@ Resize.prototype.configurePasses = function () {
this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;
}
}
-
if (this.heightOriginal === this.targetHeight) {
// Bypass the height resizer pass:
this.resizeHeight = this.bypassResizer;
} else {
// Setup the height resizer pass:
this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;
-
if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {
this.initializeSecondPassBuffers(true);
this.resizeHeight = this.resizeHeightInterpolated;
@@ -60,18 +54,18 @@ Resize.prototype.configurePasses = function () {
}
}
};
-
Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthChannel) {
- var channelsNum = fourthChannel ? 4 : 3;
- var ratioWeight = this.ratioWeightWidthPass;
- var outputBuffer = this.widthBuffer;
- var weight = 0;
- var finalOffset = 0;
- var pixelOffset = 0;
- var firstWeight = 0;
- var secondWeight = 0;
- var targetPosition; // Handle for only one interpolation input being valid for start calculation:
-
+ const channelsNum = fourthChannel ? 4 : 3;
+ const ratioWeight = this.ratioWeightWidthPass;
+ const outputBuffer = this.widthBuffer;
+ let weight = 0;
+ let finalOffset = 0;
+ let pixelOffset = 0;
+ let firstWeight = 0;
+ let secondWeight = 0;
+ let targetPosition;
+
+ // Handle for only one interpolation input being valid for start calculation:
for (targetPosition = 0; weight < 1 / 3; targetPosition += channelsNum, weight += ratioWeight) {
for (finalOffset = targetPosition, pixelOffset = 0; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) {
outputBuffer[finalOffset] = buffer[pixelOffset];
@@ -79,26 +73,25 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthC
outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];
if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];
}
- } // Adjust for overshoot of the last pass's counter:
-
+ }
+ // Adjust for overshoot of the last pass's counter:
weight -= 1 / 3;
- var interpolationWidthSourceReadStop;
-
+ let interpolationWidthSourceReadStop;
for (interpolationWidthSourceReadStop = this.widthOriginal - 1; weight < interpolationWidthSourceReadStop; targetPosition += channelsNum, weight += ratioWeight) {
// Calculate weightings:
secondWeight = weight % 1;
- firstWeight = 1 - secondWeight; // Interpolate:
-
+ firstWeight = 1 - secondWeight;
+ // Interpolate:
for (finalOffset = targetPosition, pixelOffset = Math.floor(weight) * channelsNum; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) {
outputBuffer[finalOffset + 0] = buffer[pixelOffset + 0] * firstWeight + buffer[pixelOffset + channelsNum + 0] * secondWeight;
outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1] * firstWeight + buffer[pixelOffset + channelsNum + 1] * secondWeight;
outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2] * firstWeight + buffer[pixelOffset + channelsNum + 2] * secondWeight;
if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3] * firstWeight + buffer[pixelOffset + channelsNum + 3] * secondWeight;
}
- } // Handle for only one interpolation input being valid for end calculation:
-
+ }
+ // Handle for only one interpolation input being valid for end calculation:
for (interpolationWidthSourceReadStop = this.originalWidthMultipliedByChannels - channelsNum; targetPosition < this.targetWidthMultipliedByChannels; targetPosition += channelsNum) {
for (finalOffset = targetPosition, pixelOffset = interpolationWidthSourceReadStop; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) {
outputBuffer[finalOffset] = buffer[pixelOffset];
@@ -107,66 +100,57 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthC
if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];
}
}
-
return outputBuffer;
};
-
Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {
- var channelsNum = fourthChannel ? 4 : 3;
- var ratioWeight = this.ratioWeightWidthPass;
- var ratioWeightDivisor = 1 / ratioWeight;
- var nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1;
- var nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1;
- var output = this.outputWidthWorkBench;
- var outputBuffer = this.widthBuffer;
- var trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;
- var weight = 0;
- var amountToNext = 0;
- var actualPosition = 0;
- var currentPosition = 0;
- var line = 0;
- var pixelOffset = 0;
- var outputOffset = 0;
- var multiplier = 1;
- var r = 0;
- var g = 0;
- var b = 0;
- var a = 0;
-
+ const channelsNum = fourthChannel ? 4 : 3;
+ const ratioWeight = this.ratioWeightWidthPass;
+ const ratioWeightDivisor = 1 / ratioWeight;
+ const nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1;
+ const nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1;
+ const output = this.outputWidthWorkBench;
+ const outputBuffer = this.widthBuffer;
+ const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;
+ let weight = 0;
+ let amountToNext = 0;
+ let actualPosition = 0;
+ let currentPosition = 0;
+ let line = 0;
+ let pixelOffset = 0;
+ let outputOffset = 0;
+ let multiplier = 1;
+ let r = 0;
+ let g = 0;
+ let b = 0;
+ let a = 0;
do {
for (line = 0; line < this.originalHeightMultipliedByChannels;) {
output[line++] = 0;
output[line++] = 0;
output[line++] = 0;
-
if (fourthChannel) {
output[line++] = 0;
trustworthyColorsCount[line / channelsNum - 1] = 0;
}
}
-
weight = ratioWeight;
-
do {
amountToNext = 1 + actualPosition - currentPosition;
multiplier = Math.min(weight, amountToNext);
-
for (line = 0, pixelOffset = actualPosition; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetOriginalWidth) {
r = buffer[pixelOffset];
g = buffer[++pixelOffset];
b = buffer[++pixelOffset];
- a = fourthChannel ? buffer[++pixelOffset] : 255; // Ignore RGB values if pixel is completely transparent
-
+ a = fourthChannel ? buffer[++pixelOffset] : 255;
+ // Ignore RGB values if pixel is completely transparent
output[line++] += (a ? r : 0) * multiplier;
output[line++] += (a ? g : 0) * multiplier;
output[line++] += (a ? b : 0) * multiplier;
-
if (fourthChannel) {
output[line++] += a * multiplier;
trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;
}
}
-
if (weight >= amountToNext) {
actualPosition += channelsNum;
currentPosition = actualPosition;
@@ -176,7 +160,6 @@ Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {
break;
}
} while (weight > 0 && actualPosition < this.originalWidthMultipliedByChannels);
-
for (line = 0, pixelOffset = outputOffset; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetTargetWidth) {
weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;
multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor;
@@ -185,67 +168,57 @@ Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {
outputBuffer[++pixelOffset] = output[line++] * multiplier;
if (fourthChannel) outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;
}
-
outputOffset += channelsNum;
} while (outputOffset < this.targetWidthMultipliedByChannels);
-
return outputBuffer;
};
-
Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {
- var ratioWeight = this.ratioWeightHeightPass;
- var ratioWeightDivisor = 1 / ratioWeight;
- var output = this.outputHeightWorkBench;
- var outputBuffer = this.heightBuffer;
- var trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;
- var weight = 0;
- var amountToNext = 0;
- var actualPosition = 0;
- var currentPosition = 0;
- var pixelOffset = 0;
- var outputOffset = 0;
- var caret = 0;
- var multiplier = 1;
- var r = 0;
- var g = 0;
- var b = 0;
- var a = 0;
-
+ const ratioWeight = this.ratioWeightHeightPass;
+ const ratioWeightDivisor = 1 / ratioWeight;
+ const output = this.outputHeightWorkBench;
+ const outputBuffer = this.heightBuffer;
+ const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;
+ let weight = 0;
+ let amountToNext = 0;
+ let actualPosition = 0;
+ let currentPosition = 0;
+ let pixelOffset = 0;
+ let outputOffset = 0;
+ let caret = 0;
+ let multiplier = 1;
+ let r = 0;
+ let g = 0;
+ let b = 0;
+ let a = 0;
do {
for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {
output[pixelOffset++] = 0;
output[pixelOffset++] = 0;
output[pixelOffset++] = 0;
-
if (fourthChannel) {
output[pixelOffset++] = 0;
trustworthyColorsCount[pixelOffset / 4 - 1] = 0;
}
}
-
weight = ratioWeight;
-
do {
amountToNext = 1 + actualPosition - currentPosition;
multiplier = Math.min(weight, amountToNext);
caret = actualPosition;
-
for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {
r = buffer[caret++];
g = buffer[caret++];
b = buffer[caret++];
- a = fourthChannel ? buffer[caret++] : 255; // Ignore RGB values if pixel is completely transparent
-
+ a = fourthChannel ? buffer[caret++] : 255;
+ // Ignore RGB values if pixel is completely transparent
output[pixelOffset++] += (a ? r : 0) * multiplier;
output[pixelOffset++] += (a ? g : 0) * multiplier;
output[pixelOffset++] += (a ? b : 0) * multiplier;
-
if (fourthChannel) {
output[pixelOffset++] += a * multiplier;
trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;
}
}
-
if (weight >= amountToNext) {
actualPosition = caret;
currentPosition = actualPosition;
@@ -255,126 +228,105 @@ Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {
break;
}
} while (weight > 0 && actualPosition < this.widthPassResultSize);
-
for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {
weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;
multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor;
outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier);
outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier);
outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier);
-
if (fourthChannel) {
outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * ratioWeightDivisor);
}
}
} while (outputOffset < this.finalResultSize);
-
return outputBuffer;
};
-
Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) {
return this._resizeWidthInterpolatedRGBChannels(buffer, false);
};
-
Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) {
return this._resizeWidthInterpolatedRGBChannels(buffer, true);
};
-
Resize.prototype.resizeWidthRGB = function (buffer) {
return this._resizeWidthRGBChannels(buffer, false);
};
-
Resize.prototype.resizeWidthRGBA = function (buffer) {
return this._resizeWidthRGBChannels(buffer, true);
};
-
Resize.prototype.resizeHeightInterpolated = function (buffer) {
- var ratioWeight = this.ratioWeightHeightPass;
- var outputBuffer = this.heightBuffer;
- var weight = 0;
- var finalOffset = 0;
- var pixelOffset = 0;
- var pixelOffsetAccumulated = 0;
- var pixelOffsetAccumulated2 = 0;
- var firstWeight = 0;
- var secondWeight = 0;
- var interpolationHeightSourceReadStop; // Handle for only one interpolation input being valid for start calculation:
-
+ const ratioWeight = this.ratioWeightHeightPass;
+ const outputBuffer = this.heightBuffer;
+ let weight = 0;
+ let finalOffset = 0;
+ let pixelOffset = 0;
+ let pixelOffsetAccumulated = 0;
+ let pixelOffsetAccumulated2 = 0;
+ let firstWeight = 0;
+ let secondWeight = 0;
+ let interpolationHeightSourceReadStop;
+
+ // Handle for only one interpolation input being valid for start calculation:
for (; weight < 1 / 3; weight += ratioWeight) {
for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {
outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);
}
- } // Adjust for overshoot of the last pass's counter:
-
+ }
+ // Adjust for overshoot of the last pass's counter:
weight -= 1 / 3;
-
for (interpolationHeightSourceReadStop = this.heightOriginal - 1; weight < interpolationHeightSourceReadStop; weight += ratioWeight) {
// Calculate weightings:
secondWeight = weight % 1;
- firstWeight = 1 - secondWeight; // Interpolate:
-
+ firstWeight = 1 - secondWeight;
+ // Interpolate:
pixelOffsetAccumulated = Math.floor(weight) * this.targetWidthMultipliedByChannels;
pixelOffsetAccumulated2 = pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;
-
for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) {
outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++] * firstWeight + buffer[pixelOffsetAccumulated2++] * secondWeight);
}
- } // Handle for only one interpolation input being valid for end calculation:
-
+ }
+ // Handle for only one interpolation input being valid for end calculation:
while (finalOffset < this.finalResultSize) {
for (pixelOffset = 0, pixelOffsetAccumulated = interpolationHeightSourceReadStop * this.targetWidthMultipliedByChannels; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) {
outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++]);
}
}
-
return outputBuffer;
};
-
Resize.prototype.resizeHeightRGB = function (buffer) {
return this._resizeHeightRGBChannels(buffer, false);
};
-
Resize.prototype.resizeHeightRGBA = function (buffer) {
return this._resizeHeightRGBChannels(buffer, true);
};
-
Resize.prototype.resize = function (buffer) {
this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));
};
-
Resize.prototype.bypassResizer = function (buffer) {
// Just return the buffer passed:
return buffer;
};
-
Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) {
// Initialize the internal width pass buffers:
this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);
-
if (!BILINEARAlgo) {
this.outputWidthWorkBench = this.generateFloatBuffer(this.originalHeightMultipliedByChannels);
-
if (this.colorChannels > 3) {
this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.heightOriginal);
}
}
};
-
Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) {
// Initialize the internal height pass buffers:
this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);
-
if (!BILINEARAlgo) {
this.outputHeightWorkBench = this.generateFloatBuffer(this.targetWidthMultipliedByChannels);
-
if (this.colorChannels > 3) {
this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.targetWidth);
}
}
};
-
Resize.prototype.generateFloatBuffer = function (bufferLength) {
// Generate a float32 typed array buffer:
try {
@@ -383,7 +335,6 @@ Resize.prototype.generateFloatBuffer = function (bufferLength) {
return [];
}
};
-
Resize.prototype.generateFloat64Buffer = function (bufferLength) {
// Generate a float64 typed array buffer:
try {
@@ -392,7 +343,6 @@ Resize.prototype.generateFloat64Buffer = function (bufferLength) {
return [];
}
};
-
Resize.prototype.generateUint8Buffer = function (bufferLength) {
// Generate a uint8 typed array buffer:
try {
@@ -401,6 +351,5 @@ Resize.prototype.generateUint8Buffer = function (bufferLength) {
return [];
}
};
-
-module.exports = Resize;
+export default Resize;
//# sourceMappingURL=resize.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map
index 39e5ae34..5dd2ddec 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map
+++ b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/modules/resize.js"],"names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array","module","exports"],"mappings":";;AAAA;AACA;AAEA,SAASA,MAAT,CACEC,aADF,EAEEC,cAFF,EAGEC,WAHF,EAIEC,YAJF,EAKEC,UALF,EAMEC,iBANF,EAOEC,cAPF,EAQE;AACA,OAAKN,aAAL,GAAqBO,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWT,aAAX,KAA6B,CAAtC,CAArB;AACA,OAAKC,cAAL,GAAsBM,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWR,cAAX,KAA8B,CAAvC,CAAtB;AACA,OAAKC,WAAL,GAAmBK,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWP,WAAX,KAA2B,CAApC,CAAnB;AACA,OAAKC,YAAL,GAAoBI,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWN,YAAX,KAA4B,CAArC,CAApB;AACA,OAAKO,aAAL,GAAqBN,UAAU,GAAG,CAAH,GAAO,CAAtC;AACA,OAAKC,iBAAL,GAAyBM,OAAO,CAACN,iBAAD,CAAhC;AACA,OAAKC,cAAL,GACE,OAAOA,cAAP,KAA0B,UAA1B,GAAuCA,cAAvC,GAAwD,YAAW,CAAE,CADvE;AAGA,OAAKM,+BAAL,GAAuC,KAAKV,WAAL,GAAmB,KAAKQ,aAA/D;AACA,OAAKG,iCAAL,GACE,KAAKb,aAAL,GAAqB,KAAKU,aAD5B;AAEA,OAAKI,kCAAL,GACE,KAAKb,cAAL,GAAsB,KAAKS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AAT,EAAuB;AAC5D;AACA,MAAI;AACF,WAAO,IAAII,UAAJ,CAAeJ,YAAf,CAAP;AACD,GAFD,CAEE,OAAOE,KAAP,EAAc;AACd,WAAO,EAAP;AACD;AACF,CAPD;;AASAG,MAAM,CAACC,OAAP,GAAiBzF,MAAjB","sourcesContent":["// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === 'function' ? resizeCallback : function() {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function() {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error('Invalid settings specified for the resizer.');\n }\n};\n\nResize.prototype.configurePasses = function() {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function(\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function(buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function(buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function(buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function(bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function(bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function(bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nmodule.exports = Resize;\n"],"file":"resize.js"}
\ No newline at end of file
+{"version":3,"file":"resize.js","names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array"],"sources":["../../src/modules/resize.js"],"sourcesContent":["// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === \"function\" ? resizeCallback : function () {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function () {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error(\"Invalid settings specified for the resizer.\");\n }\n};\n\nResize.prototype.configurePasses = function () {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function (\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function (buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function (buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function (buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function (bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function (bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function (bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nexport default Resize;\n"],"mappings":"AAAA;AACA;;AAEA,SAASA,MAAM,CACbC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,iBAAiB,EACjBC,cAAc,EACd;EACA,IAAI,CAACN,aAAa,GAAGO,IAAI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AAa,GAAG,CAAC,EAAE;MAC1B,IAAI,CAAC6D,sCAAsC,GAAG,IAAI,CAACS,qBAAqB,CACtE,IAAI,CAAC9E,WAAW,CACjB;IACH;EACF;AACF,CAAC;AAEDH,MAAM,CAACmB,SAAS,CAAC6D,mBAAmB,GAAG,UAAUG,YAAY,EAAE;EAC7D;EACA,IAAI;IACF,OAAO,IAAIC,YAAY,CAACD,YAAY,CAAC;EACvC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAEDrF,MAAM,CAACmB,SAAS,CAAC8D,qBAAqB,GAAG,UAAUE,YAAY,EAAE;EAC/D;EACA,IAAI;IACF,OAAO,IAAIG,YAAY,CAACH,YAAY,CAAC;EACvC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAEDrF,MAAM,CAACmB,SAAS,CAAC+D,mBAAmB,GAAG,UAAUC,YAAY,EAAE;EAC7D;EACA,IAAI;IACF,OAAO,IAAII,UAAU,CAACJ,YAAY,CAAC;EACrC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAED,eAAerF,MAAM"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js
index a1b6abdc..d1fad17c 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js
+++ b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js
@@ -1,5 +1,3 @@
-"use strict";
-
/**
* Copyright (c) 2015 Guyon Roche
*
@@ -21,21 +19,21 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-module.exports = {
- nearestNeighbor: function nearestNeighbor(src, dst) {
- var wSrc = src.width;
- var hSrc = src.height;
- var wDst = dst.width;
- var hDst = dst.height;
- var bufSrc = src.data;
- var bufDst = dst.data;
- for (var i = 0; i < hDst; i++) {
- for (var j = 0; j < wDst; j++) {
- var posDst = (i * wDst + j) * 4;
- var iSrc = Math.floor(i * hSrc / hDst);
- var jSrc = Math.floor(j * wSrc / wDst);
- var posSrc = (iSrc * wSrc + jSrc) * 4;
+const operations = {
+ nearestNeighbor(src, dst) {
+ const wSrc = src.width;
+ const hSrc = src.height;
+ const wDst = dst.width;
+ const hDst = dst.height;
+ const bufSrc = src.data;
+ const bufDst = dst.data;
+ for (let i = 0; i < hDst; i++) {
+ for (let j = 0; j < wDst; j++) {
+ let posDst = (i * wDst + j) * 4;
+ const iSrc = Math.floor(i * hSrc / hDst);
+ const jSrc = Math.floor(j * wSrc / wDst);
+ let posSrc = (iSrc * wSrc + jSrc) * 4;
bufDst[posDst++] = bufSrc[posSrc++];
bufDst[posDst++] = bufSrc[posSrc++];
bufDst[posDst++] = bufSrc[posSrc++];
@@ -43,48 +41,45 @@ module.exports = {
}
}
},
- bilinearInterpolation: function bilinearInterpolation(src, dst) {
- var wSrc = src.width;
- var hSrc = src.height;
- var wDst = dst.width;
- var hDst = dst.height;
- var bufSrc = src.data;
- var bufDst = dst.data;
-
- var interpolate = function interpolate(k, kMin, vMin, kMax, vMax) {
+ bilinearInterpolation(src, dst) {
+ const wSrc = src.width;
+ const hSrc = src.height;
+ const wDst = dst.width;
+ const hDst = dst.height;
+ const bufSrc = src.data;
+ const bufDst = dst.data;
+ const interpolate = function (k, kMin, vMin, kMax, vMax) {
// special case - k is integer
if (kMin === kMax) {
return vMin;
}
-
return Math.round((k - kMin) * vMax + (kMax - k) * vMin);
};
+ const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) {
+ let posMin = (yMin * wSrc + xMin) * 4 + offset;
+ let posMax = (yMin * wSrc + xMax) * 4 + offset;
+ const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);
- var assign = function assign(pos, offset, x, xMin, xMax, y, yMin, yMax) {
- var posMin = (yMin * wSrc + xMin) * 4 + offset;
- var posMax = (yMin * wSrc + xMax) * 4 + offset;
- var vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); // special case, y is integer
-
+ // special case, y is integer
if (yMax === yMin) {
bufDst[pos + offset] = vMin;
} else {
posMin = (yMax * wSrc + xMin) * 4 + offset;
posMax = (yMax * wSrc + xMax) * 4 + offset;
- var vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);
+ const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);
bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);
}
};
-
- for (var i = 0; i < hDst; i++) {
- for (var j = 0; j < wDst; j++) {
- var posDst = (i * wDst + j) * 4; // x & y in src coordinates
-
- var x = j * wSrc / wDst;
- var xMin = Math.floor(x);
- var xMax = Math.min(Math.ceil(x), wSrc - 1);
- var y = i * hSrc / hDst;
- var yMin = Math.floor(y);
- var yMax = Math.min(Math.ceil(y), hSrc - 1);
+ for (let i = 0; i < hDst; i++) {
+ for (let j = 0; j < wDst; j++) {
+ const posDst = (i * wDst + j) * 4;
+ // x & y in src coordinates
+ const x = j * wSrc / wDst;
+ const xMin = Math.floor(x);
+ const xMax = Math.min(Math.ceil(x), wSrc - 1);
+ const y = i * hSrc / hDst;
+ const yMin = Math.floor(y);
+ const yMax = Math.min(Math.ceil(y), hSrc - 1);
assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);
assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);
assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);
@@ -92,117 +87,106 @@ module.exports = {
}
}
},
- _interpolate2D: function _interpolate2D(src, dst, options, interpolate) {
- var bufSrc = src.data;
- var bufDst = dst.data;
- var wSrc = src.width;
- var hSrc = src.height;
- var wDst = dst.width;
- var hDst = dst.height; // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares
+ _interpolate2D(src, dst, options, interpolate) {
+ const bufSrc = src.data;
+ const bufDst = dst.data;
+ const wSrc = src.width;
+ const hSrc = src.height;
+ const wDst = dst.width;
+ const hDst = dst.height;
+
+ // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares
+ const wM = Math.max(1, Math.floor(wSrc / wDst));
+ const wDst2 = wDst * wM;
+ const hM = Math.max(1, Math.floor(hSrc / hDst));
+ const hDst2 = hDst * hM;
- var wM = Math.max(1, Math.floor(wSrc / wDst));
- var wDst2 = wDst * wM;
- var hM = Math.max(1, Math.floor(hSrc / hDst));
- var hDst2 = hDst * hM; // ===========================================================
+ // ===========================================================
// Pass 1 - interpolate rows
// buf1 has width of dst2 and height of src
-
- var buf1 = Buffer.alloc(wDst2 * hSrc * 4);
-
- for (var i = 0; i < hSrc; i++) {
- for (var j = 0; j < wDst2; j++) {
+ const buf1 = Buffer.alloc(wDst2 * hSrc * 4);
+ for (let i = 0; i < hSrc; i++) {
+ for (let j = 0; j < wDst2; j++) {
// i in src coords, j in dst coords
+
// calculate x in src coords
// this interpolation requires 4 sample points and the two inner ones must be real
// the outer points can be fudged for the edges.
// therefore (wSrc-1)/wDst2
- var x = j * (wSrc - 1) / wDst2;
- var xPos = Math.floor(x);
- var t = x - xPos;
- var srcPos = (i * wSrc + xPos) * 4;
- var buf1Pos = (i * wDst2 + j) * 4;
-
- for (var k = 0; k < 4; k++) {
- var kPos = srcPos + k;
- var x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];
- var x1 = bufSrc[kPos];
- var x2 = bufSrc[kPos + 4];
- var x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos];
+ const x = j * (wSrc - 1) / wDst2;
+ const xPos = Math.floor(x);
+ const t = x - xPos;
+ const srcPos = (i * wSrc + xPos) * 4;
+ const buf1Pos = (i * wDst2 + j) * 4;
+ for (let k = 0; k < 4; k++) {
+ const kPos = srcPos + k;
+ const x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];
+ const x1 = bufSrc[kPos];
+ const x2 = bufSrc[kPos + 4];
+ const x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos];
buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);
}
}
- } // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg");
+ }
+ // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg");
+
// ===========================================================
// Pass 2 - interpolate columns
// buf2 has width and height of dst2
-
-
- var buf2 = Buffer.alloc(wDst2 * hDst2 * 4);
-
- for (var _i = 0; _i < hDst2; _i++) {
- for (var _j = 0; _j < wDst2; _j++) {
+ const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);
+ for (let i = 0; i < hDst2; i++) {
+ for (let j = 0; j < wDst2; j++) {
// i&j in dst2 coords
+
// calculate y in buf1 coords
// this interpolation requires 4 sample points and the two inner ones must be real
// the outer points can be fudged for the edges.
// therefore (hSrc-1)/hDst2
- var y = _i * (hSrc - 1) / hDst2;
- var yPos = Math.floor(y);
-
- var _t = y - yPos;
-
- var _buf1Pos = (yPos * wDst2 + _j) * 4;
-
- var buf2Pos = (_i * wDst2 + _j) * 4;
-
- for (var _k = 0; _k < 4; _k++) {
- var _kPos = _buf1Pos + _k;
-
- var y0 = yPos > 0 ? buf1[_kPos - wDst2 * 4] : 2 * buf1[_kPos] - buf1[_kPos + wDst2 * 4];
- var y1 = buf1[_kPos];
- var y2 = buf1[_kPos + wDst2 * 4];
- var y3 = yPos < hSrc - 2 ? buf1[_kPos + wDst2 * 8] : 2 * buf1[_kPos + wDst2 * 4] - buf1[_kPos];
- buf2[buf2Pos + _k] = interpolate(y0, y1, y2, y3, _t);
+ const y = i * (hSrc - 1) / hDst2;
+ const yPos = Math.floor(y);
+ const t = y - yPos;
+ const buf1Pos = (yPos * wDst2 + j) * 4;
+ const buf2Pos = (i * wDst2 + j) * 4;
+ for (let k = 0; k < 4; k++) {
+ const kPos = buf1Pos + k;
+ const y0 = yPos > 0 ? buf1[kPos - wDst2 * 4] : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];
+ const y1 = buf1[kPos];
+ const y2 = buf1[kPos + wDst2 * 4];
+ const y3 = yPos < hSrc - 2 ? buf1[kPos + wDst2 * 8] : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];
+ buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);
}
}
- } // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg");
+ }
+ // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg");
+
// ===========================================================
// Pass 3 - scale to dst
-
-
- var m = wM * hM;
-
+ const m = wM * hM;
if (m > 1) {
- for (var _i2 = 0; _i2 < hDst; _i2++) {
- for (var _j2 = 0; _j2 < wDst; _j2++) {
+ for (let i = 0; i < hDst; i++) {
+ for (let j = 0; j < wDst; j++) {
// i&j in dst bounded coords
- var r = 0;
- var g = 0;
- var b = 0;
- var a = 0;
- var realColors = 0;
-
- for (var _y = 0; _y < hM; _y++) {
- var _yPos = _i2 * hM + _y;
-
- for (var _x = 0; _x < wM; _x++) {
- var _xPos = _j2 * wM + _x;
-
- var xyPos = (_yPos * wDst2 + _xPos) * 4;
- var pixelAlpha = buf2[xyPos + 3];
-
+ let r = 0;
+ let g = 0;
+ let b = 0;
+ let a = 0;
+ let realColors = 0;
+ for (let y = 0; y < hM; y++) {
+ const yPos = i * hM + y;
+ for (let x = 0; x < wM; x++) {
+ const xPos = j * wM + x;
+ const xyPos = (yPos * wDst2 + xPos) * 4;
+ const pixelAlpha = buf2[xyPos + 3];
if (pixelAlpha) {
r += buf2[xyPos];
g += buf2[xyPos + 1];
b += buf2[xyPos + 2];
realColors++;
}
-
a += pixelAlpha;
}
}
-
- var pos = (_i2 * wDst + _j2) * 4;
+ const pos = (i * wDst + j) * 4;
bufDst[pos] = realColors ? Math.round(r / realColors) : 0;
bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;
bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;
@@ -214,29 +198,27 @@ module.exports = {
dst.data = buf2;
}
},
- bicubicInterpolation: function bicubicInterpolation(src, dst, options) {
- var interpolateCubic = function interpolateCubic(x0, x1, x2, x3, t) {
- var a0 = x3 - x2 - x0 + x1;
- var a1 = x0 - x1 - a0;
- var a2 = x2 - x0;
- var a3 = x1;
+ bicubicInterpolation(src, dst, options) {
+ const interpolateCubic = function (x0, x1, x2, x3, t) {
+ const a0 = x3 - x2 - x0 + x1;
+ const a1 = x0 - x1 - a0;
+ const a2 = x2 - x0;
+ const a3 = x1;
return Math.max(0, Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3));
};
-
return this._interpolate2D(src, dst, options, interpolateCubic);
},
- hermiteInterpolation: function hermiteInterpolation(src, dst, options) {
- var interpolateHermite = function interpolateHermite(x0, x1, x2, x3, t) {
- var c0 = x1;
- var c1 = 0.5 * (x2 - x0);
- var c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;
- var c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);
+ hermiteInterpolation(src, dst, options) {
+ const interpolateHermite = function (x0, x1, x2, x3, t) {
+ const c0 = x1;
+ const c1 = 0.5 * (x2 - x0);
+ const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;
+ const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);
return Math.max(0, Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0)));
};
-
return this._interpolate2D(src, dst, options, interpolateHermite);
},
- bezierInterpolation: function bezierInterpolation(src, dst, options) {
+ bezierInterpolation(src, dst, options) {
// between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)
// to predict control points (a & b) to be placed at n+0.5
// ya(n) = y(n) + (y(n+1)-y(n-1))/4
@@ -248,19 +230,19 @@ module.exports = {
// y(-1) = y(0) - 2*(y(1)-y(0))
// y(w) = y(w-1) + 2*(y(w-1)-y(w-2))
// but can go with y(-1) = y(0) and y(w) = y(w-1)
- var interpolateBezier = function interpolateBezier(x0, x1, x2, x3, t) {
+ const interpolateBezier = function (x0, x1, x2, x3, t) {
// x1, x2 are the knots, use x0 and x3 to calculate control points
- var cp1 = x1 + (x2 - x0) / 4;
- var cp2 = x2 - (x3 - x1) / 4;
- var nt = 1 - t;
- var c0 = x1 * nt * nt * nt;
- var c1 = 3 * cp1 * nt * nt * t;
- var c2 = 3 * cp2 * nt * t * t;
- var c3 = x2 * t * t * t;
+ const cp1 = x1 + (x2 - x0) / 4;
+ const cp2 = x2 - (x3 - x1) / 4;
+ const nt = 1 - t;
+ const c0 = x1 * nt * nt * nt;
+ const c1 = 3 * cp1 * nt * nt * t;
+ const c2 = 3 * cp2 * nt * t * t;
+ const c3 = x2 * t * t * t;
return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));
};
-
return this._interpolate2D(src, dst, options, interpolateBezier);
}
};
+export default operations;
//# sourceMappingURL=resize2.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map
index 4f96dcce..21edaf92 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map
+++ b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../../src/modules/resize2.js"],"names":["module","exports","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","interpolateBezier","cp1","cp2","nt"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBAA,MAAM,CAACC,OAAP,GAAiB;AACfC,EAAAA,eADe,2BACCC,GADD,EACMC,GADN,EACW;AACxB,QAAMC,IAAI,GAAGF,GAAG,CAACG,KAAjB;AACA,QAAMC,IAAI,GAAGJ,GAAG,CAACK,MAAjB;AAEA,QAAMC,IAAI,GAAGL,GAAG,CAACE,KAAjB;AACA,QAAMI,IAAI,GAAGN,GAAG,CAACI,MAAjB;AAEA,QAAMG,MAAM,GAAGR,GAAG,CAACS,IAAnB;AACA,QAAMC,MAAM,GAAGT,GAAG,CAACQ,IAAnB;;AAEA,SAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGJ,IAApB,EAA0BI,CAAC,EAA3B,EAA+B;AAC7B,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,IAApB,EAA0BM,CAAC,EAA3B,EAA+B;AAC7B,YAAIC,MAAM,GAAG,CAACF,CAAC,GAAGL,IAAJ,GAAWM,CAAZ,IAAiB,CAA9B;AAEA,YAAME,IAAI,GAAGC,IAAI,CAACC,KAAL,CAAYL,CAAC,GAAGP,IAAL,GAAaG,IAAxB,CAAb;AACA,YAAMU,IAAI,GAAGF,IAAI,CAACC,KAAL,CAAYJ,CAAC,GAAGV,IAAL,GAAaI,IAAxB,CAAb;AACA,YAAIY,MAAM,GAAG,CAACJ,IAAI,GAAGZ,IAAP,GAAce,IAAf,IAAuB,CAApC;AAEAP,QAAAA,MAAM,CAACG,MAAM,EAAP,CAAN,GAAmBL,MAAM,CAACU,MAAM,EAAP,CAAzB;AACAR,QAAAA,MAAM,CAACG,MAAM,EAAP,CAAN,GAAmBL,MAAM,CAACU,MAAM,EAAP,CAAzB;AACAR,QAAAA,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,UAAMkC,GAAG,GAAGhC,EAAE,GAAG,CAACC,EAAE,GAAGF,EAAN,IAAY,CAA7B;AACA,UAAMkC,EAAE,GAAG,IAAIvC,CAAf;AACA,UAAM+B,EAAE,GAAG1B,EAAE,GAAGkC,EAAL,GAAUA,EAAV,GAAeA,EAA1B;AACA,UAAMP,EAAE,GAAG,IAAIK,GAAJ,GAAUE,EAAV,GAAeA,EAAf,GAAoBvC,CAA/B;AACA,UAAMiC,EAAE,GAAG,IAAIK,GAAJ,GAAUC,EAAV,GAAevC,CAAf,GAAmBA,CAA9B;AACA,UAAMkC,EAAE,GAAG5B,EAAE,GAAGN,CAAL,GAASA,CAAT,GAAaA,CAAxB;AACA,aAAOpC,IAAI,CAAC4B,GAAL,CAAS,CAAT,EAAY5B,IAAI,CAACuB,GAAL,CAAS,GAAT,EAAcvB,IAAI,CAACW,KAAL,CAAWwD,EAAE,GAAGC,EAAL,GAAUC,EAAV,GAAeC,EAA1B,CAAd,CAAZ,CAAP;AACD,KAVD;;AAYA,WAAO,KAAK7C,cAAL,CAAoBxC,GAApB,EAAyBC,GAAzB,EAA8BwC,OAA9B,EAAuC8C,iBAAvC,CAAP;AACD;AA7Qc,CAAjB","sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nmodule.exports = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function(k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function(pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function(x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function(x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function(x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n }\n};\n"],"file":"resize2.js"}
\ No newline at end of file
+{"version":3,"file":"resize2.js","names":["operations","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","interpolateBezier","cp1","cp2","nt"],"sources":["../../src/modules/resize2.js"],"sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nconst operations = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function (k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function (x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function (x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function (x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n },\n};\n\nexport default operations;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,UAAU,GAAG;EACjBC,eAAe,CAACC,GAAG,EAAEC,GAAG,EAAE;IACxB,MAAMC,IAAI,GAAGF,GAAG,CAACG,KAAK;IACtB,MAAMC,IAAI,GAAGJ,GAAG,CAACK,MAAM;IAEvB,MAAMC,IAAI,GAAGL,GAAG,CAACE,KAAK;IACtB,MAAMI,IAAI,GAAGN,GAAG,CAACI,MAAM;IAEvB,MAAMG,MAAM,GAAGR,GAAG,CAACS,IAAI;IACvB,MAAMC,MAAM,GAAGT,GAAG,CAACQ,IAAI;IAEvB,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,IAAI,EAAEI,CAAC,EAAE,EAAE;MAC7B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,IAAI,EAAEM,CAAC,EAA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,IAAI,CAAC;MAC9B,MAAMkC,EAAE,GAAG,CAAC,GAAGvC,CAAC;MAChB,MAAM+B,EAAE,GAAG1B,EAAE,GAAGkC,EAAE,GAAGA,EAAE,GAAGA,EAAE;MAC5B,MAAMP,EAAE,GAAG,CAAC,GAAGK,GAAG,GAAGE,EAAE,GAAGA,EAAE,GAAGvC,CAAC;MAChC,MAAMiC,EAAE,GAAG,CAAC,GAAGK,GAAG,GAAGC,EAAE,GAAGvC,CAAC,GAAGA,CAAC;MAC/B,MAAMkC,EAAE,GAAG5B,EAAE,GAAGN,CAAC,GAAGA,CAAC,GAAGA,CAAC;MACzB,OAAOpC,IAAI,CAAC4B,GAAG,CAAC,CAAC,EAAE5B,IAAI,CAACuB,GAAG,CAAC,GAAG,EAAEvB,IAAI,CAACW,KAAK,CAACwD,EAAE,GAAGC,EAAE,GAAGC,EAAE,GAAGC,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,IAAI,CAAC7C,cAAc,CAACxC,GAAG,EAAEC,GAAG,EAAEwC,OAAO,EAAE8C,iBAAiB,CAAC;EAClE;AACF,CAAC;AAED,eAAezF,UAAU"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-resize/index.d.ts b/project starter code/node_modules/@jimp/plugin-resize/index.d.ts
index 24349ad2..58b3cdcb 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-resize/index.d.ts
@@ -1,4 +1,4 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface ResizeClass {
resize(w: number, h: number, cb?: ImageCallback): this;
@@ -8,14 +8,14 @@ interface ResizeClass {
interface Resize {
constants: {
// resize methods
- RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor';
- RESIZE_BILINEAR: 'bilinearInterpolation';
- RESIZE_BICUBIC: 'bicubicInterpolation';
- RESIZE_HERMITE: 'hermiteInterpolation';
- RESIZE_BEZIER: 'bezierInterpolation';
- }
+ RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor";
+ RESIZE_BILINEAR: "bilinearInterpolation";
+ RESIZE_BICUBIC: "bicubicInterpolation";
+ RESIZE_HERMITE: "hermiteInterpolation";
+ RESIZE_BEZIER: "bezierInterpolation";
+ };
- class: ResizeClass
+ class: ResizeClass;
}
-export default function(): Resize;
+export default function (): Resize;
diff --git a/project starter code/node_modules/@jimp/plugin-resize/package.json b/project starter code/node_modules/@jimp/plugin-resize/package.json
index c34c3cad..1e955a96 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/package.json
+++ b/project starter code/node_modules/@jimp/plugin-resize/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-resize",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Resize an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,18 +21,17 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-resize/src/index.js b/project starter code/node_modules/@jimp/plugin-resize/src/index.js
index fb6e05ab..5b269d54 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-resize/src/index.js
@@ -1,15 +1,15 @@
-import { throwError, isNodePattern } from '@jimp/utils';
+import { throwError, isNodePattern } from "@jimp/utils";
-import Resize from './modules/resize';
-import Resize2 from './modules/resize2';
+import Resize from "./modules/resize";
+import Resize2 from "./modules/resize2";
export default () => ({
constants: {
- RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor',
- RESIZE_BILINEAR: 'bilinearInterpolation',
- RESIZE_BICUBIC: 'bicubicInterpolation',
- RESIZE_HERMITE: 'hermiteInterpolation',
- RESIZE_BEZIER: 'bezierInterpolation'
+ RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor",
+ RESIZE_BILINEAR: "bilinearInterpolation",
+ RESIZE_BICUBIC: "bicubicInterpolation",
+ RESIZE_HERMITE: "hermiteInterpolation",
+ RESIZE_BEZIER: "bezierInterpolation",
},
class: {
@@ -22,17 +22,17 @@ export default () => ({
* @returns {Jimp} this for chaining of methods
*/
resize(w, h, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return throwError.call(this, 'w and h must be numbers', cb);
+ if (typeof w !== "number" || typeof h !== "number") {
+ return throwError.call(this, "w and h must be numbers", cb);
}
- if (typeof mode === 'function' && typeof cb === 'undefined') {
+ if (typeof mode === "function" && typeof cb === "undefined") {
cb = mode;
mode = null;
}
if (w === this.constructor.AUTO && h === this.constructor.AUTO) {
- return throwError.call(this, 'w and h cannot both be set to auto', cb);
+ return throwError.call(this, "w and h cannot both be set to auto", cb);
}
if (w === this.constructor.AUTO) {
@@ -44,18 +44,18 @@ export default () => ({
}
if (w < 0 || h < 0) {
- return throwError.call(this, 'w and h must be positive numbers', cb);
+ return throwError.call(this, "w and h must be positive numbers", cb);
}
// round inputs
- w = Math.round(w);
- h = Math.round(h);
+ w = Math.round(w) || 1;
+ h = Math.round(h) || 1;
- if (typeof Resize2[mode] === 'function') {
+ if (typeof Resize2[mode] === "function") {
const dst = {
data: Buffer.alloc(w * h * 4),
width: w,
- height: h
+ height: h,
};
Resize2[mode](this.bitmap, dst);
this.bitmap = dst;
@@ -68,7 +68,7 @@ export default () => ({
h,
true,
true,
- buffer => {
+ (buffer) => {
image.bitmap.data = Buffer.from(buffer);
image.bitmap.width = w;
image.bitmap.height = h;
@@ -82,6 +82,6 @@ export default () => ({
}
return this;
- }
- }
+ },
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js b/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js
index 3e6de412..9fea5ed2 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js
+++ b/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js
@@ -17,7 +17,7 @@ function Resize(
this.colorChannels = blendAlpha ? 4 : 3;
this.interpolationPass = Boolean(interpolationPass);
this.resizeCallback =
- typeof resizeCallback === 'function' ? resizeCallback : function() {};
+ typeof resizeCallback === "function" ? resizeCallback : function () {};
this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;
this.originalWidthMultipliedByChannels =
@@ -31,7 +31,7 @@ function Resize(
this.initialize();
}
-Resize.prototype.initialize = function() {
+Resize.prototype.initialize = function () {
// Perform some checks:
if (
this.widthOriginal > 0 &&
@@ -41,11 +41,11 @@ Resize.prototype.initialize = function() {
) {
this.configurePasses();
} else {
- throw new Error('Invalid settings specified for the resizer.');
+ throw new Error("Invalid settings specified for the resizer.");
}
};
-Resize.prototype.configurePasses = function() {
+Resize.prototype.configurePasses = function () {
if (this.widthOriginal === this.targetWidth) {
// Bypass the width resizer pass:
this.resizeWidth = this.bypassResizer;
@@ -82,7 +82,7 @@ Resize.prototype.configurePasses = function() {
}
};
-Resize.prototype._resizeWidthInterpolatedRGBChannels = function(
+Resize.prototype._resizeWidthInterpolatedRGBChannels = function (
buffer,
fourthChannel
) {
@@ -178,7 +178,7 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function(
return outputBuffer;
};
-Resize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) {
+Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {
const channelsNum = fourthChannel ? 4 : 3;
const ratioWeight = this.ratioWeightWidthPass;
const ratioWeightDivisor = 1 / ratioWeight;
@@ -275,7 +275,7 @@ Resize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) {
return outputBuffer;
};
-Resize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) {
+Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {
const ratioWeight = this.ratioWeightHeightPass;
const ratioWeightDivisor = 1 / ratioWeight;
const output = this.outputHeightWorkBench;
@@ -380,23 +380,23 @@ Resize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) {
return outputBuffer;
};
-Resize.prototype.resizeWidthInterpolatedRGB = function(buffer) {
+Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) {
return this._resizeWidthInterpolatedRGBChannels(buffer, false);
};
-Resize.prototype.resizeWidthInterpolatedRGBA = function(buffer) {
+Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) {
return this._resizeWidthInterpolatedRGBChannels(buffer, true);
};
-Resize.prototype.resizeWidthRGB = function(buffer) {
+Resize.prototype.resizeWidthRGB = function (buffer) {
return this._resizeWidthRGBChannels(buffer, false);
};
-Resize.prototype.resizeWidthRGBA = function(buffer) {
+Resize.prototype.resizeWidthRGBA = function (buffer) {
return this._resizeWidthRGBChannels(buffer, true);
};
-Resize.prototype.resizeHeightInterpolated = function(buffer) {
+Resize.prototype.resizeHeightInterpolated = function (buffer) {
const ratioWeight = this.ratioWeightHeightPass;
const outputBuffer = this.heightBuffer;
@@ -467,24 +467,24 @@ Resize.prototype.resizeHeightInterpolated = function(buffer) {
return outputBuffer;
};
-Resize.prototype.resizeHeightRGB = function(buffer) {
+Resize.prototype.resizeHeightRGB = function (buffer) {
return this._resizeHeightRGBChannels(buffer, false);
};
-Resize.prototype.resizeHeightRGBA = function(buffer) {
+Resize.prototype.resizeHeightRGBA = function (buffer) {
return this._resizeHeightRGBChannels(buffer, true);
};
-Resize.prototype.resize = function(buffer) {
+Resize.prototype.resize = function (buffer) {
this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));
};
-Resize.prototype.bypassResizer = function(buffer) {
+Resize.prototype.bypassResizer = function (buffer) {
// Just return the buffer passed:
return buffer;
};
-Resize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) {
+Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) {
// Initialize the internal width pass buffers:
this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);
@@ -501,7 +501,7 @@ Resize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) {
}
};
-Resize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) {
+Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) {
// Initialize the internal height pass buffers:
this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);
@@ -518,7 +518,7 @@ Resize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) {
}
};
-Resize.prototype.generateFloatBuffer = function(bufferLength) {
+Resize.prototype.generateFloatBuffer = function (bufferLength) {
// Generate a float32 typed array buffer:
try {
return new Float32Array(bufferLength);
@@ -527,7 +527,7 @@ Resize.prototype.generateFloatBuffer = function(bufferLength) {
}
};
-Resize.prototype.generateFloat64Buffer = function(bufferLength) {
+Resize.prototype.generateFloat64Buffer = function (bufferLength) {
// Generate a float64 typed array buffer:
try {
return new Float64Array(bufferLength);
@@ -536,7 +536,7 @@ Resize.prototype.generateFloat64Buffer = function(bufferLength) {
}
};
-Resize.prototype.generateUint8Buffer = function(bufferLength) {
+Resize.prototype.generateUint8Buffer = function (bufferLength) {
// Generate a uint8 typed array buffer:
try {
return new Uint8Array(bufferLength);
@@ -545,4 +545,4 @@ Resize.prototype.generateUint8Buffer = function(bufferLength) {
}
};
-module.exports = Resize;
+export default Resize;
diff --git a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js b/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js
index 1e54df8c..3774144d 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js
+++ b/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js
@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
-module.exports = {
+const operations = {
nearestNeighbor(src, dst) {
const wSrc = src.width;
const hSrc = src.height;
@@ -57,7 +57,7 @@ module.exports = {
const bufSrc = src.data;
const bufDst = dst.data;
- const interpolate = function(k, kMin, vMin, kMax, vMax) {
+ const interpolate = function (k, kMin, vMin, kMax, vMax) {
// special case - k is integer
if (kMin === kMax) {
return vMin;
@@ -66,7 +66,7 @@ module.exports = {
return Math.round((k - kMin) * vMax + (kMax - k) * vMin);
};
- const assign = function(pos, offset, x, xMin, xMax, y, yMin, yMax) {
+ const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) {
let posMin = (yMin * wSrc + xMin) * 4 + offset;
let posMax = (yMin * wSrc + xMax) * 4 + offset;
const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);
@@ -235,7 +235,7 @@ module.exports = {
},
bicubicInterpolation(src, dst, options) {
- const interpolateCubic = function(x0, x1, x2, x3, t) {
+ const interpolateCubic = function (x0, x1, x2, x3, t) {
const a0 = x3 - x2 - x0 + x1;
const a1 = x0 - x1 - a0;
const a2 = x2 - x0;
@@ -250,7 +250,7 @@ module.exports = {
},
hermiteInterpolation(src, dst, options) {
- const interpolateHermite = function(x0, x1, x2, x3, t) {
+ const interpolateHermite = function (x0, x1, x2, x3, t) {
const c0 = x1;
const c1 = 0.5 * (x2 - x0);
const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;
@@ -276,7 +276,7 @@ module.exports = {
// y(-1) = y(0) - 2*(y(1)-y(0))
// y(w) = y(w-1) + 2*(y(w-1)-y(w-2))
// but can go with y(-1) = y(0) and y(w) = y(w-1)
- const interpolateBezier = function(x0, x1, x2, x3, t) {
+ const interpolateBezier = function (x0, x1, x2, x3, t) {
// x1, x2 are the knots, use x0 and x3 to calculate control points
const cp1 = x1 + (x2 - x0) / 4;
const cp2 = x2 - (x3 - x1) / 4;
@@ -289,5 +289,7 @@ module.exports = {
};
return this._interpolate2D(src, dst, options, interpolateBezier);
- }
+ },
};
+
+export default operations;
diff --git a/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js b/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js
index 93f58706..5a6d1c40 100644
--- a/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js
+++ b/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js
@@ -1,586 +1,275 @@
-import { Jimp, mkJGD, hashForEach } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, mkJGD, hashForEach } from "@jimp/test-utils";
+import configure from "@jimp/custom";
-import resize from '../src';
+import resize from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [resize] }, Jimp);
-describe('Resize images', () => {
+describe("Resize images", () => {
const testImages = [
{
- title: 'max contrast 8x8',
+ title: "max contrast 8x8",
src: jimp.read(
mkJGD(
- '■■■■□□□□',
- '■■■■□□□□',
- '■■■■□□□□',
- '■■■■□□□□',
- '□□□□■■■■',
- '□□□□■■■■',
- '□□□□■■■■',
- '□□□□■■■■'
+ "■■■■□□□□",
+ "■■■■□□□□",
+ "■■■■□□□□",
+ "■■■■□□□□",
+ "□□□□■■■■",
+ "□□□□■■■■",
+ "□□□□■■■■",
+ "□□□□■■■■"
)
),
results: {
- 'default 4x4': mkJGD('■■□□', '■■□□', '□□■■', '□□■■'),
- 'NEAREST_NEIGHBOR 4x4': mkJGD('■■□□', '■■□□', '□□■■', '□□■■'),
- 'BILINEAR 4x4': mkJGD('■■□□', '■■□□', '□□■■', '□□■■'),
- 'BICUBIC 4x4': {
+ "default 4x4": mkJGD("■■□□", "■■□□", "□□■■", "□□■■"),
+ "NEAREST_NEIGHBOR 4x4": mkJGD("■■□□", "■■□□", "□□■■", "□□■■"),
+ "BILINEAR 4x4": mkJGD("■■□□", "■■□□", "□□■■", "□□■■"),
+ "BICUBIC 4x4": {
width: 4,
height: 4,
data: [
+ 0x000000ff, 0x000000ff, 0xbfbfbfff, 0xffffffff, 0x000000ff,
+ 0x000000ff, 0xbfbfbfff, 0xffffffff, 0xbfbfbfff, 0xbfbfbfff,
+ 0x5f5f5fff, 0x404040ff, 0xffffffff, 0xffffffff, 0x404040ff,
0x000000ff,
- 0x000000ff,
- 0xbfbfbfff,
- 0xffffffff,
- 0x000000ff,
- 0x000000ff,
- 0xbfbfbfff,
- 0xffffffff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x5f5f5fff,
- 0x404040ff,
- 0xffffffff,
- 0xffffffff,
- 0x404040ff,
- 0x000000ff
- ]
+ ],
},
- 'HERMITE 4x4': {
+ "HERMITE 4x4": {
width: 4,
height: 4,
data: [
+ 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0x000000ff,
+ 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff,
+ 0x606060ff, 0x404040ff, 0xffffffff, 0xffffffff, 0x404040ff,
0x000000ff,
- 0x000000ff,
- 0xc0c0c0ff,
- 0xffffffff,
- 0x000000ff,
- 0x000000ff,
- 0xc0c0c0ff,
- 0xffffffff,
- 0xc0c0c0ff,
- 0xc0c0c0ff,
- 0x606060ff,
- 0x404040ff,
- 0xffffffff,
- 0xffffffff,
- 0x404040ff,
- 0x000000ff
- ]
+ ],
},
- 'BEZIER 4x4': {
+ "BEZIER 4x4": {
width: 4,
height: 4,
data: [
+ 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0x000000ff,
+ 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff,
+ 0x606060ff, 0x404040ff, 0xffffffff, 0xffffffff, 0x404040ff,
0x000000ff,
- 0x000000ff,
- 0xc0c0c0ff,
- 0xffffffff,
- 0x000000ff,
- 0x000000ff,
- 0xc0c0c0ff,
- 0xffffffff,
- 0xc0c0c0ff,
- 0xc0c0c0ff,
- 0x606060ff,
- 0x404040ff,
- 0xffffffff,
- 0xffffffff,
- 0x404040ff,
- 0x000000ff
- ]
+ ],
},
- 'default 5x2': mkJGD('■■▦□□', '□□▦■■'),
- 'NEAREST_NEIGHBOR 5x2': mkJGD('■■■□□', '□□□■■'),
- 'BILINEAR 5x2': mkJGD('■■3□□', '□□C■■'),
- 'BICUBIC 5x2': {
+ "default 5x2": mkJGD("■■▦□□", "□□▦■■"),
+ "NEAREST_NEIGHBOR 5x2": mkJGD("■■■□□", "□□□■■"),
+ "BILINEAR 5x2": mkJGD("■■3□□", "□□C■■"),
+ "BICUBIC 5x2": {
width: 5,
height: 2,
data: [
- 0x000000ff,
- 0x000000ff,
- 0x000000ff,
- 0xffffffff,
- 0xffffffff,
- 0xdfdfdfff,
- 0xdfdfdfff,
- 0xdfdfdfff,
- 0x202020ff,
- 0x202020ff
- ]
+ 0x000000ff, 0x000000ff, 0x000000ff, 0xffffffff, 0xffffffff,
+ 0xdfdfdfff, 0xdfdfdfff, 0xdfdfdfff, 0x202020ff, 0x202020ff,
+ ],
},
- 'HERMITE 5x2': {
+ "HERMITE 5x2": {
width: 5,
height: 2,
data: [
- 0x000000ff,
- 0x000000ff,
- 0x000000ff,
- 0xffffffff,
- 0xffffffff,
- 0xdfdfdfff,
- 0xdfdfdfff,
- 0xdfdfdfff,
- 0x202020ff,
- 0x202020ff
- ]
+ 0x000000ff, 0x000000ff, 0x000000ff, 0xffffffff, 0xffffffff,
+ 0xdfdfdfff, 0xdfdfdfff, 0xdfdfdfff, 0x202020ff, 0x202020ff,
+ ],
},
- 'BEZIER 5x2': {
+ "BEZIER 5x2": {
width: 5,
height: 2,
data: [
- 0x000000ff,
- 0x000000ff,
- 0x000000ff,
- 0xffffffff,
- 0xffffffff,
- 0xdfdfdfff,
- 0xdfdfdfff,
- 0xdfdfdfff,
- 0x202020ff,
- 0x202020ff
- ]
- }
- }
+ 0x000000ff, 0x000000ff, 0x000000ff, 0xffffffff, 0xffffffff,
+ 0xdfdfdfff, 0xdfdfdfff, 0xdfdfdfff, 0x202020ff, 0x202020ff,
+ ],
+ },
+ },
},
/**********************************************************************/
{
- title: 'max contrast 12x12 with dots',
+ title: "max contrast 12x12 with dots",
src: jimp.read(
mkJGD(
- '■■■■■■□□□□□□',
- '■■■■■■□□□□□□',
- '■■■□■■□□■□□□',
- '■■■■■■□□□□□□',
- '■■■■■■□□□□□□',
- '■■■■■■□□□□□□',
- '□□□□□□■■■■■■',
- '□□□□□□■■■■■■',
- '□□□□□□■■■■■■',
- '□□□■□□■■□■■■',
- '□□□□□□■■■■■■',
- '□□□□□□■■■■■■'
+ "■■■■■■□□□□□□",
+ "■■■■■■□□□□□□",
+ "■■■□■■□□■□□□",
+ "■■■■■■□□□□□□",
+ "■■■■■■□□□□□□",
+ "■■■■■■□□□□□□",
+ "□□□□□□■■■■■■",
+ "□□□□□□■■■■■■",
+ "□□□□□□■■■■■■",
+ "□□□■□□■■□■■■",
+ "□□□□□□■■■■■■",
+ "□□□□□□■■■■■■"
)
),
results: {
- 'default 6x6': mkJGD(
- '■■■□□□',
- '■▩■□▥□',
- '■■■□□□',
- '□□□■■■',
- '□▥□■▩■',
- '□□□■■■'
+ "default 6x6": mkJGD(
+ "■■■□□□",
+ "■▩■□▥□",
+ "■■■□□□",
+ "□□□■■■",
+ "□▥□■▩■",
+ "□□□■■■"
),
- 'NEAREST_NEIGHBOR 6x6': mkJGD(
- '■■■□□□',
- '■■■□■□',
- '■■■□□□',
- '□□□■■■',
- '□□□■■■',
- '□□□■■■'
+ "NEAREST_NEIGHBOR 6x6": mkJGD(
+ "■■■□□□",
+ "■■■□■□",
+ "■■■□□□",
+ "□□□■■■",
+ "□□□■■■",
+ "□□□■■■"
),
- 'BILINEAR 6x6': mkJGD(
- '■■■□□□',
- '■■■□■□',
- '■■■□□□',
- '□□□■■■',
- '□□□■■■',
- '□□□■■■'
+ "BILINEAR 6x6": mkJGD(
+ "■■■□□□",
+ "■■■□■□",
+ "■■■□□□",
+ "□□□■■■",
+ "□□□■■■",
+ "□□□■■■"
),
- 'BICUBIC 6x6': {
+ "BICUBIC 6x6": {
width: 6,
height: 6,
data: [
- 0x000000ff,
- 0x000000ff,
- 0x000000ff,
- 0xbfbfbfff,
- 0xffffffff,
- 0xffffffff,
- 0x000000ff,
- 0x474747ff,
- 0x202020ff,
- 0xbfbfbfff,
- 0x979797ff,
- 0xffffffff,
- 0x000000ff,
- 0x000000ff,
- 0x000000ff,
- 0xbfbfbfff,
- 0xffffffff,
- 0xffffffff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x5f5f5fff,
- 0x404040ff,
- 0x404040ff,
- 0xffffffff,
- 0xeeeeeeff,
- 0xf7f7f7ff,
- 0x404040ff,
- 0x181818ff,
- 0x000000ff,
- 0xffffffff,
- 0xc9c9c9ff,
- 0xe6e6e6ff,
- 0x404040ff,
- 0x4e4e4eff,
- 0x000000ff
- ]
+ 0x000000ff, 0x000000ff, 0x000000ff, 0xbfbfbfff, 0xffffffff,
+ 0xffffffff, 0x000000ff, 0x474747ff, 0x202020ff, 0xbfbfbfff,
+ 0x979797ff, 0xffffffff, 0x000000ff, 0x000000ff, 0x000000ff,
+ 0xbfbfbfff, 0xffffffff, 0xffffffff, 0xbfbfbfff, 0xbfbfbfff,
+ 0xbfbfbfff, 0x5f5f5fff, 0x404040ff, 0x404040ff, 0xffffffff,
+ 0xeeeeeeff, 0xf7f7f7ff, 0x404040ff, 0x181818ff, 0x000000ff,
+ 0xffffffff, 0xc9c9c9ff, 0xe6e6e6ff, 0x404040ff, 0x4e4e4eff,
+ 0x000000ff,
+ ],
},
- 'HERMITE 6x6': {
+ "HERMITE 6x6": {
width: 6,
height: 6,
data: [
- 0x000000ff,
- 0x000000ff,
- 0x000000ff,
- 0xc0c0c0ff,
- 0xffffffff,
- 0xffffffff,
- 0x000000ff,
- 0x404040ff,
- 0x191919ff,
- 0xc0c0c0ff,
- 0xa6a6a6ff,
- 0xffffffff,
- 0x000000ff,
- 0x000000ff,
- 0x000000ff,
- 0xc0c0c0ff,
- 0xffffffff,
- 0xffffffff,
- 0xc0c0c0ff,
- 0xc0c0c0ff,
- 0xc0c0c0ff,
- 0x606060ff,
- 0x404040ff,
- 0x404040ff,
- 0xffffffff,
- 0xf3f3f3ff,
- 0xfafafaff,
- 0x404040ff,
- 0x111111ff,
- 0x000000ff,
- 0xffffffff,
- 0xcbcbcbff,
- 0xebebebff,
- 0x404040ff,
- 0x484848ff,
- 0x000000ff
- ]
+ 0x000000ff, 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff,
+ 0xffffffff, 0x000000ff, 0x404040ff, 0x191919ff, 0xc0c0c0ff,
+ 0xa6a6a6ff, 0xffffffff, 0x000000ff, 0x000000ff, 0x000000ff,
+ 0xc0c0c0ff, 0xffffffff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff,
+ 0xc0c0c0ff, 0x606060ff, 0x404040ff, 0x404040ff, 0xffffffff,
+ 0xf3f3f3ff, 0xfafafaff, 0x404040ff, 0x111111ff, 0x000000ff,
+ 0xffffffff, 0xcbcbcbff, 0xebebebff, 0x404040ff, 0x484848ff,
+ 0x000000ff,
+ ],
},
- 'BEZIER 6x6': {
+ "BEZIER 6x6": {
width: 6,
height: 6,
data: [
- 0x000000ff,
- 0x000000ff,
- 0x000000ff,
- 0xc0c0c0ff,
- 0xffffffff,
- 0xffffffff,
- 0x000000ff,
- 0x444444ff,
- 0x1d1d1dff,
- 0xc0c0c0ff,
- 0x9f9f9fff,
- 0xffffffff,
- 0x000000ff,
- 0x000000ff,
- 0x000000ff,
- 0xc0c0c0ff,
- 0xffffffff,
- 0xffffffff,
- 0xc0c0c0ff,
- 0xc0c0c0ff,
- 0xc0c0c0ff,
- 0x606060ff,
- 0x404040ff,
- 0x404040ff,
- 0xffffffff,
- 0xf0f0f0ff,
- 0xf9f9f9ff,
- 0x404040ff,
- 0x151515ff,
- 0x000000ff,
- 0xffffffff,
- 0xcacacaff,
- 0xe9e9e9ff,
- 0x404040ff,
- 0x4b4b4bff,
- 0x000000ff
- ]
- }
- }
+ 0x000000ff, 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff,
+ 0xffffffff, 0x000000ff, 0x444444ff, 0x1d1d1dff, 0xc0c0c0ff,
+ 0x9f9f9fff, 0xffffffff, 0x000000ff, 0x000000ff, 0x000000ff,
+ 0xc0c0c0ff, 0xffffffff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff,
+ 0xc0c0c0ff, 0x606060ff, 0x404040ff, 0x404040ff, 0xffffffff,
+ 0xf0f0f0ff, 0xf9f9f9ff, 0x404040ff, 0x151515ff, 0x000000ff,
+ 0xffffffff, 0xcacacaff, 0xe9e9e9ff, 0x404040ff, 0x4b4b4bff,
+ 0x000000ff,
+ ],
+ },
+ },
},
/**********************************************************************/
{
- title: 'mutch contrast 4x4',
- src: jimp.read(mkJGD('▩▩▥▥', '▩▩▥▥', '▥▥▩▩', '▥▥▩▩')),
+ title: "mutch contrast 4x4",
+ src: jimp.read(mkJGD("▩▩▥▥", "▩▩▥▥", "▥▥▩▩", "▥▥▩▩")),
results: {
- 'default 6x6': {
+ "default 6x6": {
width: 6,
height: 6,
data: [
- 0x404040ff,
- 0x404040ff,
- 0x404040ff,
- 0x959595ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x404040ff,
- 0x404040ff,
- 0x404040ff,
- 0x959595ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x404040ff,
- 0x404040ff,
- 0x404040ff,
- 0x959595ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x959595ff,
- 0x959595ff,
- 0x959595ff,
- 0x787878ff,
- 0x6a6a6aff,
- 0x6a6a6aff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x6a6a6aff,
- 0x404040ff,
- 0x404040ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x6a6a6aff,
- 0x404040ff,
- 0x404040ff
- ]
+ 0x404040ff, 0x404040ff, 0x404040ff, 0x959595ff, 0xbfbfbfff,
+ 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, 0x959595ff,
+ 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff,
+ 0x959595ff, 0xbfbfbfff, 0xbfbfbfff, 0x959595ff, 0x959595ff,
+ 0x959595ff, 0x787878ff, 0x6a6a6aff, 0x6a6a6aff, 0xbfbfbfff,
+ 0xbfbfbfff, 0xbfbfbfff, 0x6a6a6aff, 0x404040ff, 0x404040ff,
+ 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0x6a6a6aff, 0x404040ff,
+ 0x404040ff,
+ ],
},
- 'NEAREST_NEIGHBOR 6x6': {
+ "NEAREST_NEIGHBOR 6x6": {
width: 6,
height: 6,
data: [
- 0x404040ff,
- 0x404040ff,
- 0x404040ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x404040ff,
- 0x404040ff,
- 0x404040ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x404040ff,
- 0x404040ff,
- 0x404040ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x404040ff,
- 0x404040ff,
- 0x404040ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x404040ff,
- 0x404040ff,
- 0x404040ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x404040ff,
- 0x404040ff,
- 0x404040ff
- ]
+ 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff, 0xbfbfbfff,
+ 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff,
+ 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff,
+ 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff,
+ 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff,
+ 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff,
+ 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff,
+ 0x404040ff,
+ ],
},
- 'BILINEAR 6x6': {
+ "BILINEAR 6x6": {
width: 6,
height: 6,
data: [
- 0x404040ff,
- 0x404040ff,
- 0x6a6a6aff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x404040ff,
- 0x404040ff,
- 0x6a6a6aff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x6a6a6aff,
- 0x6a6a6aff,
- 0x787878ff,
- 0x959595ff,
- 0x959595ff,
- 0x959595ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x959595ff,
- 0x404040ff,
- 0x404040ff,
- 0x404040ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x959595ff,
- 0x404040ff,
- 0x404040ff,
- 0x404040ff,
- 0xbfbfbfff,
- 0xbfbfbfff,
- 0x959595ff,
- 0x404040ff,
- 0x404040ff,
- 0x404040ff
- ]
+ 0x404040ff, 0x404040ff, 0x6a6a6aff, 0xbfbfbfff, 0xbfbfbfff,
+ 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x6a6a6aff, 0xbfbfbfff,
+ 0xbfbfbfff, 0xbfbfbfff, 0x6a6a6aff, 0x6a6a6aff, 0x787878ff,
+ 0x959595ff, 0x959595ff, 0x959595ff, 0xbfbfbfff, 0xbfbfbfff,
+ 0x959595ff, 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff,
+ 0xbfbfbfff, 0x959595ff, 0x404040ff, 0x404040ff, 0x404040ff,
+ 0xbfbfbfff, 0xbfbfbfff, 0x959595ff, 0x404040ff, 0x404040ff,
+ 0x404040ff,
+ ],
},
- 'BICUBIC 6x6': {
+ "BICUBIC 6x6": {
width: 6,
height: 6,
data: [
- 0x404040ff,
- 0x303030ff,
- 0x404040ff,
- 0x7f7f7fff,
- 0xbfbfbfff,
- 0xcececeff,
- 0x303030ff,
+ 0x404040ff, 0x303030ff, 0x404040ff, 0x7f7f7fff, 0xbfbfbfff,
+ 0xcececeff, 0x303030ff, 0x1c1c1cff, 0x303030ff, 0x7f7f7fff,
+ 0xcececeff, 0xe1e1e1ff, 0x404040ff, 0x303030ff, 0x404040ff,
+ 0x7f7f7fff, 0xbfbfbfff, 0xcececeff, 0x7f7f7fff, 0x7f7f7fff,
+ 0x7f7f7fff, 0x7f7f7fff, 0x7f7f7fff, 0x7f7f7fff, 0xbfbfbfff,
+ 0xcececeff, 0xbfbfbfff, 0x7f7f7fff, 0x404040ff, 0x303030ff,
+ 0xcececeff, 0xe1e1e1ff, 0xcececeff, 0x7f7f7fff, 0x303030ff,
0x1c1c1cff,
- 0x303030ff,
- 0x7f7f7fff,
- 0xcececeff,
- 0xe1e1e1ff,
- 0x404040ff,
- 0x303030ff,
- 0x404040ff,
- 0x7f7f7fff,
- 0xbfbfbfff,
- 0xcececeff,
- 0x7f7f7fff,
- 0x7f7f7fff,
- 0x7f7f7fff,
- 0x7f7f7fff,
- 0x7f7f7fff,
- 0x7f7f7fff,
- 0xbfbfbfff,
- 0xcececeff,
- 0xbfbfbfff,
- 0x7f7f7fff,
- 0x404040ff,
- 0x303030ff,
- 0xcececeff,
- 0xe1e1e1ff,
- 0xcececeff,
- 0x7f7f7fff,
- 0x303030ff,
- 0x1c1c1cff
- ]
+ ],
},
- 'HERMITE 6x6': {
+ "HERMITE 6x6": {
width: 6,
height: 6,
data: [
- 0x404040ff,
- 0x383838ff,
- 0x404040ff,
- 0x808080ff,
- 0xbfbfbfff,
- 0xc7c7c7ff,
- 0x383838ff,
+ 0x404040ff, 0x383838ff, 0x404040ff, 0x808080ff, 0xbfbfbfff,
+ 0xc7c7c7ff, 0x383838ff, 0x2f2f2fff, 0x383838ff, 0x808080ff,
+ 0xc7c7c7ff, 0xd0d0d0ff, 0x404040ff, 0x383838ff, 0x404040ff,
+ 0x808080ff, 0xbfbfbfff, 0xc7c7c7ff, 0x808080ff, 0x808080ff,
+ 0x808080ff, 0x808080ff, 0x808080ff, 0x808080ff, 0xbfbfbfff,
+ 0xc7c7c7ff, 0xbfbfbfff, 0x808080ff, 0x404040ff, 0x383838ff,
+ 0xc7c7c7ff, 0xd0d0d0ff, 0xc7c7c7ff, 0x808080ff, 0x383838ff,
0x2f2f2fff,
- 0x383838ff,
- 0x808080ff,
- 0xc7c7c7ff,
- 0xd0d0d0ff,
- 0x404040ff,
- 0x383838ff,
- 0x404040ff,
- 0x808080ff,
- 0xbfbfbfff,
- 0xc7c7c7ff,
- 0x808080ff,
- 0x808080ff,
- 0x808080ff,
- 0x808080ff,
- 0x808080ff,
- 0x808080ff,
- 0xbfbfbfff,
- 0xc7c7c7ff,
- 0xbfbfbfff,
- 0x808080ff,
- 0x404040ff,
- 0x383838ff,
- 0xc7c7c7ff,
- 0xd0d0d0ff,
- 0xc7c7c7ff,
- 0x808080ff,
- 0x383838ff,
- 0x2f2f2fff
- ]
+ ],
},
- 'BEZIER 6x6': {
+ "BEZIER 6x6": {
width: 6,
height: 6,
data: [
- 0x404040ff,
- 0x343434ff,
- 0x404040ff,
- 0x808080ff,
- 0xbfbfbfff,
- 0xcbcbcbff,
- 0x343434ff,
+ 0x404040ff, 0x343434ff, 0x404040ff, 0x808080ff, 0xbfbfbfff,
+ 0xcbcbcbff, 0x343434ff, 0x262626ff, 0x343434ff, 0x808080ff,
+ 0xcbcbcbff, 0xd9d9d9ff, 0x404040ff, 0x343434ff, 0x404040ff,
+ 0x808080ff, 0xbfbfbfff, 0xcbcbcbff, 0x808080ff, 0x808080ff,
+ 0x808080ff, 0x808080ff, 0x808080ff, 0x808080ff, 0xbfbfbfff,
+ 0xcbcbcbff, 0xbfbfbfff, 0x808080ff, 0x404040ff, 0x343434ff,
+ 0xcbcbcbff, 0xd9d9d9ff, 0xcbcbcbff, 0x808080ff, 0x343434ff,
0x262626ff,
- 0x343434ff,
- 0x808080ff,
- 0xcbcbcbff,
- 0xd9d9d9ff,
- 0x404040ff,
- 0x343434ff,
- 0x404040ff,
- 0x808080ff,
- 0xbfbfbfff,
- 0xcbcbcbff,
- 0x808080ff,
- 0x808080ff,
- 0x808080ff,
- 0x808080ff,
- 0x808080ff,
- 0x808080ff,
- 0xbfbfbfff,
- 0xcbcbcbff,
- 0xbfbfbfff,
- 0x808080ff,
- 0x404040ff,
- 0x343434ff,
- 0xcbcbcbff,
- 0xd9d9d9ff,
- 0xcbcbcbff,
- 0x808080ff,
- 0x343434ff,
- 0x262626ff
- ]
- }
- }
- }
+ ],
+ },
+ },
+ },
];
- before(done => {
- const srcImgs = testImages.map(test => test.src);
+ before((done) => {
+ const srcImgs = testImages.map((test) => test.src);
Promise.all(srcImgs)
- .then(imgsJimp => {
+ .then((imgsJimp) => {
for (let i = 0; i < imgsJimp.length; i++) {
testImages[i].src = imgsJimp[i];
}
@@ -593,17 +282,16 @@ describe('Resize images', () => {
function testEach(test) {
describe(test.title, () => {
hashForEach(test.results, (expectedTitle, expectedJgd) => {
- const mode = Jimp['RESIZE_' + expectedTitle.split(' ')[0]];
+ const mode = Jimp["RESIZE_" + expectedTitle.split(" ")[0]];
const size = expectedTitle
- .split(' ')[1]
- .split('x')
- .map(n => parseInt(n, 10));
- it('to ' + expectedTitle, () => {
- test.src
- .clone()
- .resize(size[0], size[1], mode)
- .getJGDSync()
- .should.be.sameJGD(expectedJgd);
+ .split(" ")[1]
+ .split("x")
+ .map((n) => parseInt(n, 10));
+ it("to " + expectedTitle, () => {
+ expectToBeJGD(
+ test.src.clone().resize(size[0], size[1], mode).getJGDSync(),
+ expectedJgd
+ );
});
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md
index 26394e0f..fff0ee5b 100644
--- a/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md
@@ -1,3 +1,113 @@
+# v0.22.8 (Thu May 11 2023)
+
+#### 🚀 Enhancement
+
+- Fix: rotate resize param on multiples of 90 [#1229](https://github.com/jimp-dev/jimp/pull/1229) ([@sjoerd108](https://github.com/sjoerd108))
+
+#### Authors: 1
+
+- Sjoerd ([@sjoerd108](https://github.com/sjoerd108))
+
+---
+
+# v0.22.7 (Sat Feb 25 2023)
+
+:tada: This release contains work from a new contributor! :tada:
+
+Thank you, MD KHAIRUL ISLAM ([@black-turtle](https://github.com/black-turtle)), for all your work!
+
+### Release Notes
+
+#### use matrix rotate, if rotate angle is multiple of 90 degrees ([#1209](https://github.com/jimp-dev/jimp/pull/1209))
+
+Fixes a bug where rotating by 90 degrees introduced extra pixels
+
+---
+
+#### 🐛 Bug Fix
+
+- use matrix rotate, if rotate angle is multiple of 90 degrees [#1209](https://github.com/jimp-dev/jimp/pull/1209) ([@black-turtle](https://github.com/black-turtle))
+
+#### Authors: 1
+
+- MD KHAIRUL ISLAM ([@black-turtle](https://github.com/black-turtle))
+
+---
+
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.17.6 (Sat Feb 04 2023)
+
+#### 🐛 Bug Fix
+
+- fix documentation about rotation direction. [#1062](https://github.com/jimp-dev/jimp/pull/1062) ([@fabb](https://github.com/fabb))
+
+#### Authors: 1
+
+- [@fabb](https://github.com/fabb)
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +122,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +130,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-rotate/README.md b/project starter code/node_modules/@jimp/plugin-rotate/README.md
index 648613df..510fea5c 100644
--- a/project starter code/node_modules/@jimp/plugin-rotate/README.md
+++ b/project starter code/node_modules/@jimp/plugin-rotate/README.md
@@ -5,19 +5,19 @@
Rotate an image.
-Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
+Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
## Usage
-- @param {number} deg the number of degrees to rotate the image by
+- @param {number} deg the number of degrees to rotate the image by, counter-clockwise
- @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.rotate(90);
}
diff --git a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js b/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js
index c2d2afff..90813a97 100644
--- a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js
@@ -3,53 +3,127 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
+/**
+ * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object.
+ *
+ * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909
+ *
+ * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90
+ */
+function matrixRotate(deg) {
+ if (Math.abs(deg) % 90 !== 0) {
+ throw new Error("Unsupported matrix rotation degree");
+ }
+ deg %= 360;
+ if (Math.abs(deg) === 0) {
+ // no rotation for 0, 360, -360, 720, -720, ...
+ return;
+ }
+ const w = this.bitmap.width;
+ const h = this.bitmap.height;
+
+ // decide which rotation angle to use
+ let angle;
+ switch (deg) {
+ // 90 degree & -270 degree are same
+ case 90:
+ case -270:
+ angle = 90;
+ break;
+ case 180:
+ case -180:
+ angle = 180;
+ break;
+ case 270:
+ case -90:
+ angle = -90;
+ break;
+ default:
+ throw new Error("Unsupported matrix rotation degree");
+ }
+ // After this switch block, angle will be 90, 180 or -90
+
+ // calculate the new width and height
+ const nW = angle === 180 ? w : h;
+ const nH = angle === 180 ? h : w;
+ const dstBuffer = Buffer.alloc(this.bitmap.data.length);
+
+ // function to translate the x, y coordinate to the index of the pixel in the buffer
+ function createIdxTranslationFunction(w, h) {
+ return function (x, y) {
+ return y * w + x << 2;
+ };
+ }
+ const srcIdxFunction = createIdxTranslationFunction(w, h);
+ const dstIdxFunction = createIdxTranslationFunction(nW, nH);
+ for (let x = 0; x < w; x++) {
+ for (let y = 0; y < h; y++) {
+ const srcIdx = srcIdxFunction(x, y);
+ const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);
+ let dstIdx;
+ switch (angle) {
+ case 90:
+ dstIdx = dstIdxFunction(y, w - x - 1);
+ break;
+ case -90:
+ dstIdx = dstIdxFunction(h - y - 1, x);
+ break;
+ case 180:
+ dstIdx = dstIdxFunction(w - x - 1, h - y - 1);
+ break;
+ default:
+ throw new Error("Unsupported matrix rotation angle");
+ }
+ dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);
+ }
+ }
+ this.bitmap.data = dstBuffer;
+ this.bitmap.width = nW;
+ this.bitmap.height = nH;
+}
/**
- * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.
+ * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.
* @param {number} deg the number of degrees to rotate the image by
* @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
*/
function advancedRotate(deg, mode) {
deg %= 360;
- var rad = deg * Math.PI / 180;
- var cosine = Math.cos(rad);
- var sine = Math.sin(rad); // the final width and height will change if resize == true
-
- var w = this.bitmap.width;
- var h = this.bitmap.height;
-
- if (mode === true || typeof mode === 'string') {
+ const rad = deg * Math.PI / 180;
+ const cosine = Math.cos(rad);
+ const sine = Math.sin(rad);
+
+ // the final width and height will change if resize == true
+ let w = this.bitmap.width;
+ let h = this.bitmap.height;
+ if (mode === true || typeof mode === "string") {
// resize the image to it maximum dimension and blit the existing image
// onto the center so that when it is rotated the image is kept in bounds
+
// http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle
// Plus 1 border pixel to ensure to show all rotated result for some cases.
w = Math.ceil(Math.abs(this.bitmap.width * cosine) + Math.abs(this.bitmap.height * sine)) + 1;
- h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; // Ensure destination to have even size to a better result.
-
+ h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1;
+ // Ensure destination to have even size to a better result.
if (w % 2 !== 0) {
w++;
}
-
if (h % 2 !== 0) {
h++;
}
-
- var c = this.cloneQuiet();
+ const c = this.cloneQuiet();
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
this.bitmap.data.writeUInt32BE(this._background, idx);
});
- var max = Math.max(w, h, this.bitmap.width, this.bitmap.height);
+ const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);
this.resize(max, max, mode);
this.blit(c, this.bitmap.width / 2 - c.bitmap.width / 2, this.bitmap.height / 2 - c.bitmap.height / 2);
}
-
- var bW = this.bitmap.width;
- var bH = this.bitmap.height;
- var dstBuffer = Buffer.alloc(this.bitmap.data.length);
-
+ const bW = this.bitmap.width;
+ const bH = this.bitmap.height;
+ const dstBuffer = Buffer.alloc(this.bitmap.data.length);
function createTranslationFunction(deltaX, deltaY) {
return function (x, y) {
return {
@@ -58,19 +132,16 @@ function advancedRotate(deg, mode) {
};
};
}
-
- var translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));
- var translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5);
-
- for (var y = 1; y <= bH; y++) {
- for (var x = 1; x <= bW; x++) {
- var cartesian = translate2Cartesian(x, y);
- var source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x);
- var dstIdx = bW * (y - 1) + x - 1 << 2;
-
+ const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));
+ const translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5);
+ for (let y = 1; y <= bH; y++) {
+ for (let x = 1; x <= bW; x++) {
+ const cartesian = translate2Cartesian(x, y);
+ const source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x);
+ const dstIdx = bW * (y - 1) + x - 1 << 2;
if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {
- var srcIdx = (bW * (source.y | 0) + source.x | 0) << 2;
- var pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);
+ const srcIdx = (bW * (source.y | 0) + source.x | 0) << 2;
+ const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);
dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);
} else {
// reset off-image pixels
@@ -78,62 +149,56 @@ function advancedRotate(deg, mode) {
}
}
}
-
this.bitmap.data = dstBuffer;
-
- if (mode === true || typeof mode === 'string') {
+ if (mode === true || typeof mode === "string") {
// now crop the image to the final size
- var _x = bW / 2 - w / 2;
-
- var _y = bH / 2 - h / 2;
-
- this.crop(_x, _y, w, h);
+ const x = bW / 2 - w / 2;
+ const y = bH / 2 - h / 2;
+ this.crop(x, y, w, h);
}
}
+var _default = () => ({
+ /**
+ * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
+ * @param {number} deg the number of degrees to rotate the image by
+ * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ rotate(deg, mode, cb) {
+ // enable overloading
+ if (typeof mode === "undefined" || mode === null) {
+ // e.g. image.resize(120);
+ // e.g. image.resize(120, null, cb);
+ // e.g. image.resize(120, undefined, cb);
+ mode = true;
+ }
+ if (typeof mode === "function" && typeof cb === "undefined") {
+ // e.g. image.resize(120, cb);
+ cb = mode;
+ mode = true;
+ }
+ if (typeof deg !== "number") {
+ return _utils.throwError.call(this, "deg must be a number", cb);
+ }
+ if (typeof mode !== "boolean" && typeof mode !== "string") {
+ return _utils.throwError.call(this, "mode must be a boolean or a string", cb);
+ }
-var _default = function _default() {
- return {
- /**
- * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
- * @param {number} deg the number of degrees to rotate the image by
- * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- rotate: function rotate(deg, mode, cb) {
- // enable overloading
- if (typeof mode === 'undefined' || mode === null) {
- // e.g. image.resize(120);
- // e.g. image.resize(120, null, cb);
- // e.g. image.resize(120, undefined, cb);
- mode = true;
- }
-
- if (typeof mode === 'function' && typeof cb === 'undefined') {
- // e.g. image.resize(120, cb);
- cb = mode;
- mode = true;
- }
-
- if (typeof deg !== 'number') {
- return _utils.throwError.call(this, 'deg must be a number', cb);
- }
-
- if (typeof mode !== 'boolean' && typeof mode !== 'string') {
- return _utils.throwError.call(this, 'mode must be a boolean or a string', cb);
- }
-
+ // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.
+ const matrixRotateAllowed = deg % 90 === 0 && (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0);
+ if (matrixRotateAllowed) {
+ matrixRotate.call(this, deg);
+ } else {
advancedRotate.call(this, deg, mode, cb);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
}
- };
-};
-
-exports["default"] = _default;
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map
index 57e7d894..90c89bc0 100644
--- a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["advancedRotate","deg","mode","rad","Math","PI","cosine","cos","sine","sin","w","bitmap","width","h","height","ceil","abs","c","cloneQuiet","scanQuiet","x","y","idx","data","writeUInt32BE","_background","max","resize","blit","bW","bH","dstBuffer","Buffer","alloc","length","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","dstIdx","srcIdx","pixelRGBA","readUInt32BE","crop","rotate","cb","throwError","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,cAAT,CAAwBC,GAAxB,EAA6BC,IAA7B,EAAmC;AACjCD,EAAAA,GAAG,IAAI,GAAP;AACA,MAAME,GAAG,GAAIF,GAAG,GAAGG,IAA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utils';\n\n/**\n * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === 'string') {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function(x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === 'string') {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === 'undefined' || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== 'number') {\n return throwError.call(this, 'deg must be a number', cb);\n }\n\n if (typeof mode !== 'boolean' && typeof mode !== 'string') {\n return throwError.call(this, 'mode must be a boolean or a string', cb);\n }\n\n advancedRotate.call(this, deg, mode, cb);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["matrixRotate","deg","Math","abs","Error","w","bitmap","width","h","height","angle","nW","nH","dstBuffer","Buffer","alloc","data","length","createIdxTranslationFunction","x","y","srcIdxFunction","dstIdxFunction","srcIdx","pixelRGBA","readUInt32BE","dstIdx","writeUInt32BE","advancedRotate","mode","rad","PI","cosine","cos","sine","sin","ceil","c","cloneQuiet","scanQuiet","idx","_background","max","resize","blit","bW","bH","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","crop","rotate","cb","throwError","call","matrixRotateAllowed","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object.\n *\n * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909\n *\n * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90\n */\nfunction matrixRotate(deg) {\n if (Math.abs(deg) % 90 !== 0) {\n throw new Error(\"Unsupported matrix rotation degree\");\n }\n\n deg %= 360;\n if (Math.abs(deg) === 0) {\n // no rotation for 0, 360, -360, 720, -720, ...\n return;\n }\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n\n // decide which rotation angle to use\n let angle;\n switch (deg) {\n // 90 degree & -270 degree are same\n case 90:\n case -270:\n angle = 90;\n break;\n\n case 180:\n case -180:\n angle = 180;\n break;\n\n case 270:\n case -90:\n angle = -90;\n break;\n\n default:\n throw new Error(\"Unsupported matrix rotation degree\");\n }\n // After this switch block, angle will be 90, 180 or -90\n\n // calculate the new width and height\n const nW = angle === 180 ? w : h;\n const nH = angle === 180 ? h : w;\n\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n // function to translate the x, y coordinate to the index of the pixel in the buffer\n function createIdxTranslationFunction(w, h) {\n return function (x, y) {\n return (y * w + x) << 2;\n };\n }\n\n const srcIdxFunction = createIdxTranslationFunction(w, h);\n const dstIdxFunction = createIdxTranslationFunction(nW, nH);\n\n for (let x = 0; x < w; x++) {\n for (let y = 0; y < h; y++) {\n const srcIdx = srcIdxFunction(x, y);\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n\n let dstIdx;\n switch (angle) {\n case 90:\n dstIdx = dstIdxFunction(y, w - x - 1);\n break;\n case -90:\n dstIdx = dstIdxFunction(h - y - 1, x);\n break;\n case 180:\n dstIdx = dstIdxFunction(w - x - 1, h - y - 1);\n break;\n default:\n throw new Error(\"Unsupported matrix rotation angle\");\n }\n\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n }\n }\n\n this.bitmap.data = dstBuffer;\n this.bitmap.width = nW;\n this.bitmap.height = nH;\n}\n\n/**\n * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === \"string\") {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n }\n );\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function (x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY,\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === \"string\") {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === \"undefined\" || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== \"number\") {\n return throwError.call(this, \"deg must be a number\", cb);\n }\n\n if (typeof mode !== \"boolean\" && typeof mode !== \"string\") {\n return throwError.call(this, \"mode must be a boolean or a string\", cb);\n }\n\n // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.\n const matrixRotateAllowed =\n deg % 90 === 0 &&\n (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0);\n\n if (matrixRotateAllowed) {\n matrixRotate.call(this, deg);\n } else {\n advancedRotate.call(this, deg, mode, cb);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,CAACC,GAAG,EAAE;EACzB,IAAIC,IAAI,CAACC,GAAG,CAACF,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE;IAC5B,MAAM,IAAIG,KAAK,CAAC,oCAAoC,CAAC;EACvD;EAEAH,GAAG,IAAI,GAAG;EACV,IAAIC,IAAI,CAACC,GAAG,CAACF,GAAG,CAAC,KAAK,CAAC,EAAE;IACvB;IACA;EACF;EAEA,MAAMI,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK;EAC3B,MAAMC,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM;;EAE5B;EACA,IAAIC,KAAK;EACT,QAAQT,GAAG;IACT;IACA,KAAK,EAAE;IACP,KAAK,CAAC,GAAG;MACPS,KAAK,GAAG,EAAE;MACV;IAEF,KAAK,GAAG;IACR,KAAK,CAAC,GAAG;MACPA,KAAK,GAAG,GAAG;MACX;IAEF,KAAK,GAAG;IACR,KAAK,CAAC,EAAE;MACN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AQ,EAAE;MAC3B,OAAOwD,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,sBAAsB,EAAEF,EAAE,CAAC;IAC1D;IAEA,IAAI,OAAO3B,IAAI,KAAK,SAAS,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACzD,OAAO4B,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,oCAAoC,EAAEF,EAAE,CAAC;IACxE;;IAEA;IACA,MAAMG,mBAAmB,GACvB1D,GAAG,GAAG,EAAE,KAAK,CAAC,KACb4B,IAAI,IAAI,IAAI,CAACvB,MAAM,CAACC,KAAK,KAAK,IAAI,CAACD,MAAM,CAACG,MAAM,IAAIR,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;IAEvE,IAAI0D,mBAAmB,EAAE;MACvB3D,YAAY,CAAC0D,IAAI,CAAC,IAAI,EAAEzD,GAAG,CAAC;IAC9B,CAAC,MAAM;MACL2B,cAAc,CAAC8B,IAAI,CAAC,IAAI,EAAEzD,GAAG,EAAE4B,IAAI,EAAE2B,EAAE,CAAC;IAC1C;IAEA,IAAI,IAAAI,oBAAa,EAACJ,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js b/project starter code/node_modules/@jimp/plugin-rotate/es/index.js
index ebb25b9f..396a9a67 100644
--- a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-rotate/es/index.js
@@ -1,55 +1,124 @@
-"use strict";
+import { isNodePattern, throwError } from "@jimp/utils";
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
+/**
+ * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object.
+ *
+ * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909
+ *
+ * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90
+ */
+function matrixRotate(deg) {
+ if (Math.abs(deg) % 90 !== 0) {
+ throw new Error("Unsupported matrix rotation degree");
+ }
+ deg %= 360;
+ if (Math.abs(deg) === 0) {
+ // no rotation for 0, 360, -360, 720, -720, ...
+ return;
+ }
+ const w = this.bitmap.width;
+ const h = this.bitmap.height;
+
+ // decide which rotation angle to use
+ let angle;
+ switch (deg) {
+ // 90 degree & -270 degree are same
+ case 90:
+ case -270:
+ angle = 90;
+ break;
+ case 180:
+ case -180:
+ angle = 180;
+ break;
+ case 270:
+ case -90:
+ angle = -90;
+ break;
+ default:
+ throw new Error("Unsupported matrix rotation degree");
+ }
+ // After this switch block, angle will be 90, 180 or -90
-var _utils = require("@jimp/utils");
+ // calculate the new width and height
+ const nW = angle === 180 ? w : h;
+ const nH = angle === 180 ? h : w;
+ const dstBuffer = Buffer.alloc(this.bitmap.data.length);
+
+ // function to translate the x, y coordinate to the index of the pixel in the buffer
+ function createIdxTranslationFunction(w, h) {
+ return function (x, y) {
+ return y * w + x << 2;
+ };
+ }
+ const srcIdxFunction = createIdxTranslationFunction(w, h);
+ const dstIdxFunction = createIdxTranslationFunction(nW, nH);
+ for (let x = 0; x < w; x++) {
+ for (let y = 0; y < h; y++) {
+ const srcIdx = srcIdxFunction(x, y);
+ const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);
+ let dstIdx;
+ switch (angle) {
+ case 90:
+ dstIdx = dstIdxFunction(y, w - x - 1);
+ break;
+ case -90:
+ dstIdx = dstIdxFunction(h - y - 1, x);
+ break;
+ case 180:
+ dstIdx = dstIdxFunction(w - x - 1, h - y - 1);
+ break;
+ default:
+ throw new Error("Unsupported matrix rotation angle");
+ }
+ dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);
+ }
+ }
+ this.bitmap.data = dstBuffer;
+ this.bitmap.width = nW;
+ this.bitmap.height = nH;
+}
/**
- * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.
+ * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.
* @param {number} deg the number of degrees to rotate the image by
* @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
*/
function advancedRotate(deg, mode) {
deg %= 360;
- var rad = deg * Math.PI / 180;
- var cosine = Math.cos(rad);
- var sine = Math.sin(rad); // the final width and height will change if resize == true
-
- var w = this.bitmap.width;
- var h = this.bitmap.height;
-
- if (mode === true || typeof mode === 'string') {
+ const rad = deg * Math.PI / 180;
+ const cosine = Math.cos(rad);
+ const sine = Math.sin(rad);
+
+ // the final width and height will change if resize == true
+ let w = this.bitmap.width;
+ let h = this.bitmap.height;
+ if (mode === true || typeof mode === "string") {
// resize the image to it maximum dimension and blit the existing image
// onto the center so that when it is rotated the image is kept in bounds
+
// http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle
// Plus 1 border pixel to ensure to show all rotated result for some cases.
w = Math.ceil(Math.abs(this.bitmap.width * cosine) + Math.abs(this.bitmap.height * sine)) + 1;
- h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; // Ensure destination to have even size to a better result.
-
+ h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1;
+ // Ensure destination to have even size to a better result.
if (w % 2 !== 0) {
w++;
}
-
if (h % 2 !== 0) {
h++;
}
-
- var c = this.cloneQuiet();
+ const c = this.cloneQuiet();
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
this.bitmap.data.writeUInt32BE(this._background, idx);
});
- var max = Math.max(w, h, this.bitmap.width, this.bitmap.height);
+ const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);
this.resize(max, max, mode);
this.blit(c, this.bitmap.width / 2 - c.bitmap.width / 2, this.bitmap.height / 2 - c.bitmap.height / 2);
}
-
- var bW = this.bitmap.width;
- var bH = this.bitmap.height;
- var dstBuffer = Buffer.alloc(this.bitmap.data.length);
-
+ const bW = this.bitmap.width;
+ const bH = this.bitmap.height;
+ const dstBuffer = Buffer.alloc(this.bitmap.data.length);
function createTranslationFunction(deltaX, deltaY) {
return function (x, y) {
return {
@@ -58,19 +127,16 @@ function advancedRotate(deg, mode) {
};
};
}
-
- var translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));
- var translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5);
-
- for (var y = 1; y <= bH; y++) {
- for (var x = 1; x <= bW; x++) {
- var cartesian = translate2Cartesian(x, y);
- var source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x);
- var dstIdx = bW * (y - 1) + x - 1 << 2;
-
+ const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));
+ const translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5);
+ for (let y = 1; y <= bH; y++) {
+ for (let x = 1; x <= bW; x++) {
+ const cartesian = translate2Cartesian(x, y);
+ const source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x);
+ const dstIdx = bW * (y - 1) + x - 1 << 2;
if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {
- var srcIdx = (bW * (source.y | 0) + source.x | 0) << 2;
- var pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);
+ const srcIdx = (bW * (source.y | 0) + source.x | 0) << 2;
+ const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);
dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);
} else {
// reset off-image pixels
@@ -78,61 +144,53 @@ function advancedRotate(deg, mode) {
}
}
}
-
this.bitmap.data = dstBuffer;
-
- if (mode === true || typeof mode === 'string') {
+ if (mode === true || typeof mode === "string") {
// now crop the image to the final size
- var _x = bW / 2 - w / 2;
-
- var _y = bH / 2 - h / 2;
-
- this.crop(_x, _y, w, h);
+ const x = bW / 2 - w / 2;
+ const y = bH / 2 - h / 2;
+ this.crop(x, y, w, h);
}
}
+export default (() => ({
+ /**
+ * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
+ * @param {number} deg the number of degrees to rotate the image by
+ * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ rotate(deg, mode, cb) {
+ // enable overloading
+ if (typeof mode === "undefined" || mode === null) {
+ // e.g. image.resize(120);
+ // e.g. image.resize(120, null, cb);
+ // e.g. image.resize(120, undefined, cb);
+ mode = true;
+ }
+ if (typeof mode === "function" && typeof cb === "undefined") {
+ // e.g. image.resize(120, cb);
+ cb = mode;
+ mode = true;
+ }
+ if (typeof deg !== "number") {
+ return throwError.call(this, "deg must be a number", cb);
+ }
+ if (typeof mode !== "boolean" && typeof mode !== "string") {
+ return throwError.call(this, "mode must be a boolean or a string", cb);
+ }
-var _default = function _default() {
- return {
- /**
- * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
- * @param {number} deg the number of degrees to rotate the image by
- * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- rotate: function rotate(deg, mode, cb) {
- // enable overloading
- if (typeof mode === 'undefined' || mode === null) {
- // e.g. image.resize(120);
- // e.g. image.resize(120, null, cb);
- // e.g. image.resize(120, undefined, cb);
- mode = true;
- }
-
- if (typeof mode === 'function' && typeof cb === 'undefined') {
- // e.g. image.resize(120, cb);
- cb = mode;
- mode = true;
- }
-
- if (typeof deg !== 'number') {
- return _utils.throwError.call(this, 'deg must be a number', cb);
- }
-
- if (typeof mode !== 'boolean' && typeof mode !== 'string') {
- return _utils.throwError.call(this, 'mode must be a boolean or a string', cb);
- }
-
+ // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.
+ const matrixRotateAllowed = deg % 90 === 0 && (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0);
+ if (matrixRotateAllowed) {
+ matrixRotate.call(this, deg);
+ } else {
advancedRotate.call(this, deg, mode, cb);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
}
- };
-};
-
-exports["default"] = _default;
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map b/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map
index 57e7d894..79faf103 100644
--- a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["advancedRotate","deg","mode","rad","Math","PI","cosine","cos","sine","sin","w","bitmap","width","h","height","ceil","abs","c","cloneQuiet","scanQuiet","x","y","idx","data","writeUInt32BE","_background","max","resize","blit","bW","bH","dstBuffer","Buffer","alloc","length","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","dstIdx","srcIdx","pixelRGBA","readUInt32BE","crop","rotate","cb","throwError","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,cAAT,CAAwBC,GAAxB,EAA6BC,IAA7B,EAAmC;AACjCD,EAAAA,GAAG,IAAI,GAAP;AACA,MAAME,GAAG,GAAIF,GAAG,GAAGG,IAAI,CAACC,EAAZ,GAAkB,GAA9B;AACA,MAAMC,MAAM,GAAGF,IAAI,CAACG,GAAL,CAASJ,GAAT,CAAf;AACA,MAAMK,IAAI,GAAGJ,IAAI,CAACK,GAAL,CAASN,GAAT,CAAb,CAJiC,CAMjC;;AACA,MAAIO,CAAC,GAAG,KAAKC,MAAL,CAAYC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AhB,EAAmBG,CAAnB;AACD;AACF;;eAEc;AAAA,SAAO;AACpB;;;;;;;AAOAkC,IAAAA,MARoB,kBAQb9C,GARa,EAQRC,IARQ,EAQF8C,EARE,EAQE;AACpB;AACA,UAAI,OAAO9C,IAAP,KAAgB,WAAhB,IAA+BA,IAAI,KAAK,IAA5C,EAAkD;AAChD;AACA;AACA;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAED,UAAI,OAAOA,IAAP,KAAgB,UAAhB,IAA8B,OAAO8C,EAAP,KAAc,WAAhD,EAA6D;AAC3D;AACAA,QAAAA,EAAE,GAAG9C,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAED,UAAI,OAAOD,GAAP,KAAe,QAAnB,EAA6B;AAC3B,eAAOgD,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,sBAAtB,EAA8CF,EAA9C,CAAP;AACD;;AAED,UAAI,OAAO9C,IAAP,KAAgB,SAAhB,IAA6B,OAAOA,IAAP,KAAgB,QAAjD,EAA2D;AACzD,eAAO+C,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oCAAtB,EAA4DF,EAA5D,CAAP;AACD;;AAEDhD,MAAAA,cAAc,CAACkD,IAAf,CAAoB,IAApB,EAA0BjD,GAA1B,EAA+BC,IAA/B,EAAqC8C,EAArC;;AAEA,UAAI,0BAAcA,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAtCmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\n/**\n * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === 'string') {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function(x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === 'string') {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === 'undefined' || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== 'number') {\n return throwError.call(this, 'deg must be a number', cb);\n }\n\n if (typeof mode !== 'boolean' && typeof mode !== 'string') {\n return throwError.call(this, 'mode must be a boolean or a string', cb);\n }\n\n advancedRotate.call(this, deg, mode, cb);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","throwError","matrixRotate","deg","Math","abs","Error","w","bitmap","width","h","height","angle","nW","nH","dstBuffer","Buffer","alloc","data","length","createIdxTranslationFunction","x","y","srcIdxFunction","dstIdxFunction","srcIdx","pixelRGBA","readUInt32BE","dstIdx","writeUInt32BE","advancedRotate","mode","rad","PI","cosine","cos","sine","sin","ceil","c","cloneQuiet","scanQuiet","idx","_background","max","resize","blit","bW","bH","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","crop","rotate","cb","call","matrixRotateAllowed"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object.\n *\n * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909\n *\n * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90\n */\nfunction matrixRotate(deg) {\n if (Math.abs(deg) % 90 !== 0) {\n throw new Error(\"Unsupported matrix rotation degree\");\n }\n\n deg %= 360;\n if (Math.abs(deg) === 0) {\n // no rotation for 0, 360, -360, 720, -720, ...\n return;\n }\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n\n // decide which rotation angle to use\n let angle;\n switch (deg) {\n // 90 degree & -270 degree are same\n case 90:\n case -270:\n angle = 90;\n break;\n\n case 180:\n case -180:\n angle = 180;\n break;\n\n case 270:\n case -90:\n angle = -90;\n break;\n\n default:\n throw new Error(\"Unsupported matrix rotation degree\");\n }\n // After this switch block, angle will be 90, 180 or -90\n\n // calculate the new width and height\n const nW = angle === 180 ? w : h;\n const nH = angle === 180 ? h : w;\n\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n // function to translate the x, y coordinate to the index of the pixel in the buffer\n function createIdxTranslationFunction(w, h) {\n return function (x, y) {\n return (y * w + x) << 2;\n };\n }\n\n const srcIdxFunction = createIdxTranslationFunction(w, h);\n const dstIdxFunction = createIdxTranslationFunction(nW, nH);\n\n for (let x = 0; x < w; x++) {\n for (let y = 0; y < h; y++) {\n const srcIdx = srcIdxFunction(x, y);\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n\n let dstIdx;\n switch (angle) {\n case 90:\n dstIdx = dstIdxFunction(y, w - x - 1);\n break;\n case -90:\n dstIdx = dstIdxFunction(h - y - 1, x);\n break;\n case 180:\n dstIdx = dstIdxFunction(w - x - 1, h - y - 1);\n break;\n default:\n throw new Error(\"Unsupported matrix rotation angle\");\n }\n\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n }\n }\n\n this.bitmap.data = dstBuffer;\n this.bitmap.width = nW;\n this.bitmap.height = nH;\n}\n\n/**\n * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === \"string\") {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n }\n );\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function (x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY,\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === \"string\") {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === \"undefined\" || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== \"number\") {\n return throwError.call(this, \"deg must be a number\", cb);\n }\n\n if (typeof mode !== \"boolean\" && typeof mode !== \"string\") {\n return throwError.call(this, \"mode must be a boolean or a string\", cb);\n }\n\n // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.\n const matrixRotateAllowed =\n deg % 90 === 0 &&\n (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0);\n\n if (matrixRotateAllowed) {\n matrixRotate.call(this, deg);\n } else {\n advancedRotate.call(this, deg, mode, cb);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,YAAY,CAACC,GAAG,EAAE;EACzB,IAAIC,IAAI,CAACC,GAAG,CAACF,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE;IAC5B,MAAM,IAAIG,KAAK,CAAC,oCAAoC,CAAC;EACvD;EAEAH,GAAG,IAAI,GAAG;EACV,IAAIC,IAAI,CAACC,GAAG,CAACF,GAAG,CAAC,KAAK,CAAC,EAAE;IACvB;IACA;EACF;EAEA,MAAMI,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK;EAC3B,MAAMC,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM;;EAE5B;EACA,IAAIC,KAAK;EACT,QAAQT,GAAG;IACT;IACA,KAAK,EAAE;IACP,KAAK,CAAC,GAAG;MACPS,KAAK,GAAG,EAAE;MACV;IAEF,KAAK,GAAG;IACR,KAAK,CAAC,GAAG;MACPA,KAAK,GAAG,GAAG;MACX;IAEF,KAAK,GAAG;IACR,KAAK,CAAC,EAAE;MACNA,KAAK,GAAG,CAAC,EAAE;MACX;IAEF;MACE,MAAM,IAAIN,KAAK,CAAC,oCAAoC,CAAC;EAAC;EAE1D;;EAEA;EACA,MAAMO,EAAE,GAAGD,KAAK,KAAK,GAAG,GAAGL,CAAC,GAAGG,CAAC;EAChC,M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D,OAAO9B,UAAU,CAAC0D,IAAI,CAAC,IAAI,EAAE,oCAAoC,EAAED,EAAE,CAAC;IACxE;;IAEA;IACA,MAAME,mBAAmB,GACvBzD,GAAG,GAAG,EAAE,KAAK,CAAC,KACb4B,IAAI,IAAI,IAAI,CAACvB,MAAM,CAACC,KAAK,KAAK,IAAI,CAACD,MAAM,CAACG,MAAM,IAAIR,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;IAEvE,IAAIyD,mBAAmB,EAAE;MACvB1D,YAAY,CAACyD,IAAI,CAAC,IAAI,EAAExD,GAAG,CAAC;IAC9B,CAAC,MAAM;MACL2B,cAAc,CAAC6B,IAAI,CAAC,IAAI,EAAExD,GAAG,EAAE4B,IAAI,EAAE2B,EAAE,CAAC;IAC1C;IAEA,IAAI1D,aAAa,CAAC0D,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts b/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts
index 8cc783de..23d2aa2f 100644
--- a/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts
@@ -1,8 +1,8 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Rotate {
rotate(deg: number, cb?: ImageCallback): this;
rotate(deg: number, mode: string | boolean, cb?: ImageCallback): this;
}
-export default function(): Rotate;
+export default function (): Rotate;
diff --git a/project starter code/node_modules/@jimp/plugin-rotate/package.json b/project starter code/node_modules/@jimp/plugin-rotate/package.json
index a6c4676f..651f0264 100644
--- a/project starter code/node_modules/@jimp/plugin-rotate/package.json
+++ b/project starter code/node_modules/@jimp/plugin-rotate/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-rotate",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Rotate an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,8 +21,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -30,14 +30,14 @@
"@jimp/plugin-resize": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/plugin-blit": "^0.16.2",
- "@jimp/plugin-crop": "^0.16.2",
- "@jimp/plugin-resize": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/plugin-blit": "^0.22.12",
+ "@jimp/plugin-crop": "^0.22.12",
+ "@jimp/plugin-resize": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-rotate/src/index.js b/project starter code/node_modules/@jimp/plugin-rotate/src/index.js
index 80570fda..7f430bae 100644
--- a/project starter code/node_modules/@jimp/plugin-rotate/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-rotate/src/index.js
@@ -1,7 +1,97 @@
-import { throwError, isNodePattern } from '@jimp/utils';
+import { isNodePattern, throwError } from "@jimp/utils";
/**
- * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.
+ * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object.
+ *
+ * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909
+ *
+ * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90
+ */
+function matrixRotate(deg) {
+ if (Math.abs(deg) % 90 !== 0) {
+ throw new Error("Unsupported matrix rotation degree");
+ }
+
+ deg %= 360;
+ if (Math.abs(deg) === 0) {
+ // no rotation for 0, 360, -360, 720, -720, ...
+ return;
+ }
+
+ const w = this.bitmap.width;
+ const h = this.bitmap.height;
+
+ // decide which rotation angle to use
+ let angle;
+ switch (deg) {
+ // 90 degree & -270 degree are same
+ case 90:
+ case -270:
+ angle = 90;
+ break;
+
+ case 180:
+ case -180:
+ angle = 180;
+ break;
+
+ case 270:
+ case -90:
+ angle = -90;
+ break;
+
+ default:
+ throw new Error("Unsupported matrix rotation degree");
+ }
+ // After this switch block, angle will be 90, 180 or -90
+
+ // calculate the new width and height
+ const nW = angle === 180 ? w : h;
+ const nH = angle === 180 ? h : w;
+
+ const dstBuffer = Buffer.alloc(this.bitmap.data.length);
+
+ // function to translate the x, y coordinate to the index of the pixel in the buffer
+ function createIdxTranslationFunction(w, h) {
+ return function (x, y) {
+ return (y * w + x) << 2;
+ };
+ }
+
+ const srcIdxFunction = createIdxTranslationFunction(w, h);
+ const dstIdxFunction = createIdxTranslationFunction(nW, nH);
+
+ for (let x = 0; x < w; x++) {
+ for (let y = 0; y < h; y++) {
+ const srcIdx = srcIdxFunction(x, y);
+ const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);
+
+ let dstIdx;
+ switch (angle) {
+ case 90:
+ dstIdx = dstIdxFunction(y, w - x - 1);
+ break;
+ case -90:
+ dstIdx = dstIdxFunction(h - y - 1, x);
+ break;
+ case 180:
+ dstIdx = dstIdxFunction(w - x - 1, h - y - 1);
+ break;
+ default:
+ throw new Error("Unsupported matrix rotation angle");
+ }
+
+ dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);
+ }
+ }
+
+ this.bitmap.data = dstBuffer;
+ this.bitmap.width = nW;
+ this.bitmap.height = nH;
+}
+
+/**
+ * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.
* @param {number} deg the number of degrees to rotate the image by
* @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
*/
@@ -15,7 +105,7 @@ function advancedRotate(deg, mode) {
let w = this.bitmap.width;
let h = this.bitmap.height;
- if (mode === true || typeof mode === 'string') {
+ if (mode === true || typeof mode === "string") {
// resize the image to it maximum dimension and blit the existing image
// onto the center so that when it is rotated the image is kept in bounds
@@ -41,13 +131,15 @@ function advancedRotate(deg, mode) {
}
const c = this.cloneQuiet();
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
- x,
- y,
- idx
- ) {
- this.bitmap.data.writeUInt32BE(this._background, idx);
- });
+ this.scanQuiet(
+ 0,
+ 0,
+ this.bitmap.width,
+ this.bitmap.height,
+ function (x, y, idx) {
+ this.bitmap.data.writeUInt32BE(this._background, idx);
+ }
+ );
const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);
this.resize(max, max, mode);
@@ -64,10 +156,10 @@ function advancedRotate(deg, mode) {
const dstBuffer = Buffer.alloc(this.bitmap.data.length);
function createTranslationFunction(deltaX, deltaY) {
- return function(x, y) {
+ return function (x, y) {
return {
x: x + deltaX,
- y: y + deltaY
+ y: y + deltaY,
};
};
}
@@ -100,7 +192,7 @@ function advancedRotate(deg, mode) {
this.bitmap.data = dstBuffer;
- if (mode === true || typeof mode === 'string') {
+ if (mode === true || typeof mode === "string") {
// now crop the image to the final size
const x = bW / 2 - w / 2;
const y = bH / 2 - h / 2;
@@ -110,7 +202,7 @@ function advancedRotate(deg, mode) {
export default () => ({
/**
- * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
+ * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
* @param {number} deg the number of degrees to rotate the image by
* @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
@@ -118,33 +210,42 @@ export default () => ({
*/
rotate(deg, mode, cb) {
// enable overloading
- if (typeof mode === 'undefined' || mode === null) {
+ if (typeof mode === "undefined" || mode === null) {
// e.g. image.resize(120);
// e.g. image.resize(120, null, cb);
// e.g. image.resize(120, undefined, cb);
mode = true;
}
- if (typeof mode === 'function' && typeof cb === 'undefined') {
+ if (typeof mode === "function" && typeof cb === "undefined") {
// e.g. image.resize(120, cb);
cb = mode;
mode = true;
}
- if (typeof deg !== 'number') {
- return throwError.call(this, 'deg must be a number', cb);
+ if (typeof deg !== "number") {
+ return throwError.call(this, "deg must be a number", cb);
}
- if (typeof mode !== 'boolean' && typeof mode !== 'string') {
- return throwError.call(this, 'mode must be a boolean or a string', cb);
+ if (typeof mode !== "boolean" && typeof mode !== "string") {
+ return throwError.call(this, "mode must be a boolean or a string", cb);
}
- advancedRotate.call(this, deg, mode, cb);
+ // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.
+ const matrixRotateAllowed =
+ deg % 90 === 0 &&
+ (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0);
+
+ if (matrixRotateAllowed) {
+ matrixRotate.call(this, deg);
+ } else {
+ advancedRotate.call(this, deg, mode, cb);
+ }
if (isNodePattern(cb)) {
cb.call(this, null, this);
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js b/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js
index 380b6a18..45ee8d2b 100644
--- a/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js
+++ b/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js
@@ -1,636 +1,610 @@
-import { Jimp, mkJGD } from '@jimp/test-utils';
-import configure from '@jimp/custom';
-import blit from '@jimp/plugin-blit';
-import crop from '@jimp/plugin-crop';
-import resize from '@jimp/plugin-resize';
+import { Jimp, mkJGD } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import blit from "@jimp/plugin-blit";
+import crop from "@jimp/plugin-crop";
+import resize from "@jimp/plugin-resize";
-import rotate from '../src';
+import rotate from "../src";
+import { expectToBeJGD } from "@jimp/test-utils/src";
const jimp = configure({ plugins: [rotate, blit, crop, resize] }, Jimp);
-describe('Rotate a image with even size', () => {
+describe("Rotate a image with even size", () => {
let imgSrc = null;
- before(done => {
+ before((done) => {
jimp
.read(
mkJGD(
- '▰▴▴▴▪▪▪▰',
- '▴▴▴▴▪▪▪▪',
- '▴▴▴▴▪▪▪▪',
- '▴▴▴▴▪▪▪▪',
- '▪▪▪▪▴▴▴▴',
- '▪▪▪▪▴▴▴▴',
- '▪▪▪▪▴▴▴▴',
- '▦▪▪▪▴▴▴▦'
+ "▰▴▴▴▪▪▪▰",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▦▪▪▪▴▴▴▦"
)
)
- .then(imgJimp => {
+ .then((imgJimp) => {
imgSrc = imgJimp;
done();
})
.catch(done);
});
- it('1 degrees', () => {
- imgSrc
- .clone()
- .rotate(1, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '▰▴▴▴▪▪▪▰ ',
- '▴▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▪▪ ',
- '▪▪▪▪▴▴▴▴ ',
- '▪▪▪▪▴▴▴▴ ',
- '▪▪▪▪▴▴▴▴ ',
- '▦▪▪▪▴▴▴▦ ',
- ' ',
- ' '
- )
- );
+ it("1 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(1, true).getJGDSync(),
+ mkJGD(
+ "▰▴▴▴▪▪▪▰ ",
+ "▴▴▴▴▪▪▪▪ ",
+ "▴▴▴▴▪▪▪▪ ",
+ "▴▴▴▴▪▪▪▪ ",
+ "▪▪▪▪▴▴▴▴ ",
+ "▪▪▪▪▴▴▴▴ ",
+ "▪▪▪▪▴▴▴▴ ",
+ "▦▪▪▪▴▴▴▦ ",
+ " ",
+ " "
+ )
+ );
});
- it('91 degrees', () => {
- imgSrc
- .clone()
- .rotate(91, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- '▰▪▪▪▴▴▴▦ ',
- '▪▪▪▪▴▴▴▴ ',
- '▪▪▪▪▴▴▴▴ ',
- '▪▪▪▪▴▴▴▴ ',
- '▴▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▪▪ ',
- '▰▴▴▴▪▪▪▦ ',
- ' '
- )
- );
+ it("91 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(91, true).getJGDSync(),
+ mkJGD(
+ " ",
+ "▰▪▪▪▴▴▴▦ ",
+ "▪▪▪▪▴▴▴▴ ",
+ "▪▪▪▪▴▴▴▴ ",
+ "▪▪▪▪▴▴▴▴ ",
+ "▴▴▴▴▪▪▪▪ ",
+ "▴▴▴▴▪▪▪▪ ",
+ "▴▴▴▴▪▪▪▪ ",
+ "▰▴▴▴▪▪▪▦ ",
+ " "
+ )
+ );
});
- it('30 degrees', () => {
- imgSrc
- .clone()
- .rotate(30, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ▰▰ ',
- ' ▪▪▪▪ ',
- ' ▴▪▪▪▪▪ ',
- '▴▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▴▴▴ ',
- '▴▴▴▴▪▴▴▴▴▴ ',
- ' ▴▴▪▪▴▴▴▴▦ ',
- ' ▪▪▪▪▪▴▴▴ ',
- ' ▪▪▪▪▪ ',
- ' ▪▪▪ ',
- ' ▦ ',
- ' '
- )
- );
+ it("30 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(30, true).getJGDSync(),
+ mkJGD(
+ " ▰▰ ",
+ " ▪▪▪▪ ",
+ " ▴▪▪▪▪▪ ",
+ "▴▴▴▴▪▪▪▪ ",
+ "▴▴▴▴▪▪▴▴▴ ",
+ "▴▴▴▴▪▴▴▴▴▴ ",
+ " ▴▴▪▪▴▴▴▴▦ ",
+ " ▪▪▪▪▪▴▴▴ ",
+ " ▪▪▪▪▪ ",
+ " ▪▪▪ ",
+ " ▦ ",
+ " "
+ )
+ );
});
- it('45 degrees', () => {
- imgSrc
- .clone()
- .rotate(45, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▰ ',
- ' ▪▪▪ ',
- ' ▪▪▪▪▪ ',
- ' ▴▴▪▪▪▪▴ ',
- ' ▴▴▴▴▪▪▴▴▴ ',
- '▰▰▴▴▴▴▴▴▴▴▦ ',
- ' ▴▴▴▴▪▪▴▴▴ ',
- ' ▴▴▪▪▪▪▴ ',
- ' ▪▪▪▪▪ ',
- ' ▪▪▪ ',
- ' ▦ ',
- ' ',
- ' '
- )
- );
+ it("45 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(45, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ▰ ",
+ " ▪▪▪ ",
+ " ▪▪▪▪▪ ",
+ " ▴▴▪▪▪▪▴ ",
+ " ▴▴▴▴▪▪▴▴▴ ",
+ "▰▰▴▴▴▴▴▴▴▴▦ ",
+ " ▴▴▴▴▪▪▴▴▴ ",
+ " ▴▴▪▪▪▪▴ ",
+ " ▪▪▪▪▪ ",
+ " ▪▪▪ ",
+ " ▦ ",
+ " ",
+ " "
+ )
+ );
});
- it('60 degrees', () => {
- imgSrc
- .clone()
- .rotate(60, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ▰ ',
- ' ▪▪▪ ',
- ' ▪▪▪▪▪ ',
- ' ▪▪▪▪▪▴▴▴ ',
- ' ▴▴▪▪▴▴▴▴▦ ',
- '▴▴▴▴▪▴▴▴▴▴ ',
- '▴▴▴▴▪▪▴▴▴ ',
- '▴▴▴▴▪▪▪▪ ',
- ' ▴▪▪▪▪▪ ',
- ' ▪▪▪▪ ',
- ' ▦▦ ',
- ' '
- )
- );
+ it("60 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(60, true).getJGDSync(),
+ mkJGD(
+ " ▰ ",
+ " ▪▪▪ ",
+ " ▪▪▪▪▪ ",
+ " ▪▪▪▪▪▴▴▴ ",
+ " ▴▴▪▪▴▴▴▴▦ ",
+ "▴▴▴▴▪▴▴▴▴▴ ",
+ "▴▴▴▴▪▪▴▴▴ ",
+ "▴▴▴▴▪▪▪▪ ",
+ " ▴▪▪▪▪▪ ",
+ " ▪▪▪▪ ",
+ " ▦▦ ",
+ " "
+ )
+ );
});
- it('90 degrees', () => {
- imgSrc
- .clone()
- .rotate(90, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- '▰▪▪▪▴▴▴▦ ',
- '▪▪▪▪▴▴▴▴ ',
- '▪▪▪▪▴▴▴▴ ',
- '▪▪▪▪▴▴▴▴ ',
- '▴▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▪▪ ',
- '▰▴▴▴▪▪▪▦ ',
- ' '
- )
- );
+ it("90 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(90, true).getJGDSync(),
+ mkJGD(
+ "▰▪▪▪▴▴▴▦",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▰▴▴▴▪▪▪▦"
+ )
+ );
});
- it('120 degrees', () => {
- imgSrc
- .clone()
- .rotate(120, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▴▦ ',
- ' ▴▴▴▴ ',
- ' ▪▪▴▴▴▴ ',
- '▰▪▪▪▴▴▴▴▪ ',
- '▰▪▪▪▪▴▴▪▪▪ ',
- ' ▪▪▪▪▪▪▪▪▪ ',
- ' ▪▪▴▴▴▪▪▪▪▦ ',
- ' ▴▴▴▴▴▪▪ ',
- ' ▴▴▴▴▪ ',
- ' ▴▴▴ ',
- ' '
- )
- );
+ it("-90 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(-90, true).getJGDSync(),
+ mkJGD(
+ "▦▪▪▪▴▴▴▰",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▦▴▴▴▪▪▪▰"
+ )
+ );
});
- it('135 degrees', () => {
- imgSrc
- .clone()
- .rotate(135, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ',
- ' ▦ ',
- ' ▴▴▴ ',
- ' ▴▴▴▴▴ ',
- ' ▪▪▴▴▴▪▪ ',
- ' ▪▪▪▪▴▪▪▪▪ ',
- ' ▰▪▪▪▪▴▪▪▪▪▦ ',
- ' ▪▪▪▴▴▴▪▪▪ ',
- ' ▪▴▴▴▴▴▪ ',
- ' ▴▴▴▴▴ ',
- ' ▴▰▴ ',
- ' ▰ ',
- ' '
- )
- );
+ it("120 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(120, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ▴▦ ",
+ " ▴▴▴▴ ",
+ " ▪▪▴▴▴▴ ",
+ "▰▪▪▪▴▴▴▴▪ ",
+ "▰▪▪▪▪▴▴▪▪▪ ",
+ " ▪▪▪▪▪▪▪▪▪ ",
+ " ▪▪▴▴▴▪▪▪▪▦ ",
+ " ▴▴▴▴▴▪▪ ",
+ " ▴▴▴▴▪ ",
+ " ▴▴▴ ",
+ " "
+ )
+ );
});
- it('180 degrees', () => {
- imgSrc
- .clone()
- .rotate(180, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▦▴▴▴▪▪▪▦ ',
- ' ▴▴▴▴▪▪▪▪ ',
- ' ▴▴▴▴▪▪▪▪ ',
- ' ▴▴▴▴▪▪▪▪ ',
- ' ▪▪▪▪▴▴▴▴ ',
- ' ▪▪▪▪▴▴▴▴ ',
- ' ▪▪▪▪▴▴▴▴ ',
- ' ▰▪▪▪▴▴▴▰ ',
- ' '
- )
- );
+ it("135 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(135, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ",
+ " ▦ ",
+ " ▴▴▴ ",
+ " ▴▴▴▴▴ ",
+ " ▪▪▴▴▴▪▪ ",
+ " ▪▪▪▪▴▪▪▪▪ ",
+ " ▰▪▪▪▪▴▪▪▪▪▦ ",
+ " ▪▪▪▴▴▴▪▪▪ ",
+ " ▪▴▴▴▴▴▪ ",
+ " ▴▴▴▴▴ ",
+ " ▴▰▴ ",
+ " ▰ ",
+ " "
+ )
+ );
});
- it('225 degrees', () => {
- imgSrc
- .clone()
- .rotate(225, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▦ ',
- ' ▪▪▪ ',
- ' ▪▪▪▪▪ ',
- ' ▴▪▪▪▪▴▴ ',
- ' ▴▴▴▪▪▴▴▴▴ ',
- ' ▦▴▴▴▴▴▴▴▴▰▰ ',
- ' ▴▴▴▪▪▴▴▴▴ ',
- ' ▴▪▪▪▪▴▴ ',
- ' ▪▪▪▪▪ ',
- ' ▪▪▪ ',
- ' ▰ ',
- ' ',
- ' '
- )
- );
+ it("180 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(180, true).getJGDSync(),
+ mkJGD(
+ "▦▴▴▴▪▪▪▦",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▰▪▪▪▴▴▴▰"
+ )
+ );
});
- it('270 degrees', () => {
- imgSrc
- .clone()
- .rotate(270, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ▦▪▪▪▴▴▴▰ ',
- ' ▪▪▪▪▴▴▴▴ ',
- ' ▪▪▪▪▴▴▴▴ ',
- ' ▪▪▪▪▴▴▴▴ ',
- ' ▴▴▴▴▪▪▪▪ ',
- ' ▴▴▴▴▪▪▪▪ ',
- ' ▴▴▴▴▪▪▪▪ ',
- ' ▦▴▴▴▪▪▪▰ ',
- ' ',
- ' '
- )
- );
+ it("225 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(225, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ▦ ",
+ " ▪▪▪ ",
+ " ▪▪▪▪▪ ",
+ " ▴▪▪▪▪▴▴ ",
+ " ▴▴▴▪▪▴▴▴▴ ",
+ " ▦▴▴▴▴▴▴▴▴▰▰ ",
+ " ▴▴▴▪▪▴▴▴▴ ",
+ " ▴▪▪▪▪▴▴ ",
+ " ▪▪▪▪▪ ",
+ " ▪▪▪ ",
+ " ▰ ",
+ " ",
+ " "
+ )
+ );
});
- it('315 degrees', () => {
- imgSrc
- .clone()
- .rotate(315, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ▰ ',
- ' ▴▰▴ ',
- ' ▴▴▴▴▴ ',
- ' ▪▴▴▴▴▴▪ ',
- ' ▪▪▪▴▴▴▪▪▪ ',
- ' ▦▪▪▪▪▴▪▪▪▪▰ ',
- ' ▪▪▪▪▴▪▪▪▪ ',
- ' ▪▪▴▴▴▪▪ ',
- ' ▴▴▴▴▴ ',
- ' ▴▴▴ ',
- ' ▦ ',
- ' ',
- ' ',
- ' '
- )
- );
+ it("270 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(270, true).getJGDSync(),
+ mkJGD(
+ "▦▪▪▪▴▴▴▰",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▦▴▴▴▪▪▪▰"
+ )
+ );
});
- it('360 degrees', () => {
- imgSrc
- .clone()
- .rotate(360, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '▰▴▴▴▪▪▪▰ ',
- '▴▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▪▪ ',
- '▪▪▪▪▴▴▴▴ ',
- '▪▪▪▪▴▴▴▴ ',
- '▪▪▪▪▴▴▴▴ ',
- '▦▪▪▪▴▴▴▦ ',
- ' ',
- ' '
- )
- );
+ it("315 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(315, true).getJGDSync(),
+ mkJGD(
+ " ▰ ",
+ " ▴▰▴ ",
+ " ▴▴▴▴▴ ",
+ " ▪▴▴▴▴▴▪ ",
+ " ▪▪▪▴▴▴▪▪▪ ",
+ " ▦▪▪▪▪▴▪▪▪▪▰ ",
+ " ▪▪▪▪▴▪▪▪▪ ",
+ " ▪▪▴▴▴▪▪ ",
+ " ▴▴▴▴▴ ",
+ " ▴▴▴ ",
+ " ▦ ",
+ " ",
+ " ",
+ " "
+ )
+ );
+ });
+
+ it("360 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(360, true).getJGDSync(),
+ mkJGD(
+ "▰▴▴▴▪▪▪▰",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▴▴▴▴▪▪▪▪",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▪▪▪▪▴▴▴▴",
+ "▦▪▪▪▴▴▴▦"
+ )
+ );
});
});
-describe('Rotate a image with odd size', () => {
+describe("Rotate a image with odd size", () => {
let imgSrc = null;
- before(done => {
+ before((done) => {
jimp
.read(
mkJGD(
- '▴▴▴▦▪▪▪',
- '▴▴▴▦▪▪▪',
- '▴▴▴▦▪▪▪',
- '▦▦▦▦▦▦▦',
- '▴▴▴▦▴▴▴',
- '▴▴▴▦▴▴▴',
- '▴▴▴▦▴▴▴'
+ "▴▴▴▦▪▪▪",
+ "▴▴▴▦▪▪▪",
+ "▴▴▴▦▪▪▪",
+ "▦▦▦▦▦▦▦",
+ "▴▴▴▦▴▴▴",
+ "▴▴▴▦▴▴▴",
+ "▴▴▴▦▴▴▴"
)
)
- .then(imgJimp => {
+ .then((imgJimp) => {
imgSrc = imgJimp;
done();
})
.catch(done);
});
- it('45 degrees', () => {
- imgSrc
- .clone()
- .rotate(45, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▪ ',
- ' ▪▪▪ ',
- ' ▦▪▪▪▦ ',
- ' ▴▴▦▪▦▴▴ ',
- ' ▴▴▴▴▦▴▴▴▴ ',
- ' ▴▴▦▴▦▴▴ ',
- ' ▦▴▴▴▦ ',
- ' ▴▴▴ ',
- ' ▴ ',
- ' ',
- ' '
- )
- );
+ it("45 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(45, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ▪ ",
+ " ▪▪▪ ",
+ " ▦▪▪▪▦ ",
+ " ▴▴▦▪▦▴▴ ",
+ " ▴▴▴▴▦▴▴▴▴ ",
+ " ▴▴▦▴▦▴▴ ",
+ " ▦▴▴▴▦ ",
+ " ▴▴▴ ",
+ " ▴ ",
+ " ",
+ " "
+ )
+ );
});
- it('135 degrees', () => {
- imgSrc
- .clone()
- .rotate(135, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▴ ',
- ' ▴▴▴ ',
- ' ▦▴▴▴▦ ',
- ' ▪▪▦▴▦▴▴ ',
- ' ▪▪▪▪▦▴▴▴▴ ',
- ' ▪▪▦▴▦▴▴ ',
- ' ▦▴▴▴▦ ',
- ' ▴▴▴ ',
- ' ▴ ',
- ' ',
- ' '
- )
- );
+ it("135 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(135, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ▴ ",
+ " ▴▴▴ ",
+ " ▦▴▴▴▦ ",
+ " ▪▪▦▴▦▴▴ ",
+ " ▪▪▪▪▦▴▴▴▴ ",
+ " ▪▪▦▴▦▴▴ ",
+ " ▦▴▴▴▦ ",
+ " ▴▴▴ ",
+ " ▴ ",
+ " ",
+ " "
+ )
+ );
});
- it('225 degrees', () => {
- imgSrc
- .clone()
- .rotate(225, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▴ ',
- ' ▴▴▴ ',
- ' ▦▴▴▴▦ ',
- ' ▴▴▦▴▦▴▴ ',
- ' ▴▴▴▴▦▴▴▴▴ ',
- ' ▴▴▦▪▦▴▴ ',
- ' ▦▪▪▪▦ ',
- ' ▪▪▪ ',
- ' ▪ ',
- ' ',
- ' '
- )
- );
+ it("225 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(225, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ▴ ",
+ " ▴▴▴ ",
+ " ▦▴▴▴▦ ",
+ " ▴▴▦▴▦▴▴ ",
+ " ▴▴▴▴▦▴▴▴▴ ",
+ " ▴▴▦▪▦▴▴ ",
+ " ▦▪▪▪▦ ",
+ " ▪▪▪ ",
+ " ▪ ",
+ " ",
+ " "
+ )
+ );
});
- it('315 degrees', () => {
- imgSrc
- .clone()
- .rotate(315, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▴ ',
- ' ▴▴▴ ',
- ' ▦▴▴▴▦ ',
- ' ▴▴▦▴▦▪▪ ',
- ' ▴▴▴▴▦▪▪▪▪ ',
- ' ▴▴▦▴▦▪▪ ',
- ' ▦▴▴▴▦ ',
- ' ▴▴▴ ',
- ' ▴ ',
- ' ',
- ' '
- )
- );
+ it("315 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(315, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ▴ ",
+ " ▴▴▴ ",
+ " ▦▴▴▴▦ ",
+ " ▴▴▦▴▦▪▪ ",
+ " ▴▴▴▴▦▪▪▪▪ ",
+ " ▴▴▦▴▦▪▪ ",
+ " ▦▴▴▴▦ ",
+ " ▴▴▴ ",
+ " ▴ ",
+ " ",
+ " "
+ )
+ );
});
});
-describe('Rotate a non-square image', () => {
+describe("Rotate a non-square image", () => {
let imgSrc = null;
- before(done => {
+ before((done) => {
jimp
- .read(mkJGD('▴▴▴▴▪▪▪▪', '▴▴▴▴▪▪▪▪', '▦▦▦▦▴▴▴▴', '▦▦▦▦▴▴▴▴'))
- .then(imgJimp => {
+ .read(mkJGD("▴▴▴▴▪▪▪▪", "▴▴▴▴▪▪▪▪", "▦▦▦▦▴▴▴▴", "▦▦▦▦▴▴▴▴"))
+ .then((imgJimp) => {
imgSrc = imgJimp;
done();
})
.catch(done);
});
- it('1 degrees', () => {
- imgSrc
- .clone()
- .rotate(1, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- '▴▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▪▪ ',
- '▦▦▦▦▴▴▴▴ ',
- '▦▦▦▦▴▴▴▴ ',
- ' ',
- ' '
- )
- );
+ it("1 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(1, true).getJGDSync(),
+ mkJGD(
+ "▴▴▴▴▪▪▪▪ ",
+ "▴▴▴▴▪▪▪▪ ",
+ "▦▦▦▦▴▴▴▴ ",
+ "▦▦▦▦▴▴▴▴ ",
+ " ",
+ " "
+ )
+ );
});
- it('10 degrees', () => {
- imgSrc
- .clone()
- .rotate(10, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ▪ ',
- ' ▴▴▴▪▪▪▪ ',
- '▴▴▴▴▪▪▪▴ ',
- '▴▴▦▦▴▴▴▴ ',
- '▦▦▦▦▴▴▴ ',
- '▦▦ ',
- ' ',
- ' '
- )
- );
+ it("10 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(10, true).getJGDSync(),
+ mkJGD(
+ " ▪ ",
+ " ▴▴▴▪▪▪▪ ",
+ "▴▴▴▴▪▪▪▴ ",
+ "▴▴▦▦▴▴▴▴ ",
+ "▦▦▦▦▴▴▴ ",
+ "▦▦ ",
+ " ",
+ " "
+ )
+ );
});
- it('30 degrees', () => {
- imgSrc
- .clone()
- .rotate(30, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▪▪ ',
- ' ▪▪▪▪ ',
- ' ▴▴▪▪▴▴▴ ',
- '▴▴▴▦▴▴▴ ',
- '▴▴▦▦▴▴ ',
- '▦▦▦▦ ',
- ' ▦ ',
- ' ',
- ' '
- )
- );
+ it("30 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(30, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ▪▪ ",
+ " ▪▪▪▪ ",
+ " ▴▴▪▪▴▴▴ ",
+ "▴▴▴▦▴▴▴ ",
+ "▴▴▦▦▴▴ ",
+ "▦▦▦▦ ",
+ " ▦ ",
+ " ",
+ " "
+ )
+ );
});
- it('45 degrees', () => {
- imgSrc
- .clone()
- .rotate(45, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▪▪ ',
- ' ▪▪▪▴ ',
- ' ▴▪▪▴▴▴ ',
- ' ▴▴▴▴▴▴ ',
- '▴▴▴▦▦▴ ',
- '▴▴▦▦▦ ',
- ' ▦▦▦ ',
- ' ▦ ',
- ' '
- )
- );
+ it("45 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(45, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ▪▪ ",
+ " ▪▪▪▴ ",
+ " ▴▪▪▴▴▴ ",
+ " ▴▴▴▴▴▴ ",
+ "▴▴▴▦▦▴ ",
+ "▴▴▦▦▦ ",
+ " ▦▦▦ ",
+ " ▦ ",
+ " "
+ )
+ );
});
- it('90 degrees', () => {
- imgSrc
- .clone()
- .rotate(90, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- '▪▪▴▴ ',
- '▪▪▴▴ ',
- '▪▪▴▴ ',
- '▪▪▴▴ ',
- '▴▴▦▦ ',
- '▴▴▦▦ ',
- '▴▴▦▦ ',
- '▴▴▦▦ ',
- ' '
- )
- );
+ it("90 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(90, true).getJGDSync(),
+ mkJGD("▪▪▴▴", "▪▪▴▴", "▪▪▴▴", "▪▪▴▴", "▴▴▦▦", "▴▴▦▦", "▴▴▦▦", "▴▴▦▦")
+ );
});
- it('135 degrees', () => {
- imgSrc
- .clone()
- .rotate(135, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▴ ',
- ' ▴▴▴ ',
- ' ▪▪▴▴▴ ',
- ' ▪▪▪▴▦▦ ',
- ' ▪▪▴▦▦▦ ',
- ' ▴▴▴▦▦▦ ',
- ' ▴▴▴▦ ',
- ' ▴▴ ',
- ' '
- )
- );
+ it("-90 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(-90, true).getJGDSync(),
+ mkJGD("▦▦▴▴", "▦▦▴▴", "▦▦▴▴", "▦▦▴▴", "▴▴▪▪", "▴▴▪▪", "▴▴▪▪", "▴▴▪▪")
+ );
});
- it('180 degrees', () => {
- imgSrc
- .clone()
- .rotate(180, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ',
- ' ▴▴▴▴▦▦▦▦ ',
- ' ▴▴▴▴▦▦▦▦ ',
- ' ▪▪▪▪▴▴▴▴ ',
- ' ▪▪▪▪▴▴▴▴ ',
- ' '
- )
- );
+ it("135 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(135, true).getJGDSync(),
+ mkJGD(
+ " ",
+ " ▴ ",
+ " ▴▴▴ ",
+ " ▪▪▴▴▴ ",
+ " ▪▪▪▴▦▦ ",
+ " ▪▪▴▦▦▦ ",
+ " ▴▴▴▦▦▦ ",
+ " ▴▴▴▦ ",
+ " ▴▴ ",
+ " "
+ )
+ );
});
- it('225 degrees', () => {
- imgSrc
- .clone()
- .rotate(225, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ▦ ',
- ' ▦▦▦ ',
- ' ▦▦▦▴▴ ',
- ' ▴▦▦▴▴▴ ',
- ' ▴▴▴▴▴▴ ',
- ' ▴▴▴▪▪▴ ',
- ' ▴▪▪▪ ',
- ' ▪▪ ',
- ' ',
- ' '
- )
- );
+ it("180 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(180, true).getJGDSync(),
+ mkJGD("▴▴▴▴▦▦▦▦", "▴▴▴▴▦▦▦▦", "▪▪▪▪▴▴▴▴", "▪▪▪▪▴▴▴▴")
+ );
});
- it('315 degrees', () => {
- imgSrc
- .clone()
- .rotate(315, true)
- .getJGDSync()
- .should.be.sameJGD(
- mkJGD(
- ' ▴▴ ',
- ' ▦▴▴▴ ',
- '▦▦▦▴▴▴ ',
- ' ▦▦▦▴▪▪ ',
- ' ▦▦▴▪▪▪ ',
- ' ▴▴▴▪▪ ',
- ' ▴▴▴ ',
- ' ▴ ',
- ' ',
- ' '
- )
- );
+ it("225 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(225, true).getJGDSync(),
+ mkJGD(
+ " ▦ ",
+ " ▦▦▦ ",
+ " ▦▦▦▴▴ ",
+ " ▴▦▦▴▴▴ ",
+ " ▴▴▴▴▴▴ ",
+ " ▴▴▴▪▪▴ ",
+ " ▴▪▪▪ ",
+ " ▪▪ ",
+ " ",
+ " "
+ )
+ );
+ });
+
+ it("315 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(315, true).getJGDSync(),
+ mkJGD(
+ " ▴▴ ",
+ " ▦▴▴▴ ",
+ "▦▦▦▴▴▴ ",
+ " ▦▦▦▴▪▪ ",
+ " ▦▦▴▪▪▪ ",
+ " ▴▴▴▪▪ ",
+ " ▴▴▴ ",
+ " ▴ ",
+ " ",
+ " "
+ )
+ );
+ });
+ it("-180 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(-180, true).getJGDSync(),
+ mkJGD("▴▴▴▴▦▦▦▦", "▴▴▴▴▦▦▦▦", "▪▪▪▪▴▴▴▴", "▪▪▪▪▴▴▴▴")
+ );
+ });
+
+ it("-270 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(-270, true).getJGDSync(),
+ mkJGD("▪▪▴▴", "▪▪▴▴", "▪▪▴▴", "▪▪▴▴", "▴▴▦▦", "▴▴▦▦", "▴▴▦▦", "▴▴▦▦")
+ );
+ });
+});
+
+describe("Rotate a non-square image without resizing", () => {
+ let imgSrc = null;
+ before((done) => {
+ jimp
+ .read(mkJGD("□□□□□□□□", "▹▹▹▹▹▹▹▹", "▿▿▿▿▿▿▿▿", "□□□□□□□□"))
+ .then((imgJimp) => {
+ imgSrc = imgJimp;
+ done();
+ })
+ .catch(done);
+ });
+
+ it("90 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(90, false).getJGDSync(),
+ mkJGD(" □▹▿□ ", " □▹▿□ ", " □▹▿□ ", " □▹▿□ ")
+ );
+ });
+
+ it("180 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(180, false).getJGDSync(),
+ mkJGD("□□□□□□□□", "▿▿▿▿▿▿▿▿", "▹▹▹▹▹▹▹▹", "□□□□□□□□")
+ );
+ });
+
+ it("270 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(270, false).getJGDSync(),
+ mkJGD(" □▿▹□ ", " □▿▹□ ", " □▿▹□ ", " □▿▹□ ")
+ );
+ });
+
+ it("45 degrees", () => {
+ expectToBeJGD(
+ imgSrc.clone().rotate(45, false).getJGDSync(),
+ mkJGD(" □▹▹▿□□ ", "□▹▹▿□□ ", "▹▹▿□□ ", "▹▿□□ ")
+ );
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md
index 26394e0f..8d029143 100644
--- a/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md
@@ -1,3 +1,51 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +60,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +68,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-scale/README.md b/project starter code/node_modules/@jimp/plugin-scale/README.md
index d887b4d2..708a7771 100644
--- a/project starter code/node_modules/@jimp/plugin-scale/README.md
+++ b/project starter code/node_modules/@jimp/plugin-scale/README.md
@@ -14,10 +14,10 @@ Uniformly scales the image by a factor.
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.scale(2);
image.scale(2, jimp.RESIZE_BEZIER);
@@ -36,10 +36,10 @@ Scale the image to the largest size that fits inside the rectangle that has the
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.scaleToFit(100, 100);
}
diff --git a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js b/project starter code/node_modules/@jimp/plugin-scale/dist/index.js
index 635255a5..54e8b44a 100644
--- a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-scale/dist/index.js
@@ -3,74 +3,60 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
-var _default = function _default() {
- return {
- /**
- * Uniformly scales the image by a factor.
- * @param {number} f the factor to scale the image by
- * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- scale: function scale(f, mode, cb) {
- if (typeof f !== 'number') {
- return _utils.throwError.call(this, 'f must be a number', cb);
- }
-
- if (f < 0) {
- return _utils.throwError.call(this, 'f must be a positive number', cb);
- }
-
- if (typeof mode === 'function' && typeof cb === 'undefined') {
- cb = mode;
- mode = null;
- }
-
- var w = this.bitmap.width * f;
- var h = this.bitmap.height * f;
- this.resize(w, h, mode);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Scale the image to the largest size that fits inside the rectangle that has the given width and height.
- * @param {number} w the width to resize the image to
- * @param {number} h the height to resize the image to
- * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- scaleToFit: function scaleToFit(w, h, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers', cb);
- }
-
- if (typeof mode === 'function' && typeof cb === 'undefined') {
- cb = mode;
- mode = null;
- }
-
- var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width;
- this.scale(f, mode);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+var _default = () => ({
+ /**
+ * Uniformly scales the image by a factor.
+ * @param {number} f the factor to scale the image by
+ * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ scale(f, mode, cb) {
+ if (typeof f !== "number") {
+ return _utils.throwError.call(this, "f must be a number", cb);
}
- };
-};
-
-exports["default"] = _default;
+ if (f < 0) {
+ return _utils.throwError.call(this, "f must be a positive number", cb);
+ }
+ if (typeof mode === "function" && typeof cb === "undefined") {
+ cb = mode;
+ mode = null;
+ }
+ const w = this.bitmap.width * f;
+ const h = this.bitmap.height * f;
+ this.resize(w, h, mode);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Scale the image to the largest size that fits inside the rectangle that has the given width and height.
+ * @param {number} w the width to resize the image to
+ * @param {number} h the height to resize the image to
+ * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ scaleToFit(w, h, mode, cb) {
+ if (typeof w !== "number" || typeof h !== "number") {
+ return _utils.throwError.call(this, "w and h must be numbers", cb);
+ }
+ if (typeof mode === "function" && typeof cb === "undefined") {
+ cb = mode;
+ mode = null;
+ }
+ const f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width;
+ this.scale(f, mode);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map
index 28aeaa90..021c5555 100644
--- a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["scale","f","mode","cb","throwError","call","w","bitmap","width","h","height","resize","scaleToFit"],"mappings":";;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;AAOAA,IAAAA,KARoB,iBAQdC,CARc,EAQXC,IARW,EAQLC,EARK,EAQD;AACjB,UAAI,OAAOF,CAAP,KAAa,QAAjB,EAA2B;AACzB,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,UAAIF,CAAC,GAAG,CAAR,EAAW;AACT,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,6BAAtB,EAAqDF,EAArD,CAAP;AACD;;AAED,UAAI,OAAOD,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAC3DA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAED,UAAMI,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAAZ,GAAoBP,CAA9B;AACA,UAAMQ,CAAC,GAAG,KAAKF,MAAL,CAAYG,MAAZ,GAAqBT,CAA/B;AACA,WAAKU,MAAL,CAAYL,CAAZ,EAAeG,CAAf,EAAkBP,IAAlB;;AAEA,UAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD,KA/BmB;;AAiCpB;;;;;;;;AAQAO,IAAAA,UAzCoB,sBAyCTN,CAzCS,EAyCNG,CAzCM,EAyCHP,IAzCG,EAyCGC,EAzCH,EAyCO;AACzB,UAAI,OAAOG,CAAP,KAAa,QAAb,IAAyB,OAAOG,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOL,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,UAAI,OAAOD,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAC3DA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAED,UAAMD,CAAC,GACLK,CAAC,GAAGG,CAAJ,GAAQ,KAAKF,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYG,MAAxC,GACID,CAAC,GAAG,KAAKF,MAAL,CAAYG,MADpB,GAEIJ,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAHtB;AAIA,WAAKR,KAAL,CAAWC,CAAX,EAAcC,IAAd;;AAEA,UAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0) {\n return throwError.call(this, 'f must be a positive number', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["scale","f","mode","cb","throwError","call","w","bitmap","width","h","height","resize","isNodePattern","scaleToFit"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n\n if (f < 0) {\n return throwError.call(this, \"f must be a positive number\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAAwD,eAEzC,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;AACA;EACEA,KAAK,CAACC,CAAC,EAAEC,IAAI,EAAEC,EAAE,EAAE;IACjB,IAAI,OAAOF,CAAC,KAAK,QAAQ,EAAE;MACzB,OAAOG,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAEF,EAAE,CAAC;IACxD;IAEA,IAAIF,CAAC,GAAG,CAAC,EAAE;MACT,OAAOG,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,6BAA6B,EAAEF,EAAE,CAAC;IACjE;IAEA,IAAI,OAAOD,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;MAC3DA,EAAE,GAAGD,IAAI;MACTA,IAAI,GAAG,IAAI;IACb;IAEA,MAAMI,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK,GAAGP,CAAC;IAC/B,MAAMQ,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM,GAAGT,CAAC;IAChC,IAAI,CAACU,MAAM,CAACL,CAAC,EAAEG,CAAC,EAAEP,IAAI,CAAC;IAEvB,IAAI,IAAAU,oBAAa,EAACT,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEQ,UAAU,CAACP,CAAC,EAAEG,CAAC,EAAEP,IAAI,EAAEC,EAAE,EAAE;IACzB,IAAI,OAAOG,CAAC,KAAK,QAAQ,IAAI,OAAOG,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOL,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;IAC7D;IAEA,IAAI,OAAOD,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;MAC3DA,EAAE,GAAGD,IAAI;MACTA,IAAI,GAAG,IAAI;IACb;IAEA,MAAMD,CAAC,GACLK,CAAC,GAAGG,CAAC,GAAG,IAAI,CAACF,MAAM,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACG,MAAM,GAC1CD,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM,GACtBJ,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK;IAC3B,IAAI,CAACR,KAAK,CAACC,CAAC,EAAEC,IAAI,CAAC;IAEnB,IAAI,IAAAU,oBAAa,EAACT,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-scale/es/index.js b/project starter code/node_modules/@jimp/plugin-scale/es/index.js
index 80050107..5f85aa5f 100644
--- a/project starter code/node_modules/@jimp/plugin-scale/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-scale/es/index.js
@@ -1,75 +1,53 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
-
-var _default = function _default() {
- return {
- /**
- * Uniformly scales the image by a factor.
- * @param {number} f the factor to scale the image by
- * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- scale: function scale(f, mode, cb) {
- if (typeof f !== 'number') {
- return _utils.throwError.call(this, 'f must be a number', cb);
- }
-
- if (f < 0) {
- return _utils.throwError.call(this, 'f must be a positive number', cb);
- }
-
- if (typeof mode === 'function' && typeof cb === 'undefined') {
- cb = mode;
- mode = null;
- }
-
- var w = this.bitmap.width * f;
- var h = this.bitmap.height * f;
- this.resize(w, h, mode);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Scale the image to the largest size that fits inside the rectangle that has the given width and height.
- * @param {number} w the width to resize the image to
- * @param {number} h the height to resize the image to
- * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- scaleToFit: function scaleToFit(w, h, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return _utils.throwError.call(this, 'w and h must be numbers', cb);
- }
-
- if (typeof mode === 'function' && typeof cb === 'undefined') {
- cb = mode;
- mode = null;
- }
-
- var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width;
- this.scale(f, mode);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+import { isNodePattern, throwError } from "@jimp/utils";
+export default (() => ({
+ /**
+ * Uniformly scales the image by a factor.
+ * @param {number} f the factor to scale the image by
+ * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ scale(f, mode, cb) {
+ if (typeof f !== "number") {
+ return throwError.call(this, "f must be a number", cb);
}
- };
-};
-
-exports["default"] = _default;
+ if (f < 0) {
+ return throwError.call(this, "f must be a positive number", cb);
+ }
+ if (typeof mode === "function" && typeof cb === "undefined") {
+ cb = mode;
+ mode = null;
+ }
+ const w = this.bitmap.width * f;
+ const h = this.bitmap.height * f;
+ this.resize(w, h, mode);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Scale the image to the largest size that fits inside the rectangle that has the given width and height.
+ * @param {number} w the width to resize the image to
+ * @param {number} h the height to resize the image to
+ * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ scaleToFit(w, h, mode, cb) {
+ if (typeof w !== "number" || typeof h !== "number") {
+ return throwError.call(this, "w and h must be numbers", cb);
+ }
+ if (typeof mode === "function" && typeof cb === "undefined") {
+ cb = mode;
+ mode = null;
+ }
+ const f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width;
+ this.scale(f, mode);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map b/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map
index 28aeaa90..0cbef4fa 100644
--- a/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["scale","f","mode","cb","throwError","call","w","bitmap","width","h","height","resize","scaleToFit"],"mappings":";;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;AAOAA,IAAAA,KARoB,iBAQdC,CARc,EAQXC,IARW,EAQLC,EARK,EAQD;AACjB,UAAI,OAAOF,CAAP,KAAa,QAAjB,EAA2B;AACzB,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,UAAIF,CAAC,GAAG,CAAR,EAAW;AACT,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,6BAAtB,EAAqDF,EAArD,CAAP;AACD;;AAED,UAA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AACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0) {\n return throwError.call(this, 'f must be a positive number', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","throwError","scale","f","mode","cb","call","w","bitmap","width","h","height","resize","scaleToFit"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n\n if (f < 0) {\n return throwError.call(this, \"f must be a positive number\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;AAEvD,gBAAe,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,KAAK,CAACC,CAAC,EAAEC,IAAI,EAAEC,EAAE,EAAE;IACjB,IAAI,OAAOF,CAAC,KAAK,QAAQ,EAAE;MACzB,OAAOF,UAAU,CAACK,IAAI,CAAC,IAAI,EAAE,oBAAoB,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M,CAACC,KAAK;IAC3B,IAAI,CAACP,KAAK,CAACC,CAAC,EAAEC,IAAI,CAAC;IAEnB,IAAIJ,aAAa,CAACK,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-scale/index.d.ts b/project starter code/node_modules/@jimp/plugin-scale/index.d.ts
index dcf58180..28c26ba2 100644
--- a/project starter code/node_modules/@jimp/plugin-scale/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-scale/index.d.ts
@@ -1,10 +1,15 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Scale {
scale(f: number, cb?: ImageCallback): this;
scale(f: number, mode?: string, cb?: ImageCallback): this;
scaleToFit(w: number, h: number, cb?: ImageCallback): this;
- scaleToFit(w: number, h: number, mode?: string, cb?: ImageCallback): this;
+ scaleToFit(
+ w: number,
+ h: number,
+ mode?: string,
+ cb?: ImageCallback
+ ): this;
}
-export default function(): Scale;
+export default function (): Scale;
diff --git a/project starter code/node_modules/@jimp/plugin-scale/package.json b/project starter code/node_modules/@jimp/plugin-scale/package.json
index edc84ff5..a4295426 100644
--- a/project starter code/node_modules/@jimp/plugin-scale/package.json
+++ b/project starter code/node_modules/@jimp/plugin-scale/package.json
@@ -1,9 +1,10 @@
{
"name": "@jimp/plugin-scale",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "scale an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
"build": "npm run build:node:production && npm run build:module",
@@ -17,8 +18,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -27,5 +27,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-scale/src/index.js b/project starter code/node_modules/@jimp/plugin-scale/src/index.js
index 4670f228..f67ce2b3 100644
--- a/project starter code/node_modules/@jimp/plugin-scale/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-scale/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern, throwError } from '@jimp/utils';
+import { isNodePattern, throwError } from "@jimp/utils";
export default () => ({
/**
@@ -9,15 +9,15 @@ export default () => ({
* @returns {Jimp} this for chaining of methods
*/
scale(f, mode, cb) {
- if (typeof f !== 'number') {
- return throwError.call(this, 'f must be a number', cb);
+ if (typeof f !== "number") {
+ return throwError.call(this, "f must be a number", cb);
}
if (f < 0) {
- return throwError.call(this, 'f must be a positive number', cb);
+ return throwError.call(this, "f must be a positive number", cb);
}
- if (typeof mode === 'function' && typeof cb === 'undefined') {
+ if (typeof mode === "function" && typeof cb === "undefined") {
cb = mode;
mode = null;
}
@@ -42,11 +42,11 @@ export default () => ({
* @returns {Jimp} this for chaining of methods
*/
scaleToFit(w, h, mode, cb) {
- if (typeof w !== 'number' || typeof h !== 'number') {
- return throwError.call(this, 'w and h must be numbers', cb);
+ if (typeof w !== "number" || typeof h !== "number") {
+ return throwError.call(this, "w and h must be numbers", cb);
}
- if (typeof mode === 'function' && typeof cb === 'undefined') {
+ if (typeof mode === "function" && typeof cb === "undefined") {
cb = mode;
mode = null;
}
@@ -62,5 +62,5 @@ export default () => ({
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md
index 4642075d..51272b3f 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md
@@ -1,3 +1,65 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +74,7 @@
# v0.9.4 (Tue Mar 03 2020)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/plugin-shadow`
- Update plugin-shadow type definition. [#841](https://github.com/oliver-moran/jimp/pull/841) ([@lekoaf](https://github.com/lekoaf))
@@ -25,7 +87,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -33,4 +95,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/README.md b/project starter code/node_modules/@jimp/plugin-shadow/README.md
index 5258bc38..b068cd22 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/README.md
+++ b/project starter code/node_modules/@jimp/plugin-shadow/README.md
@@ -16,10 +16,10 @@
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.shadow();
// or
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js b/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js
index 60a6d805..13e2603a 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js
+++ b/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js
@@ -1,38 +1,38 @@
-module.exports = api => {
+module.exports = (api) => {
api.cache(true);
return {
presets: [
[
- '@babel/env',
+ "@babel/env",
{
- useBuiltIns: 'usage'
- }
- ]
+ useBuiltIns: "usage",
+ },
+ ],
],
plugins: [
- '@babel/proposal-class-properties',
- '@babel/syntax-object-rest-spread',
- process.env.BABEL_ENV !== 'module' && 'add-module-exports',
+ "@babel/proposal-class-properties",
+ "@babel/syntax-object-rest-spread",
+ process.env.BABEL_ENV !== "module" && "add-module-exports",
[
- 'transform-inline-environment-variables',
- { include: ['BABEL_ENV', 'ENV'] }
- ]
+ "transform-inline-environment-variables",
+ { include: ["BABEL_ENV", "ENV"] },
+ ],
].filter(Boolean),
env: {
test: {
- plugins: ['istanbul']
+ plugins: ["istanbul"],
},
development: {
- plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter(
+ plugins: [process.env.ENV !== "browser" && "source-map-support"].filter(
Boolean
- )
+ ),
},
module: {
- presets: [['@babel/env', { modules: false }]]
- }
- }
+ presets: [["@babel/env", { modules: false }]],
+ },
+ },
};
};
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js b/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js
index 2979db55..532dce71 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js
@@ -3,10 +3,8 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Creates a circle out of an image.
* @param {function(Error, Jimp)} options (optional)
@@ -18,60 +16,52 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- shadow: function shadow() {
- var _this = this;
-
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var cb = arguments.length > 1 ? arguments[1] : undefined;
-
- if (typeof options === 'function') {
- cb = options;
- options = {};
- }
-
- var _options = options,
- _options$opacity = _options.opacity,
- opacity = _options$opacity === void 0 ? 0.7 : _options$opacity,
- _options$size = _options.size,
- size = _options$size === void 0 ? 1.1 : _options$size,
- _options$x = _options.x,
- x = _options$x === void 0 ? -25 : _options$x,
- _options$y = _options.y,
- y = _options$y === void 0 ? 25 : _options$y,
- _options$blur = _options.blur,
- blur = _options$blur === void 0 ? 5 : _options$blur; // clone the image
-
- var orig = this.clone();
- var shadow = this.clone(); // turn all it's pixels black
-
- shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, function (x, y, idx) {
- shadow.bitmap.data[idx] = 0x00;
- shadow.bitmap.data[idx + 1] = 0x00;
- shadow.bitmap.data[idx + 2] = 0x00; // up the opacity a little,
-
- shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity);
- _this.bitmap.data[idx] = 0x00;
- _this.bitmap.data[idx + 1] = 0x00;
- _this.bitmap.data[idx + 2] = 0x00;
- _this.bitmap.data[idx + 3] = 0x00;
- }); // enlarge it. This creates a "shadow".
+var _default = () => ({
+ shadow() {
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ let cb = arguments.length > 1 ? arguments[1] : undefined;
+ if (typeof options === "function") {
+ cb = options;
+ options = {};
+ }
+ const {
+ opacity = 0.7,
+ size = 1.1,
+ x = -25,
+ y = 25,
+ blur = 5
+ } = options;
- shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); // Then blit the "shadow" onto the background and the image on top of that.
+ // clone the image
+ const orig = this.clone();
+ const shadow = this.clone();
- this.composite(shadow, x, y);
- this.composite(orig, 0, 0);
+ // turn all it's pixels black
+ shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, (x, y, idx) => {
+ shadow.bitmap.data[idx] = 0x00;
+ shadow.bitmap.data[idx + 1] = 0x00;
+ shadow.bitmap.data[idx + 2] = 0x00;
+ // up the opacity a little,
+ shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity);
+ this.bitmap.data[idx] = 0x00;
+ this.bitmap.data[idx + 1] = 0x00;
+ this.bitmap.data[idx + 2] = 0x00;
+ this.bitmap.data[idx + 3] = 0x00;
+ });
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
+ // enlarge it. This creates a "shadow".
+ shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur);
- return this;
+ // Then blit the "shadow" onto the background and the image on top of that.
+ this.composite(shadow, x, y);
+ this.composite(orig, 0, 0);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
}
- };
-};
-
-exports["default"] = _default;
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map
index 7f483603..8201f6fe 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;eAWe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA;;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;A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AAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACD,OAlBH,EAbuB,CAkCvB;;AACAd,MAAAA,MAAM,CACHkB,MADH,CACUlB,MAAM,CAACW,MAAP,CAAcC,KAAd,GAAsBR,IADhC,EACsCJ,MAAM,CAACW,MAAP,CAAcE,MAAd,GAAuBT,IAD7D,EAEGG,IAFH,CAEQA,IAFR,EAnCuB,CAuCvB;;AACA,WAAKY,SAAL,CAAenB,MAAf,EAAuBK,CAAvB,EAA0BC,CAA1B;AACA,WAAKa,SAAL,CAAeX,IAAf,EAAqB,CAArB,EAAwB,CAAxB;;AAEA,UAAI,0BAAcN,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACkB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjDmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","isNodePattern","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,eAWe,OAAO;EACpBA,MAAM,GAAmB;IAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;IAAA,IAAEC,EAAE;IACrB,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;MACjCC,EAAE,GAAGD,OAAO;MACZA,OAAO,GAAG,CAAC,CAAC;IACd;IAEA,MAAM;MAAEE,OAAO,GAAG,GAAG;MAAEC,IAAI,GAAG,GAAG;MAAEC,CAAC,GAAG,CAAC,EAAE;MAAEC,CAAC,GAAG,EAAE;MAAEC,IAAI,GAAG;IAAE,CAAC,GAAGN,OAAO;;IAExE;IACA,MAAMO,IAAI,GAAG,IAAI,CAACC,KAAK,EAAE;IACzB,MAAMT,MAAM,GAAG,IAAI,CAACS,KAAK,EAAE;;IAE3B;IACAT,MAAM,CAACU,IAAI,CACT,CAAC,EACD,CAAC,EACDV,MAAM,CAACW,MAAM,CAACC,KAAK,EACnBZ,MAAM,CAACW,MAAM,CAACE,MAAM,EACpB,CAACR,CAAC,EAAEC,CAAC,EAAEQ,GAAG,KAAK;MACbd,MAAM,CAACW,MAAM,CAACI,IAAI,CAACD,GAAG,CAAC,GAAG,IAAI;MAC9Bd,MAAM,CAACW,MAAM,CAACI,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI;MAClCd,MAAM,CAACW,MAAM,CAACI,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI;MAClC;MACAd,MAAM,CAACW,MAAM,CAACI,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAGd,MAAM,CAACgB,WAAW,CAACC,QAAQ,CACvDjB,MAAM,CAACW,MAAM,CAACI,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAGX,OAAO,CACtC;MAED,IAAI,CAACQ,MAAM,CAACI,IAAI,CAACD,GAAG,CAAC,GAAG,IAAI;MAC5B,IAAI,CAACH,MAAM,CAACI,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI;MAChC,IAAI,CAACH,MAAM,CAACI,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI;MAChC,IAAI,CAACH,MAAM,CAACI,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI;IAClC,CAAC,CACF;;IAED;IACAd,MAAM,CACHkB,MAAM,CAAClB,MAAM,CAACW,MAAM,CAACC,KAAK,GAAGR,IAAI,EAAEJ,MAAM,CAACW,MAAM,CAACE,MAAM,GAAGT,IAAI,CAAC,CAC/DG,IAAI,CAACA,IAAI,CAAC;;IAEb;IACA,IAAI,CAACY,SAAS,CAACnB,MAAM,EAAEK,CAAC,EAAEC,CAAC,CAAC;IAC5B,IAAI,CAACa,SAAS,CAACX,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IAE1B,IAAI,IAAAY,oBAAa,EAAClB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACmB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js b/project starter code/node_modules/@jimp/plugin-shadow/es/index.js
index 038b3ee1..3fc0485f 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-shadow/es/index.js
@@ -1,11 +1,4 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern } from "@jimp/utils";
/**
* Creates a circle out of an image.
@@ -18,59 +11,49 @@ var _utils = require("@jimp/utils");
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
-var _default = function _default() {
- return {
- shadow: function shadow() {
- var _this = this;
-
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var cb = arguments.length > 1 ? arguments[1] : undefined;
-
- if (typeof options === 'function') {
- cb = options;
- options = {};
- }
-
- var _options = options,
- _options$opacity = _options.opacity,
- opacity = _options$opacity === void 0 ? 0.7 : _options$opacity,
- _options$size = _options.size,
- size = _options$size === void 0 ? 1.1 : _options$size,
- _options$x = _options.x,
- x = _options$x === void 0 ? -25 : _options$x,
- _options$y = _options.y,
- y = _options$y === void 0 ? 25 : _options$y,
- _options$blur = _options.blur,
- blur = _options$blur === void 0 ? 5 : _options$blur; // clone the image
-
- var orig = this.clone();
- var shadow = this.clone(); // turn all it's pixels black
-
- shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, function (x, y, idx) {
- shadow.bitmap.data[idx] = 0x00;
- shadow.bitmap.data[idx + 1] = 0x00;
- shadow.bitmap.data[idx + 2] = 0x00; // up the opacity a little,
-
- shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity);
- _this.bitmap.data[idx] = 0x00;
- _this.bitmap.data[idx + 1] = 0x00;
- _this.bitmap.data[idx + 2] = 0x00;
- _this.bitmap.data[idx + 3] = 0x00;
- }); // enlarge it. This creates a "shadow".
-
- shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); // Then blit the "shadow" onto the background and the image on top of that.
-
- this.composite(shadow, x, y);
- this.composite(orig, 0, 0);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+export default (() => ({
+ shadow() {
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ let cb = arguments.length > 1 ? arguments[1] : undefined;
+ if (typeof options === "function") {
+ cb = options;
+ options = {};
}
- };
-};
-
-exports["default"] = _default;
+ const {
+ opacity = 0.7,
+ size = 1.1,
+ x = -25,
+ y = 25,
+ blur = 5
+ } = options;
+
+ // clone the image
+ const orig = this.clone();
+ const shadow = this.clone();
+
+ // turn all it's pixels black
+ shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, (x, y, idx) => {
+ shadow.bitmap.data[idx] = 0x00;
+ shadow.bitmap.data[idx + 1] = 0x00;
+ shadow.bitmap.data[idx + 2] = 0x00;
+ // up the opacity a little,
+ shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity);
+ this.bitmap.data[idx] = 0x00;
+ this.bitmap.data[idx + 1] = 0x00;
+ this.bitmap.data[idx + 2] = 0x00;
+ this.bitmap.data[idx + 3] = 0x00;
+ });
+
+ // enlarge it. This creates a "shadow".
+ shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur);
+
+ // Then blit the "shadow" onto the background and the image on top of that.
+ this.composite(shadow, x, y);
+ this.composite(orig, 0, 0);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map b/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map
index 7f483603..eefaa01c 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","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bd,MAAM,CAACgB,WAAP,CAAmBC,QAAnB,CAC5BjB,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAG,GAAG,CAAzB,IAA8BX,OADF,CAA9B;AAIA,QAAA,KAAI,CAACQ,MAAL,CAAYI,IAAZ,CAAiBD,GAAjB,IAAwB,IAAxB;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACD,OAlBH,EAbuB,CAkCvB;;AACAd,MAAAA,MAAM,CACHkB,MADH,CACUlB,MAAM,CAACW,MAAP,CAAcC,KAAd,GAAsBR,IADhC,EACsCJ,MAAM,CAACW,MAAP,CAAcE,MAAd,GAAuBT,IAD7D,EAEGG,IAFH,CAEQA,IAFR,EAnCuB,CAuCvB;;AACA,WAAKY,SAAL,CAAenB,MAAf,EAAuBK,CAAvB,EAA0BC,CAA1B;AACA,WAAKa,SAAL,CAAeX,IAAf,EAAqB,CAArB,EAAwB,CAAxB;;AAEA,UAAI,0BAAcN,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACkB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjDmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,MAAM,GAAmB;IAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;IAAA,IAAEC,EAAE;IACrB,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;MACjCC,EAAE,GAAGD,OAAO;MACZA,OAAO,GAAG,CAAC,CAAC;IACd;IAEA,MAAM;MAAEE,OAAO,GAAG,GAAG;MAAEC,IAAI,GAAG,GAAG;MAAEC,CAAC,GAAG,CAAC,EAAE;MAAEC,CAAC,GAAG,EAAE;MAAEC,IAAI,GAAG;IAAE,CAAC,GAAGN,OAAO;;IAExE;IACA,MAAMO,IAAI,GAAG,IAAI,CAACC,KAAK,EAAE;IACzB,MAAMT,MAAM,GAAG,IAAI,CAACS,KAAK,EAAE;;IAE3B;IACAT,MAAM,CAACU,IAAI,CACT,CAAC,EACD,CAAC,EACDV,MAAM,CAACW,MAAM,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I,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts b/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts
index 75f6bae0..4e3c4841 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts
@@ -1,15 +1,17 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Shadow {
- shadow(options?: {
- size?: number,
- opacity?: number,
- blur: number,
- x?: number,
- y?: number
- },
- cb?: ImageCallback): this;
+ shadow(
+ options?: {
+ size?: number;
+ opacity?: number;
+ blur: number;
+ x?: number;
+ y?: number;
+ },
+ cb?: ImageCallback
+ ): this;
shadow(cb?: ImageCallback): this;
}
-export default function(): Shadow;
+export default function (): Shadow;
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/package.json b/project starter code/node_modules/@jimp/plugin-shadow/package.json
index d384ab69..f1c0c592 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/package.json
+++ b/project starter code/node_modules/@jimp/plugin-shadow/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-shadow",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Creates a shadow on an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,8 +21,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -29,13 +29,13 @@
"@jimp/plugin-resize": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/plugin-blur": "^0.16.2",
- "@jimp/plugin-resize": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/plugin-blur": "^0.22.12",
+ "@jimp/plugin-resize": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/src/index.js b/project starter code/node_modules/@jimp/plugin-shadow/src/index.js
index be696b8c..81c23c41 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-shadow/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern } from '@jimp/utils';
+import { isNodePattern } from "@jimp/utils";
/**
* Creates a circle out of an image.
@@ -13,7 +13,7 @@ import { isNodePattern } from '@jimp/utils';
*/
export default () => ({
shadow(options = {}, cb) {
- if (typeof options === 'function') {
+ if (typeof options === "function") {
cb = options;
options = {};
}
@@ -60,5 +60,5 @@ export default () => ({
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js b/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js
index 6ef36184..2ee56166 100644
--- a/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js
+++ b/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js
@@ -1,31 +1,32 @@
-import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils';
-import configure from '@jimp/custom';
-import resize from '@jimp/plugin-resize';
-import blur from '@jimp/plugin-blur';
+import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import resize from "@jimp/plugin-resize";
+import blur from "@jimp/plugin-blur";
+import expect from "@storybook/expect";
-import shadow from '../src';
+import shadow from "../src";
const jimp = configure({ plugins: [shadow, resize, blur] }, Jimp);
-describe('Shadow', () => {
- it('creates a shadow', async () => {
+describe("Shadow", () => {
+ it("creates a shadow", async () => {
const expectedImg = await jimp.read(
- getTestDir(__dirname) + '/images/shadow.png'
+ getTestDir(__dirname) + "/images/shadow.png"
);
const testImage = await jimp.read(
mkJGD(
- ' ',
- ' ◆◆ ',
- ' ◆▦▦◆ ',
- ' ◆▦▦▦▦◆ ',
- ' ◆▦▦◆ ',
- ' ◆◆ ',
- ' '
+ " ",
+ " ◆◆ ",
+ " ◆▦▦◆ ",
+ " ◆▦▦▦▦◆ ",
+ " ◆▦▦◆ ",
+ " ◆◆ ",
+ " "
)
);
- testImage
- .shadow({ x: -1, y: 1, blur: 1 })
- .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
+ expect(testImage.shadow({ x: -1, y: 1, blur: 1 }).bitmap.data).toEqual(
+ expectedImg.bitmap.data
+ );
});
});
diff --git a/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md
index 7cd6c3ac..7e842d38 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md
@@ -1,3 +1,65 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -24,7 +86,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -32,4 +94,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugin-threshold/README.md b/project starter code/node_modules/@jimp/plugin-threshold/README.md
index 04cc3eb2..57271c3b 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/README.md
+++ b/project starter code/node_modules/@jimp/plugin-threshold/README.md
@@ -16,10 +16,10 @@ This is useful as a simplified method for processing scanned drawings, signature
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
```js
-import jimp from 'jimp';
+import jimp from "jimp";
async function main() {
- const image = await jimp.read('test/image.png');
+ const image = await jimp.read("test/image.png");
image.threshold({ max: 150 });
// or
diff --git a/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js b/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js
index 60a6d805..13e2603a 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js
+++ b/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js
@@ -1,38 +1,38 @@
-module.exports = api => {
+module.exports = (api) => {
api.cache(true);
return {
presets: [
[
- '@babel/env',
+ "@babel/env",
{
- useBuiltIns: 'usage'
- }
- ]
+ useBuiltIns: "usage",
+ },
+ ],
],
plugins: [
- '@babel/proposal-class-properties',
- '@babel/syntax-object-rest-spread',
- process.env.BABEL_ENV !== 'module' && 'add-module-exports',
+ "@babel/proposal-class-properties",
+ "@babel/syntax-object-rest-spread",
+ process.env.BABEL_ENV !== "module" && "add-module-exports",
[
- 'transform-inline-environment-variables',
- { include: ['BABEL_ENV', 'ENV'] }
- ]
+ "transform-inline-environment-variables",
+ { include: ["BABEL_ENV", "ENV"] },
+ ],
].filter(Boolean),
env: {
test: {
- plugins: ['istanbul']
+ plugins: ["istanbul"],
},
development: {
- plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter(
+ plugins: [process.env.ENV !== "browser" && "source-map-support"].filter(
Boolean
- )
+ ),
},
module: {
- presets: [['@babel/env', { modules: false }]]
- }
- }
+ presets: [["@babel/env", { modules: false }]],
+ },
+ },
};
};
diff --git a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js b/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js
index bf1d7ef0..91e7ff80 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js
@@ -3,10 +3,8 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _utils = require("@jimp/utils");
-
/**
* Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default
* @param {number} options object
@@ -16,52 +14,40 @@ var _utils = require("@jimp/utils");
* @param {number} cb (optional) a callback for when complete
* @return {this} this for chaining of methods
*/
-var _default = function _default() {
- return {
- threshold: function threshold(_ref, cb) {
- var _this = this;
-
- var max = _ref.max,
- _ref$replace = _ref.replace,
- replace = _ref$replace === void 0 ? 255 : _ref$replace,
- _ref$autoGreyscale = _ref.autoGreyscale,
- autoGreyscale = _ref$autoGreyscale === void 0 ? true : _ref$autoGreyscale;
-
- if (typeof max !== 'number') {
- return _utils.throwError.call(this, 'max must be a number', cb);
- }
-
- if (typeof replace !== 'number') {
- return _utils.throwError.call(this, 'replace must be a number', cb);
- }
-
- if (typeof autoGreyscale !== 'boolean') {
- return _utils.throwError.call(this, 'autoGreyscale must be a boolean', cb);
- }
-
- max = this.constructor.limit255(max);
- replace = this.constructor.limit255(replace);
-
- if (autoGreyscale) {
- this.greyscale();
- }
-
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var grey = _this.bitmap.data[idx] < max ? _this.bitmap.data[idx] : replace;
- _this.bitmap.data[idx] = grey;
- _this.bitmap.data[idx + 1] = grey;
- _this.bitmap.data[idx + 2] = grey;
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+var _default = () => ({
+ threshold(_ref, cb) {
+ let {
+ max,
+ replace = 255,
+ autoGreyscale = true
+ } = _ref;
+ if (typeof max !== "number") {
+ return _utils.throwError.call(this, "max must be a number", cb);
}
- };
-};
-
-exports["default"] = _default;
+ if (typeof replace !== "number") {
+ return _utils.throwError.call(this, "replace must be a number", cb);
+ }
+ if (typeof autoGreyscale !== "boolean") {
+ return _utils.throwError.call(this, "autoGreyscale must be a boolean", cb);
+ }
+ max = this.constructor.limit255(max);
+ replace = this.constructor.limit255(replace);
+ if (autoGreyscale) {
+ this.greyscale();
+ }
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {
+ const grey = this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;
+ this.bitmap.data[idx] = grey;
+ this.bitmap.data[idx + 1] = grey;
+ this.bitmap.data[idx + 2] = grey;
+ });
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map
index 7b0f4ece..45c0a7c7 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["threshold","cb","max","replace","autoGreyscale","throwError","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx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L,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBC,IAAxB;AACA,QAAA,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BC,IAA5B;AACA,QAAA,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BC,IAA5B;AACD,OAPD;;AASA,UAAI,0BAAchB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACK,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAnCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== 'number') {\n return throwError.call(this, 'max must be a number', cb);\n }\n\n if (typeof replace !== 'number') {\n return throwError.call(this, 'replace must be a number', cb);\n }\n\n if (typeof autoGreyscale !== 'boolean') {\n return throwError.call(this, 'autoGreyscale must be a boolean', cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["threshold","cb","max","replace","autoGreyscale","throwError","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx","grey","data","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== \"number\") {\n return throwError.call(this, \"max must be a number\", cb);\n }\n\n if (typeof replace !== \"number\") {\n return throwError.call(this, \"replace must be a number\", cb);\n }\n\n if (typeof autoGreyscale !== \"boolean\") {\n return throwError.call(this, \"autoGreyscale must be a boolean\", cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,eASe,OAAO;EACpBA,SAAS,OAA+CC,EAAE,EAAE;IAAA,IAAlD;MAAEC,GAAG;MAAEC,OAAO,GAAG,GAAG;MAAEC,aAAa,GAAG;IAAK,CAAC;IACpD,IAAI,OAAOF,GAAG,KAAK,QAAQ,EAAE;MAC3B,OAAOG,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,sBAAsB,EAAEL,EAAE,CAAC;IAC1D;IAEA,IAAI,OAAOE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imp/plugin-threshold/es/index.js b/project starter code/node_modules/@jimp/plugin-threshold/es/index.js
index dea3677f..ee264b5f 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js
+++ b/project starter code/node_modules/@jimp/plugin-threshold/es/index.js
@@ -1,11 +1,4 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _utils = require("@jimp/utils");
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default
@@ -16,51 +9,37 @@ var _utils = require("@jimp/utils");
* @param {number} cb (optional) a callback for when complete
* @return {this} this for chaining of methods
*/
-var _default = function _default() {
- return {
- threshold: function threshold(_ref, cb) {
- var _this = this;
-
- var max = _ref.max,
- _ref$replace = _ref.replace,
- replace = _ref$replace === void 0 ? 255 : _ref$replace,
- _ref$autoGreyscale = _ref.autoGreyscale,
- autoGreyscale = _ref$autoGreyscale === void 0 ? true : _ref$autoGreyscale;
-
- if (typeof max !== 'number') {
- return _utils.throwError.call(this, 'max must be a number', cb);
- }
-
- if (typeof replace !== 'number') {
- return _utils.throwError.call(this, 'replace must be a number', cb);
- }
-
- if (typeof autoGreyscale !== 'boolean') {
- return _utils.throwError.call(this, 'autoGreyscale must be a boolean', cb);
- }
-
- max = this.constructor.limit255(max);
- replace = this.constructor.limit255(replace);
-
- if (autoGreyscale) {
- this.greyscale();
- }
-
- this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
- var grey = _this.bitmap.data[idx] < max ? _this.bitmap.data[idx] : replace;
- _this.bitmap.data[idx] = grey;
- _this.bitmap.data[idx + 1] = grey;
- _this.bitmap.data[idx + 2] = grey;
- });
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+export default (() => ({
+ threshold(_ref, cb) {
+ let {
+ max,
+ replace = 255,
+ autoGreyscale = true
+ } = _ref;
+ if (typeof max !== "number") {
+ return throwError.call(this, "max must be a number", cb);
}
- };
-};
-
-exports["default"] = _default;
+ if (typeof replace !== "number") {
+ return throwError.call(this, "replace must be a number", cb);
+ }
+ if (typeof autoGreyscale !== "boolean") {
+ return throwError.call(this, "autoGreyscale must be a boolean", cb);
+ }
+ max = this.constructor.limit255(max);
+ replace = this.constructor.limit255(replace);
+ if (autoGreyscale) {
+ this.greyscale();
+ }
+ this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {
+ const grey = this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;
+ this.bitmap.data[idx] = grey;
+ this.bitmap.data[idx + 1] = grey;
+ this.bitmap.data[idx + 2] = grey;
+ });
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map b/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map
index 7b0f4ece..a63e69bc 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["threshold","cb","max","replace","autoGreyscale","throwError","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx","grey","data"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,SADoB,2BACoCC,EADpC,EACwC;AAAA;;AAAA,UAAhDC,GAAgD,QAAhDA,GAAgD;AAAA,8BAA3CC,OAA2C;AAAA,UAA3CA,OAA2C,6BAAjC,GAAiC;AAAA,oCAA5BC,aAA4B;AAAA,UAA5BA,aAA4B,mCAAZ,IAAY;;AAC1D,UAAI,OAAOF,GAAP,KAAe,QAAnB,EAA6B;AAC3B,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,sBAAtB,EAA8CL,EAA9C,CAAP;AACD;;AAED,UAAI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attern, throwError } from '@jimp/utils';\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== 'number') {\n return throwError.call(this, 'max must be a number', cb);\n }\n\n if (typeof replace !== 'number') {\n return throwError.call(this, 'replace must be a number', cb);\n }\n\n if (typeof autoGreyscale !== 'boolean') {\n return throwError.call(this, 'autoGreyscale must be a boolean', cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","throwError","threshold","cb","max","replace","autoGreyscale","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx","grey","data"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== \"number\") {\n return throwError.call(this, \"max must be a number\", cb);\n }\n\n if (typeof replace !== \"number\") {\n return throwError.call(this, \"replace must be a number\", cb);\n }\n\n if (typeof autoGreyscale !== \"boolean\") {\n return throwError.call(this, \"autoGreyscale must be a boolean\", cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,SAAS,OAA+CC,EAAE,EAAE;IAAA,IAAlD;MAAEC,GAAG;MAAEC,OAAO,GAAG,GAAG;MAAEC,aAAa,GAAG;IAAK,CAAC;IACpD,IAAI,OAAOF,GAAG,KAAK,QAAQ,EAAE;MAC3B,OAAOH,UAAU,CAACM,IAAI,CAAC,IAAI,EAAE,sBAAsB,EAAEJ,EAAE,CAAC;IAC1D;IAEA,IAAI,OAAOE,OAAO,KAAK,QAAQ,EAAE;MAC/B,OAAOJ,UAAU,CAACM,IAAI,CAAC,IAAI,EAAE,0BAA0B,EAAEJ,EAAE,CAAC;IAC9D;IAEA,IAAI,OAAOG,aAAa,KAAK,SAAS,EAAE;MACtC,OAAOL,UAAU,CAACM,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEJ,EAAE,CAAC;IACrE;IAEAC,GAAG,GAAG,IAAI,CAACI,WAAW,CAACC,QAAQ,CAACL,GAAG,CAAC;IACpCC,OAAO,GAAG,IAAI,CAACG,WAAW,CAACC,QAAQ,CAACJ,OAAO,CAAC;IAE5C,IAAIC,aAAa,EAAE;MACjB,IAAI,CAACI,SAAS,EAAE;IAClB;IAEA,IAAI,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAACC,MAAM,CAACC,KAAK,EAAE,IAAI,CAACD,MAAM,CAACE,MAAM,EAAE,CAACC,CAAC,EAAEC,CAAC,EAAEC,GAAG,KAAK;MACzE,MAAMC,IAAI,GACR,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGb,GAAG,GAAG,IAAI,CAACQ,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGZ,OAAO;MAE/D,IAAI,CAACO,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGC,IAAI;MAC5B,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGC,IAAI;MAChC,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGC,IAAI;IAClC,CAAC,CAAC;IAEF,IAAIlB,aAAa,CAACG,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACI,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts b/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts
index 4b2a6cbe..96ad193f 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts
@@ -1,11 +1,14 @@
-import { ImageCallback } from '@jimp/core';
+import { ImageCallback } from "@jimp/core";
interface Threshold {
- threshold(opts: {
- max: number,
- replace?: number,
- autoGreyscale?: boolean
- }, cb?: ImageCallback): this;
+ threshold(
+ opts: {
+ max: number;
+ replace?: number;
+ autoGreyscale?: boolean;
+ },
+ cb?: ImageCallback
+ ): this;
}
-export default function(): Threshold;
+export default function (): Threshold;
diff --git a/project starter code/node_modules/@jimp/plugin-threshold/package.json b/project starter code/node_modules/@jimp/plugin-threshold/package.json
index 3578426d..e49ad877 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/package.json
+++ b/project starter code/node_modules/@jimp/plugin-threshold/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/plugin-threshold",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Lightens an image.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,8 +21,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2"
+ "@jimp/utils": "^0.22.12"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
@@ -29,14 +29,14 @@
"@jimp/plugin-resize": ">=0.8.0"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/jpeg": "^0.16.2",
- "@jimp/plugin-color": "^0.16.2",
- "@jimp/plugin-resize": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/jpeg": "^0.22.12",
+ "@jimp/plugin-color": "^0.22.12",
+ "@jimp/plugin-resize": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugin-threshold/src/index.js b/project starter code/node_modules/@jimp/plugin-threshold/src/index.js
index 583c8410..fad06bac 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/src/index.js
+++ b/project starter code/node_modules/@jimp/plugin-threshold/src/index.js
@@ -1,4 +1,4 @@
-import { isNodePattern, throwError } from '@jimp/utils';
+import { isNodePattern, throwError } from "@jimp/utils";
/**
* Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default
@@ -11,16 +11,16 @@ import { isNodePattern, throwError } from '@jimp/utils';
*/
export default () => ({
threshold({ max, replace = 255, autoGreyscale = true }, cb) {
- if (typeof max !== 'number') {
- return throwError.call(this, 'max must be a number', cb);
+ if (typeof max !== "number") {
+ return throwError.call(this, "max must be a number", cb);
}
- if (typeof replace !== 'number') {
- return throwError.call(this, 'replace must be a number', cb);
+ if (typeof replace !== "number") {
+ return throwError.call(this, "replace must be a number", cb);
}
- if (typeof autoGreyscale !== 'boolean') {
- return throwError.call(this, 'autoGreyscale must be a boolean', cb);
+ if (typeof autoGreyscale !== "boolean") {
+ return throwError.call(this, "autoGreyscale must be a boolean", cb);
}
max = this.constructor.limit255(max);
@@ -44,5 +44,5 @@ export default () => ({
}
return this;
- }
+ },
});
diff --git a/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js b/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js
index f1dbf809..709da3e1 100644
--- a/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js
+++ b/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js
@@ -1,30 +1,30 @@
-import { Jimp, getTestDir } from '@jimp/test-utils';
-import configure from '@jimp/custom';
-import jpeg from '@jimp/jpeg';
-import color from '@jimp/plugin-color';
-import resize from '@jimp/plugin-resize';
+import { Jimp, getTestDir } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import jpeg from "@jimp/jpeg";
+import color from "@jimp/plugin-color";
+import resize from "@jimp/plugin-resize";
+import expect from "@storybook/expect";
-import threshold from '../src';
+import threshold from "../src";
const jimp = configure(
{ types: [jpeg], plugins: [threshold, color, resize] },
Jimp
);
-describe('Threshold', function() {
+describe("Threshold", function () {
this.timeout(15000);
- it('defines default threshold for lighter backgrounds', async () => {
+ it("defines default threshold for lighter backgrounds", async () => {
const expectedImage = await jimp.read(
- getTestDir(__dirname) + '/images/hands_mx200_rp255.jpg'
+ getTestDir(__dirname) + "/images/hands_mx200_rp255.jpg"
);
const testImage = await jimp.read(
- getTestDir(__dirname) + '/images/hands.jpg'
+ getTestDir(__dirname) + "/images/hands.jpg"
);
- testImage
- .threshold({ max: 200, replace: 255 })
- .hash()
- .should.be.equal(expectedImage.hash());
+ expect(testImage.threshold({ max: 200, replace: 255 }).hash()).toBe(
+ expectedImage.hash()
+ );
});
});
diff --git a/project starter code/node_modules/@jimp/plugins/CHANGELOG.md b/project starter code/node_modules/@jimp/plugins/CHANGELOG.md
index 09abcd9e..2bc31ab4 100644
--- a/project starter code/node_modules/@jimp/plugins/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/plugins/CHANGELOG.md
@@ -1,3 +1,51 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -36,7 +84,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -44,4 +92,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/plugins/dist/index.js b/project starter code/node_modules/@jimp/plugins/dist/index.js
index 9c98b5a4..322f9cd2 100644
--- a/project starter code/node_modules/@jimp/plugins/dist/index.js
+++ b/project starter code/node_modules/@jimp/plugins/dist/index.js
@@ -1,76 +1,47 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
-
+exports.default = void 0;
var _timm = require("timm");
-
var _pluginBlit = _interopRequireDefault(require("@jimp/plugin-blit"));
-
var _pluginBlur = _interopRequireDefault(require("@jimp/plugin-blur"));
-
var _pluginCircle = _interopRequireDefault(require("@jimp/plugin-circle"));
-
var _pluginColor = _interopRequireDefault(require("@jimp/plugin-color"));
-
var _pluginContain = _interopRequireDefault(require("@jimp/plugin-contain"));
-
var _pluginCover = _interopRequireDefault(require("@jimp/plugin-cover"));
-
var _pluginCrop = _interopRequireDefault(require("@jimp/plugin-crop"));
-
var _pluginDisplace = _interopRequireDefault(require("@jimp/plugin-displace"));
-
var _pluginDither = _interopRequireDefault(require("@jimp/plugin-dither"));
-
var _pluginFisheye = _interopRequireDefault(require("@jimp/plugin-fisheye"));
-
var _pluginFlip = _interopRequireDefault(require("@jimp/plugin-flip"));
-
var _pluginGaussian = _interopRequireDefault(require("@jimp/plugin-gaussian"));
-
var _pluginInvert = _interopRequireDefault(require("@jimp/plugin-invert"));
-
var _pluginMask = _interopRequireDefault(require("@jimp/plugin-mask"));
-
var _pluginNormalize = _interopRequireDefault(require("@jimp/plugin-normalize"));
-
var _pluginPrint = _interopRequireDefault(require("@jimp/plugin-print"));
-
var _pluginResize = _interopRequireDefault(require("@jimp/plugin-resize"));
-
var _pluginRotate = _interopRequireDefault(require("@jimp/plugin-rotate"));
-
var _pluginScale = _interopRequireDefault(require("@jimp/plugin-scale"));
-
var _pluginShadow = _interopRequireDefault(require("@jimp/plugin-shadow"));
-
var _pluginThreshold = _interopRequireDefault(require("@jimp/plugin-threshold"));
-
-var plugins = [_pluginBlit["default"], _pluginBlur["default"], _pluginCircle["default"], _pluginColor["default"], _pluginContain["default"], _pluginCover["default"], _pluginCrop["default"], _pluginDisplace["default"], _pluginDither["default"], _pluginFisheye["default"], _pluginFlip["default"], _pluginGaussian["default"], _pluginInvert["default"], _pluginMask["default"], _pluginNormalize["default"], _pluginPrint["default"], _pluginResize["default"], _pluginRotate["default"], _pluginScale["default"], _pluginShadow["default"], _pluginThreshold["default"]];
-
-var _default = function _default(jimpEvChange) {
- var initializedPlugins = plugins.map(function (pluginModule) {
- var plugin = pluginModule(jimpEvChange) || {};
-
- if (!plugin["class"] && !plugin.constants) {
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+const plugins = [_pluginBlit.default, _pluginBlur.default, _pluginCircle.default, _pluginColor.default, _pluginContain.default, _pluginCover.default, _pluginCrop.default, _pluginDisplace.default, _pluginDither.default, _pluginFisheye.default, _pluginFlip.default, _pluginGaussian.default, _pluginInvert.default, _pluginMask.default, _pluginNormalize.default, _pluginPrint.default, _pluginResize.default, _pluginRotate.default, _pluginScale.default, _pluginShadow.default, _pluginThreshold.default];
+var _default = jimpEvChange => {
+ const initializedPlugins = plugins.map(pluginModule => {
+ let plugin = pluginModule(jimpEvChange) || {};
+ if (!plugin.class && !plugin.constants) {
// Default to class function
plugin = {
- "class": plugin
+ class: plugin
};
}
-
return plugin;
});
- return _timm.mergeDeep.apply(void 0, (0, _toConsumableArray2["default"])(initializedPlugins));
+ return (0, _timm.mergeDeep)(...initializedPlugins);
};
-
-exports["default"] = _default;
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugins/dist/index.js.map b/project starter code/node_modules/@jimp/plugins/dist/index.js.map
index 29e45149..c884c062 100644
--- a/project starter code/node_modules/@jimp/plugins/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/plugins/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["plugins","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","jimpEvChange","initializedPlugins","map","pluginModule","plugin","constants","mergeDeep"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,OAAO,GAAG,CACdC,sBADc,EAEdC,sBAFc,EAGdC,wBAHc,EAIdC,uBAJc,EAKdC,yBALc,EAMdC,uBANc,EAOdC,sBAPc,EAQdC,0BARc,EASdC,wBATc,EAUdC,yBAVc,EAWdC,sBAXc,EAYdC,0BAZc,EAadC,wBAbc,EAcdC,sBAdc,EAedC,2BAfc,EAgBdC,uBAhBc,EAiBdC,wBAjBc,EAkBdC,wBAlBc,EAmBdC,uBAnBc,EAoBdC,wBApBc,EAqBdC,2BArBc,CAAhB;;eAwBe,kBAAAC,YAAY,EAAI;AAC7B,MAAMC,kBAAkB,GAAGvB,OAAO,CAACwB,GAAR,CAAY,UAAAC,YAAY,EAAI;AACrD,QAAIC,MAAM,GAAGD,YAAY,CAACH,YAAD,CAAZ,IAA8B,EAA3C;;AAEA,QAAI,CAACI,MAAM,SAAP,IAAiB,CAACA,MAAM,CAACC,SAA7B,EAAwC;AACtC;AACAD,MAAAA,MAAM,GAAG;AAAE,iBAAOA;AAAT,OAAT;AACD;;AAED,WAAOA,MAAP;AACD,GAT0B,CAA3B;AAWA,SAAOE,kEAAaL,kBAAb,EAAP;AACD,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport blit from '@jimp/plugin-blit';\nimport blur from '@jimp/plugin-blur';\nimport circle from '@jimp/plugin-circle';\nimport color from '@jimp/plugin-color';\nimport contain from '@jimp/plugin-contain';\nimport cover from '@jimp/plugin-cover';\nimport crop from '@jimp/plugin-crop';\nimport displace from '@jimp/plugin-displace';\nimport dither from '@jimp/plugin-dither';\nimport fisheye from '@jimp/plugin-fisheye';\nimport flip from '@jimp/plugin-flip';\nimport gaussian from '@jimp/plugin-gaussian';\nimport invert from '@jimp/plugin-invert';\nimport mask from '@jimp/plugin-mask';\nimport normalize from '@jimp/plugin-normalize';\nimport print from '@jimp/plugin-print';\nimport resize from '@jimp/plugin-resize';\nimport rotate from '@jimp/plugin-rotate';\nimport scale from '@jimp/plugin-scale';\nimport shadow from '@jimp/plugin-shadow';\nimport threshold from '@jimp/plugin-threshold';\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold\n];\n\nexport default jimpEvChange => {\n const initializedPlugins = plugins.map(pluginModule => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["plugins","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","jimpEvChange","initializedPlugins","map","pluginModule","plugin","class","constants","mergeDeep"],"sources":["../src/index.js"],"sourcesContent":["import { mergeDeep } from \"timm\";\n\nimport blit from \"@jimp/plugin-blit\";\nimport blur from \"@jimp/plugin-blur\";\nimport circle from \"@jimp/plugin-circle\";\nimport color from \"@jimp/plugin-color\";\nimport contain from \"@jimp/plugin-contain\";\nimport cover from \"@jimp/plugin-cover\";\nimport crop from \"@jimp/plugin-crop\";\nimport displace from \"@jimp/plugin-displace\";\nimport dither from \"@jimp/plugin-dither\";\nimport fisheye from \"@jimp/plugin-fisheye\";\nimport flip from \"@jimp/plugin-flip\";\nimport gaussian from \"@jimp/plugin-gaussian\";\nimport invert from \"@jimp/plugin-invert\";\nimport mask from \"@jimp/plugin-mask\";\nimport normalize from \"@jimp/plugin-normalize\";\nimport print from \"@jimp/plugin-print\";\nimport resize from \"@jimp/plugin-resize\";\nimport rotate from \"@jimp/plugin-rotate\";\nimport scale from \"@jimp/plugin-scale\";\nimport shadow from \"@jimp/plugin-shadow\";\nimport threshold from \"@jimp/plugin-threshold\";\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold,\n];\n\nexport default (jimpEvChange) => {\n const initializedPlugins = plugins.map((pluginModule) => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAA+C;AAE/C,MAAMA,OAAO,GAAG,CACdC,mBAAI,EACJC,mBAAI,EACJC,qBAAM,EACNC,oBAAK,EACLC,sBAAO,EACPC,oBAAK,EACLC,mBAAI,EACJC,uBAAQ,EACRC,qBAAM,EACNC,sBAAO,EACPC,mBAAI,EACJC,uBAAQ,EACRC,qBAAM,EACNC,mBAAI,EACJC,wBAAS,EACTC,oBAAK,EACLC,qBAAM,EACNC,qBAAM,EACNC,oBAAK,EACLC,qBAAM,EACNC,wBAAS,CACV;AAAC,eAEcC,YAAY,IAAK;EAC/B,MAAMC,kBAAkB,GAAGvB,OAAO,CAACwB,GAAG,CAAEC,YAAY,IAAK;IACvD,IAAIC,MAAM,GAAGD,YAAY,CAACH,YAAY,CAAC,IAAI,CAAC,CAAC;IAE7C,IAAI,CAACI,MAAM,CAACC,KAAK,IAAI,CAACD,MAAM,CAACE,SAAS,EAAE;MACtC;MACAF,MAAM,GAAG;QAAEC,KAAK,EAAED;MAAO,CAAC;IAC5B;IAEA,OAAOA,MAAM;EACf,CAAC,CAAC;EAEF,OAAO,IAAAG,eAAS,EAAC,GAAGN,kBAAkB,CAAC;AACzC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugins/es/index.js b/project starter code/node_modules/@jimp/plugins/es/index.js
index fa3c22c9..22a58977 100644
--- a/project starter code/node_modules/@jimp/plugins/es/index.js
+++ b/project starter code/node_modules/@jimp/plugins/es/index.js
@@ -1,75 +1,37 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
-
-var _timm = require("timm");
-
-var _pluginBlit = _interopRequireDefault(require("@jimp/plugin-blit"));
-
-var _pluginBlur = _interopRequireDefault(require("@jimp/plugin-blur"));
-
-var _pluginCircle = _interopRequireDefault(require("@jimp/plugin-circle"));
-
-var _pluginColor = _interopRequireDefault(require("@jimp/plugin-color"));
-
-var _pluginContain = _interopRequireDefault(require("@jimp/plugin-contain"));
-
-var _pluginCover = _interopRequireDefault(require("@jimp/plugin-cover"));
-
-var _pluginCrop = _interopRequireDefault(require("@jimp/plugin-crop"));
-
-var _pluginDisplace = _interopRequireDefault(require("@jimp/plugin-displace"));
-
-var _pluginDither = _interopRequireDefault(require("@jimp/plugin-dither"));
-
-var _pluginFisheye = _interopRequireDefault(require("@jimp/plugin-fisheye"));
-
-var _pluginFlip = _interopRequireDefault(require("@jimp/plugin-flip"));
-
-var _pluginGaussian = _interopRequireDefault(require("@jimp/plugin-gaussian"));
-
-var _pluginInvert = _interopRequireDefault(require("@jimp/plugin-invert"));
-
-var _pluginMask = _interopRequireDefault(require("@jimp/plugin-mask"));
-
-var _pluginNormalize = _interopRequireDefault(require("@jimp/plugin-normalize"));
-
-var _pluginPrint = _interopRequireDefault(require("@jimp/plugin-print"));
-
-var _pluginResize = _interopRequireDefault(require("@jimp/plugin-resize"));
-
-var _pluginRotate = _interopRequireDefault(require("@jimp/plugin-rotate"));
-
-var _pluginScale = _interopRequireDefault(require("@jimp/plugin-scale"));
-
-var _pluginShadow = _interopRequireDefault(require("@jimp/plugin-shadow"));
-
-var _pluginThreshold = _interopRequireDefault(require("@jimp/plugin-threshold"));
-
-var plugins = [_pluginBlit["default"], _pluginBlur["default"], _pluginCircle["default"], _pluginColor["default"], _pluginContain["default"], _pluginCover["default"], _pluginCrop["default"], _pluginDisplace["default"], _pluginDither["default"], _pluginFisheye["default"], _pluginFlip["default"], _pluginGaussian["default"], _pluginInvert["default"], _pluginMask["default"], _pluginNormalize["default"], _pluginPrint["default"], _pluginResize["default"], _pluginRotate["default"], _pluginScale["default"], _pluginShadow["default"], _pluginThreshold["default"]];
-
-var _default = function _default(jimpEvChange) {
- var initializedPlugins = plugins.map(function (pluginModule) {
- var plugin = pluginModule(jimpEvChange) || {};
-
- if (!plugin["class"] && !plugin.constants) {
+import { mergeDeep } from "timm";
+import blit from "@jimp/plugin-blit";
+import blur from "@jimp/plugin-blur";
+import circle from "@jimp/plugin-circle";
+import color from "@jimp/plugin-color";
+import contain from "@jimp/plugin-contain";
+import cover from "@jimp/plugin-cover";
+import crop from "@jimp/plugin-crop";
+import displace from "@jimp/plugin-displace";
+import dither from "@jimp/plugin-dither";
+import fisheye from "@jimp/plugin-fisheye";
+import flip from "@jimp/plugin-flip";
+import gaussian from "@jimp/plugin-gaussian";
+import invert from "@jimp/plugin-invert";
+import mask from "@jimp/plugin-mask";
+import normalize from "@jimp/plugin-normalize";
+import print from "@jimp/plugin-print";
+import resize from "@jimp/plugin-resize";
+import rotate from "@jimp/plugin-rotate";
+import scale from "@jimp/plugin-scale";
+import shadow from "@jimp/plugin-shadow";
+import threshold from "@jimp/plugin-threshold";
+const plugins = [blit, blur, circle, color, contain, cover, crop, displace, dither, fisheye, flip, gaussian, invert, mask, normalize, print, resize, rotate, scale, shadow, threshold];
+export default (jimpEvChange => {
+ const initializedPlugins = plugins.map(pluginModule => {
+ let plugin = pluginModule(jimpEvChange) || {};
+ if (!plugin.class && !plugin.constants) {
// Default to class function
plugin = {
- "class": plugin
+ class: plugin
};
}
-
return plugin;
});
- return _timm.mergeDeep.apply(void 0, (0, _toConsumableArray2["default"])(initializedPlugins));
-};
-
-exports["default"] = _default;
+ return mergeDeep(...initializedPlugins);
+});
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/plugins/es/index.js.map b/project starter code/node_modules/@jimp/plugins/es/index.js.map
index 29e45149..fb2069cf 100644
--- a/project starter code/node_modules/@jimp/plugins/es/index.js.map
+++ b/project starter code/node_modules/@jimp/plugins/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["plugins","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","jimpEvChange","initializedPlugins","map","pluginModule","plugin","constants","mergeDeep"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,OAAO,GAAG,CACdC,sBADc,EAEdC,sBAFc,EAGdC,wBAHc,EAIdC,uBAJc,EAKdC,yBALc,EAMdC,uBANc,EAOdC,sBAPc,EAQdC,0BARc,EASdC,wBATc,EAUdC,yBAVc,EAWdC,sBAXc,EAYdC,0BAZc,EAadC,wBAbc,EAcdC,sBAdc,EAedC,2BAfc,EAgBdC,uBAhBc,EAiBdC,wBAjBc,EAkBdC,wBAlBc,EAmBdC,uBAnBc,EAoBdC,wBApBc,EAqBdC,2BArBc,CAAhB;;eAwBe,kBAAAC,YAAY,EAAI;AAC7B,MAAMC,kBAAkB,GAAGvB,OAAO,CAACwB,GAAR,CAAY,UAAAC,YAAY,EAAI;AACrD,QAAIC,MAAM,GAAGD,YAAY,CAACH,YAAD,CAAZ,IAA8B,EAA3C;;AAEA,QAAI,CAACI,MAAM,SAAP,IAAiB,CAACA,MAAM,CAACC,SAA7B,EAAwC;AACtC;AACAD,MAAAA,MAAM,GAAG;AAAE,iBAAOA;AAAT,OAAT;AACD;;AAED,WAAOA,MAAP;AACD,GAT0B,CAA3B;AAWA,SAAOE,kEAAaL,kBAAb,EAAP;AACD,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport blit from '@jimp/plugin-blit';\nimport blur from '@jimp/plugin-blur';\nimport circle from '@jimp/plugin-circle';\nimport color from '@jimp/plugin-color';\nimport contain from '@jimp/plugin-contain';\nimport cover from '@jimp/plugin-cover';\nimport crop from '@jimp/plugin-crop';\nimport displace from '@jimp/plugin-displace';\nimport dither from '@jimp/plugin-dither';\nimport fisheye from '@jimp/plugin-fisheye';\nimport flip from '@jimp/plugin-flip';\nimport gaussian from '@jimp/plugin-gaussian';\nimport invert from '@jimp/plugin-invert';\nimport mask from '@jimp/plugin-mask';\nimport normalize from '@jimp/plugin-normalize';\nimport print from '@jimp/plugin-print';\nimport resize from '@jimp/plugin-resize';\nimport rotate from '@jimp/plugin-rotate';\nimport scale from '@jimp/plugin-scale';\nimport shadow from '@jimp/plugin-shadow';\nimport threshold from '@jimp/plugin-threshold';\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold\n];\n\nexport default jimpEvChange => {\n const initializedPlugins = plugins.map(pluginModule => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["mergeDeep","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","plugins","jimpEvChange","initializedPlugins","map","pluginModule","plugin","class","constants"],"sources":["../src/index.js"],"sourcesContent":["import { mergeDeep } from \"timm\";\n\nimport blit from \"@jimp/plugin-blit\";\nimport blur from \"@jimp/plugin-blur\";\nimport circle from \"@jimp/plugin-circle\";\nimport color from \"@jimp/plugin-color\";\nimport contain from \"@jimp/plugin-contain\";\nimport cover from \"@jimp/plugin-cover\";\nimport crop from \"@jimp/plugin-crop\";\nimport displace from \"@jimp/plugin-displace\";\nimport dither from \"@jimp/plugin-dither\";\nimport fisheye from \"@jimp/plugin-fisheye\";\nimport flip from \"@jimp/plugin-flip\";\nimport gaussian from \"@jimp/plugin-gaussian\";\nimport invert from \"@jimp/plugin-invert\";\nimport mask from \"@jimp/plugin-mask\";\nimport normalize from \"@jimp/plugin-normalize\";\nimport print from \"@jimp/plugin-print\";\nimport resize from \"@jimp/plugin-resize\";\nimport rotate from \"@jimp/plugin-rotate\";\nimport scale from \"@jimp/plugin-scale\";\nimport shadow from \"@jimp/plugin-shadow\";\nimport threshold from \"@jimp/plugin-threshold\";\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold,\n];\n\nexport default (jimpEvChange) => {\n const initializedPlugins = plugins.map((pluginModule) => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,MAAM;AAEhC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,OAAO,MAAM,sBAAsB;AAC1C,OAAOC,KAAK,MAA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code/node_modules/@jimp/plugins/index.d.ts b/project starter code/node_modules/@jimp/plugins/index.d.ts
index 07e46e0d..0184bbcc 100644
--- a/project starter code/node_modules/@jimp/plugins/index.d.ts
+++ b/project starter code/node_modules/@jimp/plugins/index.d.ts
@@ -1,24 +1,24 @@
-import blit from '@jimp/plugin-blit';
-import blur from '@jimp/plugin-blur';
-import circle from '@jimp/plugin-circle';
-import color from '@jimp/plugin-color';
-import contain from '@jimp/plugin-contain';
-import cover from '@jimp/plugin-cover';
-import crop from '@jimp/plugin-crop';
-import displace from '@jimp/plugin-displace';
-import dither from '@jimp/plugin-dither';
-import fisheye from '@jimp/plugin-fisheye';
-import flip from '@jimp/plugin-flip';
-import gaussian from '@jimp/plugin-gaussian';
-import invert from '@jimp/plugin-invert';
-import mask from '@jimp/plugin-mask';
-import normalize from '@jimp/plugin-normalize';
-import print from '@jimp/plugin-print';
-import resize from '@jimp/plugin-resize';
-import rotate from '@jimp/plugin-rotate';
-import scale from '@jimp/plugin-scale';
-import shadow from '@jimp/plugin-shadow';
-import threshold from '@jimp/plugin-threshold';
+import blit from "@jimp/plugin-blit";
+import blur from "@jimp/plugin-blur";
+import circle from "@jimp/plugin-circle";
+import color from "@jimp/plugin-color";
+import contain from "@jimp/plugin-contain";
+import cover from "@jimp/plugin-cover";
+import crop from "@jimp/plugin-crop";
+import displace from "@jimp/plugin-displace";
+import dither from "@jimp/plugin-dither";
+import fisheye from "@jimp/plugin-fisheye";
+import flip from "@jimp/plugin-flip";
+import gaussian from "@jimp/plugin-gaussian";
+import invert from "@jimp/plugin-invert";
+import mask from "@jimp/plugin-mask";
+import normalize from "@jimp/plugin-normalize";
+import print from "@jimp/plugin-print";
+import resize from "@jimp/plugin-resize";
+import rotate from "@jimp/plugin-rotate";
+import scale from "@jimp/plugin-scale";
+import shadow from "@jimp/plugin-shadow";
+import threshold from "@jimp/plugin-threshold";
type BlitRet = ReturnType;
type BlurRet = ReturnType;
@@ -73,4 +73,4 @@ type Plugins =
| ShadowRet
| ThresholdRet;
-export default function(): Plugins;
+export default function (): Plugins;
diff --git a/project starter code/node_modules/@jimp/plugins/package.json b/project starter code/node_modules/@jimp/plugins/package.json
index 3f4fd145..35c37031 100644
--- a/project starter code/node_modules/@jimp/plugins/package.json
+++ b/project starter code/node_modules/@jimp/plugins/package.json
@@ -1,9 +1,10 @@
{
"name": "@jimp/plugins",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Default Jimp plugin.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
"build": "npm run build:node:production && npm run build:module",
@@ -17,28 +18,27 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/plugin-blit": "^0.16.2",
- "@jimp/plugin-blur": "^0.16.2",
- "@jimp/plugin-circle": "^0.16.2",
- "@jimp/plugin-color": "^0.16.2",
- "@jimp/plugin-contain": "^0.16.2",
- "@jimp/plugin-cover": "^0.16.2",
- "@jimp/plugin-crop": "^0.16.2",
- "@jimp/plugin-displace": "^0.16.2",
- "@jimp/plugin-dither": "^0.16.2",
- "@jimp/plugin-fisheye": "^0.16.2",
- "@jimp/plugin-flip": "^0.16.2",
- "@jimp/plugin-gaussian": "^0.16.2",
- "@jimp/plugin-invert": "^0.16.2",
- "@jimp/plugin-mask": "^0.16.2",
- "@jimp/plugin-normalize": "^0.16.2",
- "@jimp/plugin-print": "^0.16.2",
- "@jimp/plugin-resize": "^0.16.2",
- "@jimp/plugin-rotate": "^0.16.2",
- "@jimp/plugin-scale": "^0.16.2",
- "@jimp/plugin-shadow": "^0.16.2",
- "@jimp/plugin-threshold": "^0.16.2",
+ "@jimp/plugin-blit": "^0.22.12",
+ "@jimp/plugin-blur": "^0.22.12",
+ "@jimp/plugin-circle": "^0.22.12",
+ "@jimp/plugin-color": "^0.22.12",
+ "@jimp/plugin-contain": "^0.22.12",
+ "@jimp/plugin-cover": "^0.22.12",
+ "@jimp/plugin-crop": "^0.22.12",
+ "@jimp/plugin-displace": "^0.22.12",
+ "@jimp/plugin-dither": "^0.22.12",
+ "@jimp/plugin-fisheye": "^0.22.12",
+ "@jimp/plugin-flip": "^0.22.12",
+ "@jimp/plugin-gaussian": "^0.22.12",
+ "@jimp/plugin-invert": "^0.22.12",
+ "@jimp/plugin-mask": "^0.22.12",
+ "@jimp/plugin-normalize": "^0.22.12",
+ "@jimp/plugin-print": "^0.22.12",
+ "@jimp/plugin-resize": "^0.22.12",
+ "@jimp/plugin-rotate": "^0.22.12",
+ "@jimp/plugin-scale": "^0.22.12",
+ "@jimp/plugin-shadow": "^0.22.12",
+ "@jimp/plugin-threshold": "^0.22.12",
"timm": "^1.6.1"
},
"peerDependencies": {
@@ -47,5 +47,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/plugins/src/index.js b/project starter code/node_modules/@jimp/plugins/src/index.js
index 56cc2243..a31740cf 100644
--- a/project starter code/node_modules/@jimp/plugins/src/index.js
+++ b/project starter code/node_modules/@jimp/plugins/src/index.js
@@ -1,26 +1,26 @@
-import { mergeDeep } from 'timm';
+import { mergeDeep } from "timm";
-import blit from '@jimp/plugin-blit';
-import blur from '@jimp/plugin-blur';
-import circle from '@jimp/plugin-circle';
-import color from '@jimp/plugin-color';
-import contain from '@jimp/plugin-contain';
-import cover from '@jimp/plugin-cover';
-import crop from '@jimp/plugin-crop';
-import displace from '@jimp/plugin-displace';
-import dither from '@jimp/plugin-dither';
-import fisheye from '@jimp/plugin-fisheye';
-import flip from '@jimp/plugin-flip';
-import gaussian from '@jimp/plugin-gaussian';
-import invert from '@jimp/plugin-invert';
-import mask from '@jimp/plugin-mask';
-import normalize from '@jimp/plugin-normalize';
-import print from '@jimp/plugin-print';
-import resize from '@jimp/plugin-resize';
-import rotate from '@jimp/plugin-rotate';
-import scale from '@jimp/plugin-scale';
-import shadow from '@jimp/plugin-shadow';
-import threshold from '@jimp/plugin-threshold';
+import blit from "@jimp/plugin-blit";
+import blur from "@jimp/plugin-blur";
+import circle from "@jimp/plugin-circle";
+import color from "@jimp/plugin-color";
+import contain from "@jimp/plugin-contain";
+import cover from "@jimp/plugin-cover";
+import crop from "@jimp/plugin-crop";
+import displace from "@jimp/plugin-displace";
+import dither from "@jimp/plugin-dither";
+import fisheye from "@jimp/plugin-fisheye";
+import flip from "@jimp/plugin-flip";
+import gaussian from "@jimp/plugin-gaussian";
+import invert from "@jimp/plugin-invert";
+import mask from "@jimp/plugin-mask";
+import normalize from "@jimp/plugin-normalize";
+import print from "@jimp/plugin-print";
+import resize from "@jimp/plugin-resize";
+import rotate from "@jimp/plugin-rotate";
+import scale from "@jimp/plugin-scale";
+import shadow from "@jimp/plugin-shadow";
+import threshold from "@jimp/plugin-threshold";
const plugins = [
blit,
@@ -43,11 +43,11 @@ const plugins = [
rotate,
scale,
shadow,
- threshold
+ threshold,
];
-export default jimpEvChange => {
- const initializedPlugins = plugins.map(pluginModule => {
+export default (jimpEvChange) => {
+ const initializedPlugins = plugins.map((pluginModule) => {
let plugin = pluginModule(jimpEvChange) || {};
if (!plugin.class && !plugin.constants) {
diff --git a/project starter code/node_modules/@jimp/png/CHANGELOG.md b/project starter code/node_modules/@jimp/png/CHANGELOG.md
index 26394e0f..01459825 100644
--- a/project starter code/node_modules/@jimp/png/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/png/CHANGELOG.md
@@ -1,3 +1,90 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.18.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### switch from browserify to webpack ([#1140](https://github.com/jimp-dev/jimp/pull/1140))
+
+This PR can be considered a breaking change as it remove the `jimp.min.js` file.
+
+Instead there is now only the `jimp.js` file and we ship source maps for it.
+
+We also configured the `browser` field so jimp will be automatically bundled better
+
+---
+
+#### 💥 Breaking Change
+
+- switch from browserify to webpack [#1140](https://github.com/jimp-dev/jimp/pull/1140) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +99,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +107,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/png/dist/index.js b/project starter code/node_modules/@jimp/png/dist/index.js
index 3d5ffc60..db11eb1b 100644
--- a/project starter code/node_modules/@jimp/png/dist/index.js
+++ b/project starter code/node_modules/@jimp/png/dist/index.js
@@ -1,162 +1,139 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
+exports.default = void 0;
var _pngjs = require("pngjs");
-
var _utils = require("@jimp/utils");
-
-var MIME_TYPE = 'image/png'; // PNG filter types
-
-var PNG_FILTER_AUTO = -1;
-var PNG_FILTER_NONE = 0;
-var PNG_FILTER_SUB = 1;
-var PNG_FILTER_UP = 2;
-var PNG_FILTER_AVERAGE = 3;
-var PNG_FILTER_PATH = 4;
-
-var _default = function _default() {
- return {
- mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['png']),
- constants: {
- MIME_PNG: MIME_TYPE,
- PNG_FILTER_AUTO: PNG_FILTER_AUTO,
- PNG_FILTER_NONE: PNG_FILTER_NONE,
- PNG_FILTER_SUB: PNG_FILTER_SUB,
- PNG_FILTER_UP: PNG_FILTER_UP,
- PNG_FILTER_AVERAGE: PNG_FILTER_AVERAGE,
- PNG_FILTER_PATH: PNG_FILTER_PATH
- },
- hasAlpha: (0, _defineProperty2["default"])({}, MIME_TYPE, true),
- decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _pngjs.PNG.sync.read),
- encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) {
- var png = new _pngjs.PNG({
+const MIME_TYPE = "image/png";
+
+// PNG filter types
+const PNG_FILTER_AUTO = -1;
+const PNG_FILTER_NONE = 0;
+const PNG_FILTER_SUB = 1;
+const PNG_FILTER_UP = 2;
+const PNG_FILTER_AVERAGE = 3;
+const PNG_FILTER_PATH = 4;
+var _default = () => ({
+ mime: {
+ [MIME_TYPE]: ["png"]
+ },
+ constants: {
+ MIME_PNG: MIME_TYPE,
+ PNG_FILTER_AUTO,
+ PNG_FILTER_NONE,
+ PNG_FILTER_SUB,
+ PNG_FILTER_UP,
+ PNG_FILTER_AVERAGE,
+ PNG_FILTER_PATH
+ },
+ hasAlpha: {
+ [MIME_TYPE]: true
+ },
+ decoders: {
+ [MIME_TYPE]: _pngjs.PNG.sync.read
+ },
+ encoders: {
+ [MIME_TYPE](data) {
+ const png = new _pngjs.PNG({
width: data.bitmap.width,
height: data.bitmap.height
});
png.data = data.bitmap.data;
return _pngjs.PNG.sync.write(png, {
- width: data.bitmap.width,
- height: data.bitmap.height,
deflateLevel: data._deflateLevel,
deflateStrategy: data._deflateStrategy,
filterType: data._filterType,
- colorType: typeof data._colorType === 'number' ? data._colorType : data._rgba ? 6 : 2,
+ colorType: typeof data._colorType === "number" ? data._colorType : data._rgba ? 6 : 2,
inputHasAlpha: data._rgba
});
- }),
- "class": {
- _deflateLevel: 9,
- _deflateStrategy: 3,
- _filterType: PNG_FILTER_AUTO,
- _colorType: null,
-
- /**
- * Sets the deflate level used when saving as PNG format (default is 9)
- * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- deflateLevel: function deflateLevel(l, cb) {
- if (typeof l !== 'number') {
- return _utils.throwError.call(this, 'l must be a number', cb);
- }
-
- if (l < 0 || l > 9) {
- return _utils.throwError.call(this, 'l must be a number 0 - 9', cb);
- }
-
- this._deflateLevel = Math.round(l);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Sets the deflate strategy used when saving as PNG format (default is 3)
- * @param {number} s Deflate strategy to use 0-3.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- deflateStrategy: function deflateStrategy(s, cb) {
- if (typeof s !== 'number') {
- return _utils.throwError.call(this, 's must be a number', cb);
- }
-
- if (s < 0 || s > 3) {
- return _utils.throwError.call(this, 's must be a number 0 - 3', cb);
- }
-
- this._deflateStrategy = Math.round(s);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Sets the filter type used when saving as PNG format (default is automatic filters)
- * @param {number} f The quality to use -1-4.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- filterType: function filterType(f, cb) {
- if (typeof f !== 'number') {
- return _utils.throwError.call(this, 'n must be a number', cb);
- }
-
- if (f < -1 || f > 4) {
- return _utils.throwError.call(this, 'n must be -1 (auto) or a number 0 - 4', cb);
- }
-
- this._filterType = Math.round(f);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Sets the color type used when saving as PNG format
- * @param {number} s color type to use 0, 2, 4, 6.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- colorType: function colorType(s, cb) {
- if (typeof s !== 'number') {
- return _utils.throwError.call(this, 's must be a number', cb);
- }
-
- if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {
- return _utils.throwError.call(this, 's must be a number 0, 2, 4, 6.', cb);
- }
-
- this._colorType = Math.round(s);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+ }
+ },
+ class: {
+ _deflateLevel: 9,
+ _deflateStrategy: 3,
+ _filterType: PNG_FILTER_AUTO,
+ _colorType: null,
+ /**
+ * Sets the deflate level used when saving as PNG format (default is 9)
+ * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ deflateLevel(l, cb) {
+ if (typeof l !== "number") {
+ return _utils.throwError.call(this, "l must be a number", cb);
+ }
+ if (l < 0 || l > 9) {
+ return _utils.throwError.call(this, "l must be a number 0 - 9", cb);
+ }
+ this._deflateLevel = Math.round(l);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Sets the deflate strategy used when saving as PNG format (default is 3)
+ * @param {number} s Deflate strategy to use 0-3.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ deflateStrategy(s, cb) {
+ if (typeof s !== "number") {
+ return _utils.throwError.call(this, "s must be a number", cb);
+ }
+ if (s < 0 || s > 3) {
+ return _utils.throwError.call(this, "s must be a number 0 - 3", cb);
}
+ this._deflateStrategy = Math.round(s);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Sets the filter type used when saving as PNG format (default is automatic filters)
+ * @param {number} f The quality to use -1-4.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ filterType(f, cb) {
+ if (typeof f !== "number") {
+ return _utils.throwError.call(this, "n must be a number", cb);
+ }
+ if (f < -1 || f > 4) {
+ return _utils.throwError.call(this, "n must be -1 (auto) or a number 0 - 4", cb);
+ }
+ this._filterType = Math.round(f);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Sets the color type used when saving as PNG format
+ * @param {number} s color type to use 0, 2, 4, 6.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ colorType(s, cb) {
+ if (typeof s !== "number") {
+ return _utils.throwError.call(this, "s must be a number", cb);
+ }
+ if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {
+ return _utils.throwError.call(this, "s must be a number 0, 2, 4, 6.", cb);
+ }
+ this._colorType = Math.round(s);
+ if ((0, _utils.isNodePattern)(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
}
- };
-};
-
-exports["default"] = _default;
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/png/dist/index.js.map b/project starter code/node_modules/@jimp/png/dist/index.js.map
index e5a9771f..52b0f7a3 100644
--- a/project starter code/node_modules/@jimp/png/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/png/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","PNG","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","l","cb","throwError","call","Math","round","s","f"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB,C,CAEA;;AACA,IAAMC,eAAe,GAAG,CAAC,CAAzB;AACA,IAAMC,eAAe,GAAG,CAAxB;AACA,IAAMC,cAAc,GAAG,CAAvB;AACA,IAAMC,aAAa,GAAG,CAAtB;AACA,IAAMC,kBAAkB,GAAG,CAA3B;AACA,IAAMC,eAAe,GAAG,CAAxB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKP,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBQ,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAET,SADD;AAETC,MAAAA,eAAe,EAAfA,eAFS;AAGTC,MAAAA,eAAe,EAAfA,eAHS;AAITC,MAAAA,cAAc,EAAdA,cAJS;AAKTC,MAAAA,aAAa,EAAbA,aALS;AAMTC,MAAAA,kBAAkB,EAAlBA,kBANS;AAOTC,MAAAA,eAAe,EAAfA;AAPS,KAHS;AAapBI,IAAAA,QAAQ,uCAAKV,SAAL,EAAiB,IAAjB,CAbY;AAcpBW,IAAAA,QAAQ,uCAAKX,SAAL,EAAiBY,WAAIC,IAAJ,CAASC,IAA1B,CAdY;AAepBC,IAAAA,QAAQ,uCACLf,SADK,EACO,UAAAgB,IAAI,EAAI;AACnB,UAAMC,GAAG,GAAG,IAAIL,UAAJ,CAAQ;AAClBM,QAAAA,KAAK,EAAEF,IAAI,CAACG,MAAL,CAAYD,KADD;AAElBE,QAAAA,MAAM,EAAEJ,IAAI,CAACG,MAAL,CAAYC;AAFF,OAAR,CAAZ;AAKAH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;;;;;AAKIP,MAAAA,SAtFC,qBAsFSU,CAtFT,EAsFYL,EAtFZ,EAsFgB;AACnB,YAAI,OAAOK,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOJ,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAIK,CAAC,KAAK,CAAN,IAAWA,CAAC,KAAK,CAAjB,IAAsBA,CAAC,KAAK,CAA5B,IAAiCA,CAAC,KAAK,CAA3C,EAA8C;AAC5C,iBAAOJ,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,gCAAtB,EAAwDF,EAAxD,CAAP;AACD;;AAED,aAAKJ,UAAL,GAAkBO,IAAI,CAACC,KAAL,CAAWC,CAAX,CAAlB;;AAEA,YAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtGI;AAzCa,GAAP;AAAA,C","sourcesContent":["import { PNG } from 'pngjs';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/png';\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['png'] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE]: data => {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n width: data.bitmap.width,\n height: data.bitmap.height,\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === 'number'\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba\n });\n }\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== 'number') {\n return throwError.call(this, 'l must be a number', cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, 'l must be a number 0 - 9', cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, 's must be a number 0 - 3', cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n 'n must be -1 (auto) or a number 0 - 4',\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, 's must be a number 0, 2, 4, 6.', cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","PNG","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","class","l","cb","throwError","call","Math","round","isNodePattern","s","f"],"sources":["../src/index.js"],"sourcesContent":["import { PNG } from \"pngjs\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/png\";\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"png\"] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH,\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE](data) {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height,\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === \"number\"\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba,\n });\n },\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== \"number\") {\n return throwError.call(this, \"l must be a number\", cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, \"l must be a number 0 - 9\", cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, \"s must be a number 0 - 3\", cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n \"n must be -1 (auto) or a number 0 - 4\",\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, \"s must be a number 0, 2, 4, 6.\", cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAEA,MAAMA,SAAS,GAAG,WAAW;;AAE7B;AACA,MAAMC,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAMC,eAAe,GAAG,CAAC;AACzB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,eAAe,GAAG,CAAC;AAAC,eAEX,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACP,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BQ,SAAS,EAAE;IACTC,QAAQ,EAAET,SAAS;IACnBC,eAAe;IACfC,eAAe;IACfC,cAAc;IACdC,aAAa;IACbC,kBAAkB;IAClBC;EACF,CAAC;EAEDI,QAAQ,EAAE;IAAE,CAACV,SAAS,GAAG;EAAK,CAAC;EAC/BW,QAAQ,EAAE;IAAE,CAACX,SAAS,GAAGY,UAAG,CAACC,IAAI,CAACC;EAAK,CAAC;EACxCC,QAAQ,EAAE;IACR,CAACf,SAAS,EAAEgB,IAAI,EA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;AACA;AACA;AACA;AACA;IAAQR,SAAS,CAACY,CAAC,EAAEN,EAAE,EAAE;MACnB,IAAI,OAAOM,CAAC,KAAK,QAAQ,EAAE;QACzB,OAAOL,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAEF,EAAE,CAAC;MACxD;MAEA,IAAIM,CAAC,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,EAAE;QAC5C,OAAOL,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,gCAAgC,EAAEF,EAAE,CAAC;MACpE;MAEA,IAAI,CAACL,UAAU,GAAGQ,IAAI,CAACC,KAAK,CAACE,CAAC,CAAC;MAE/B,IAAI,IAAAD,oBAAa,EAACL,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/png/es/index.js b/project starter code/node_modules/@jimp/png/es/index.js
index 95f2855e..16e1397a 100644
--- a/project starter code/node_modules/@jimp/png/es/index.js
+++ b/project starter code/node_modules/@jimp/png/es/index.js
@@ -1,161 +1,130 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _pngjs = require("pngjs");
-
-var _utils = require("@jimp/utils");
-
-var MIME_TYPE = 'image/png'; // PNG filter types
-
-var PNG_FILTER_AUTO = -1;
-var PNG_FILTER_NONE = 0;
-var PNG_FILTER_SUB = 1;
-var PNG_FILTER_UP = 2;
-var PNG_FILTER_AVERAGE = 3;
-var PNG_FILTER_PATH = 4;
-
-var _default = function _default() {
- return {
- mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['png']),
- constants: {
- MIME_PNG: MIME_TYPE,
- PNG_FILTER_AUTO: PNG_FILTER_AUTO,
- PNG_FILTER_NONE: PNG_FILTER_NONE,
- PNG_FILTER_SUB: PNG_FILTER_SUB,
- PNG_FILTER_UP: PNG_FILTER_UP,
- PNG_FILTER_AVERAGE: PNG_FILTER_AVERAGE,
- PNG_FILTER_PATH: PNG_FILTER_PATH
- },
- hasAlpha: (0, _defineProperty2["default"])({}, MIME_TYPE, true),
- decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _pngjs.PNG.sync.read),
- encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) {
- var png = new _pngjs.PNG({
+import { PNG } from "pngjs";
+import { throwError, isNodePattern } from "@jimp/utils";
+const MIME_TYPE = "image/png";
+
+// PNG filter types
+const PNG_FILTER_AUTO = -1;
+const PNG_FILTER_NONE = 0;
+const PNG_FILTER_SUB = 1;
+const PNG_FILTER_UP = 2;
+const PNG_FILTER_AVERAGE = 3;
+const PNG_FILTER_PATH = 4;
+export default (() => ({
+ mime: {
+ [MIME_TYPE]: ["png"]
+ },
+ constants: {
+ MIME_PNG: MIME_TYPE,
+ PNG_FILTER_AUTO,
+ PNG_FILTER_NONE,
+ PNG_FILTER_SUB,
+ PNG_FILTER_UP,
+ PNG_FILTER_AVERAGE,
+ PNG_FILTER_PATH
+ },
+ hasAlpha: {
+ [MIME_TYPE]: true
+ },
+ decoders: {
+ [MIME_TYPE]: PNG.sync.read
+ },
+ encoders: {
+ [MIME_TYPE](data) {
+ const png = new PNG({
width: data.bitmap.width,
height: data.bitmap.height
});
png.data = data.bitmap.data;
- return _pngjs.PNG.sync.write(png, {
- width: data.bitmap.width,
- height: data.bitmap.height,
+ return PNG.sync.write(png, {
deflateLevel: data._deflateLevel,
deflateStrategy: data._deflateStrategy,
filterType: data._filterType,
- colorType: typeof data._colorType === 'number' ? data._colorType : data._rgba ? 6 : 2,
+ colorType: typeof data._colorType === "number" ? data._colorType : data._rgba ? 6 : 2,
inputHasAlpha: data._rgba
});
- }),
- "class": {
- _deflateLevel: 9,
- _deflateStrategy: 3,
- _filterType: PNG_FILTER_AUTO,
- _colorType: null,
-
- /**
- * Sets the deflate level used when saving as PNG format (default is 9)
- * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- deflateLevel: function deflateLevel(l, cb) {
- if (typeof l !== 'number') {
- return _utils.throwError.call(this, 'l must be a number', cb);
- }
-
- if (l < 0 || l > 9) {
- return _utils.throwError.call(this, 'l must be a number 0 - 9', cb);
- }
-
- this._deflateLevel = Math.round(l);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Sets the deflate strategy used when saving as PNG format (default is 3)
- * @param {number} s Deflate strategy to use 0-3.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- deflateStrategy: function deflateStrategy(s, cb) {
- if (typeof s !== 'number') {
- return _utils.throwError.call(this, 's must be a number', cb);
- }
-
- if (s < 0 || s > 3) {
- return _utils.throwError.call(this, 's must be a number 0 - 3', cb);
- }
-
- this._deflateStrategy = Math.round(s);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Sets the filter type used when saving as PNG format (default is automatic filters)
- * @param {number} f The quality to use -1-4.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- filterType: function filterType(f, cb) {
- if (typeof f !== 'number') {
- return _utils.throwError.call(this, 'n must be a number', cb);
- }
-
- if (f < -1 || f > 4) {
- return _utils.throwError.call(this, 'n must be -1 (auto) or a number 0 - 4', cb);
- }
-
- this._filterType = Math.round(f);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
- },
-
- /**
- * Sets the color type used when saving as PNG format
- * @param {number} s color type to use 0, 2, 4, 6.
- * @param {function(Error, Jimp)} cb (optional) a callback for when complete
- * @returns {Jimp} this for chaining of methods
- */
- colorType: function colorType(s, cb) {
- if (typeof s !== 'number') {
- return _utils.throwError.call(this, 's must be a number', cb);
- }
-
- if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {
- return _utils.throwError.call(this, 's must be a number 0, 2, 4, 6.', cb);
- }
-
- this._colorType = Math.round(s);
-
- if ((0, _utils.isNodePattern)(cb)) {
- cb.call(this, null, this);
- }
-
- return this;
+ }
+ },
+ class: {
+ _deflateLevel: 9,
+ _deflateStrategy: 3,
+ _filterType: PNG_FILTER_AUTO,
+ _colorType: null,
+ /**
+ * Sets the deflate level used when saving as PNG format (default is 9)
+ * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ deflateLevel(l, cb) {
+ if (typeof l !== "number") {
+ return throwError.call(this, "l must be a number", cb);
+ }
+ if (l < 0 || l > 9) {
+ return throwError.call(this, "l must be a number 0 - 9", cb);
+ }
+ this._deflateLevel = Math.round(l);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Sets the deflate strategy used when saving as PNG format (default is 3)
+ * @param {number} s Deflate strategy to use 0-3.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ deflateStrategy(s, cb) {
+ if (typeof s !== "number") {
+ return throwError.call(this, "s must be a number", cb);
}
+ if (s < 0 || s > 3) {
+ return throwError.call(this, "s must be a number 0 - 3", cb);
+ }
+ this._deflateStrategy = Math.round(s);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Sets the filter type used when saving as PNG format (default is automatic filters)
+ * @param {number} f The quality to use -1-4.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ filterType(f, cb) {
+ if (typeof f !== "number") {
+ return throwError.call(this, "n must be a number", cb);
+ }
+ if (f < -1 || f > 4) {
+ return throwError.call(this, "n must be -1 (auto) or a number 0 - 4", cb);
+ }
+ this._filterType = Math.round(f);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
+ },
+ /**
+ * Sets the color type used when saving as PNG format
+ * @param {number} s color type to use 0, 2, 4, 6.
+ * @param {function(Error, Jimp)} cb (optional) a callback for when complete
+ * @returns {Jimp} this for chaining of methods
+ */
+ colorType(s, cb) {
+ if (typeof s !== "number") {
+ return throwError.call(this, "s must be a number", cb);
+ }
+ if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {
+ return throwError.call(this, "s must be a number 0, 2, 4, 6.", cb);
+ }
+ this._colorType = Math.round(s);
+ if (isNodePattern(cb)) {
+ cb.call(this, null, this);
+ }
+ return this;
}
- };
-};
-
-exports["default"] = _default;
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/png/es/index.js.map b/project starter code/node_modules/@jimp/png/es/index.js.map
index e5a9771f..e1070dae 100644
--- a/project starter code/node_modules/@jimp/png/es/index.js.map
+++ b/project starter code/node_modules/@jimp/png/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","PNG","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","l","cb","throwError","call","Math","round","s","f"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAA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A5B,IAAiCA,CAAC,KAAK,CAA3C,EAA8C;AAC5C,iBAAOJ,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,gCAAtB,EAAwDF,EAAxD,CAAP;AACD;;AAED,aAAKJ,UAAL,GAAkBO,IAAI,CAACC,KAAL,CAAWC,CAAX,CAAlB;;AAEA,YAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtGI;AAzCa,GAAP;AAAA,C","sourcesContent":["import { PNG } from 'pngjs';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/png';\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['png'] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE]: data => {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n width: data.bitmap.width,\n height: data.bitmap.height,\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === 'number'\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba\n });\n }\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== 'number') {\n return throwError.call(this, 'l must be a number', cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, 'l must be a number 0 - 9', cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, 's must be a number 0 - 3', cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n 'n must be -1 (auto) or a number 0 - 4',\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, 's must be a number 0, 2, 4, 6.', cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["PNG","throwError","isNodePattern","MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","class","l","cb","call","Math","round","s","f"],"sources":["../src/index.js"],"sourcesContent":["import { PNG } from \"pngjs\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/png\";\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"png\"] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH,\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE](data) {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height,\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === \"number\"\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba,\n });\n },\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== \"number\") {\n return throwError.call(this, \"l must be a number\", cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, \"l must be a number 0 - 9\", cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, \"s must be a number 0 - 3\", cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n \"n must be -1 (auto) or a number 0 - 4\",\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, \"s must be a number 0, 2, 4, 6.\", cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,OAAO;AAC3B,SAASC,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,MAAMC,SAAS,GAAG,WAAW;;AAE7B;AACA,MAAMC,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAMC,eAAe,GAAG,CAAC;AACzB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,eAAe,GAAG,CAAC;AAEzB,gBAAe,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACP,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BQ,SAAS,EAAE;IACTC,QAAQ,EAAET,SAAS;IACnBC,eAAe;IACfC,eAAe;IACfC,cAAc;IACdC,aAAa;IACbC,kBAAkB;IAClBC;EACF,CAAC;EAEDI,QAAQ,EAAE;IAAE,CAACV,SAAS,GAAG;EAAK,CAAC;EAC/BW,QAAQ,EAAE;IAAE,CAACX,SAAS,GAAGH,GAAG,CAACe,IAAI,CAACC;EAAK,CAAC;EACxCC,QAAQ,EAAE;IACR,CAACd,SAAS,EAAEe,IAAI,EAAE;MAChB,MAAMC,GAAG,GAAG,IAAInB,GAAG,CAAC;QAClBoB,KAAK,EAAEF,IAAI,CAACG,MAAM,CAACD,KAAK;QACxBE,MAAM,EAAEJ,IAAI,CAACG,MAAM,CAACC;MACtB,CAAC,CAAC;MAEFH,GAAG,CAACD,IAAI,GAAGA,IAAI,CAACG,MAAM,CAACH,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CAAC,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,EAAE;QAC5C,OAAOvC,UAAU,CAACoC,IAAI,CAAC,IAAI,EAAE,gCAAgC,EAAED,EAAE,CAAC;MACpE;MAEA,IAAI,CAACL,UAAU,GAAGO,IAAI,CAACC,KAAK,CAACC,CAAC,CAAC;MAE/B,IAAItC,aAAa,CAACkC,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/png/index.d.ts b/project starter code/node_modules/@jimp/png/index.d.ts
index 945db8ec..52bcda0c 100644
--- a/project starter code/node_modules/@jimp/png/index.d.ts
+++ b/project starter code/node_modules/@jimp/png/index.d.ts
@@ -1,10 +1,10 @@
-import { DecoderFn, EncoderFn, ImageCallback } from '@jimp/core';
+import { DecoderFn, EncoderFn, ImageCallback } from "@jimp/core";
interface PNGClass {
- _deflateLevel: number,
- _deflateStrategy: number,
- _filterType: number,
- _colorType: number,
+ _deflateLevel: number;
+ _deflateStrategy: number;
+ _filterType: number;
+ _colorType: number;
deflateLevel(l: number, cb?: ImageCallback): this;
deflateStrategy(s: number, cb?: ImageCallback): this;
filterType(f: number, cb?: ImageCallback): this;
@@ -12,22 +12,21 @@ interface PNGClass {
}
interface PNG {
+ mime: { "image/png": string[] };
- mime: { 'image/png': string[] },
-
- hasAlpha: { 'image/png': true },
+ hasAlpha: { "image/png": true };
decoders: {
- 'image/png': DecoderFn
- }
+ "image/png": DecoderFn;
+ };
encoders: {
- 'image/png': EncoderFn
- }
+ "image/png": EncoderFn;
+ };
+
+ class: PNGClass;
- class: PNGClass
-
constants: {
- MIME_PNG: 'image/png';
+ MIME_PNG: "image/png";
// PNG filter types
PNG_FILTER_AUTO: -1;
PNG_FILTER_NONE: 0;
@@ -35,7 +34,7 @@ interface PNG {
PNG_FILTER_UP: 2;
PNG_FILTER_AVERAGE: 3;
PNG_FILTER_PATH: 4;
- }
+ };
}
-export default function(): PNG;
+export default function (): PNG;
diff --git a/project starter code/node_modules/@jimp/png/package.json b/project starter code/node_modules/@jimp/png/package.json
index 8d64d22d..a5b0e2db 100644
--- a/project starter code/node_modules/@jimp/png/package.json
+++ b/project starter code/node_modules/@jimp/png/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/png",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Default Jimp png encoder/decoder.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,19 +21,19 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/utils": "^0.16.2",
- "pngjs": "^3.3.3"
+ "@jimp/utils": "^0.22.12",
+ "pngjs": "^6.0.0"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12",
+ "@types/pngjs": "^6.0.1"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/png/src/index.js b/project starter code/node_modules/@jimp/png/src/index.js
index 0e9c7477..2c81c063 100644
--- a/project starter code/node_modules/@jimp/png/src/index.js
+++ b/project starter code/node_modules/@jimp/png/src/index.js
@@ -1,7 +1,7 @@
-import { PNG } from 'pngjs';
-import { throwError, isNodePattern } from '@jimp/utils';
+import { PNG } from "pngjs";
+import { throwError, isNodePattern } from "@jimp/utils";
-const MIME_TYPE = 'image/png';
+const MIME_TYPE = "image/png";
// PNG filter types
const PNG_FILTER_AUTO = -1;
@@ -12,7 +12,7 @@ const PNG_FILTER_AVERAGE = 3;
const PNG_FILTER_PATH = 4;
export default () => ({
- mime: { [MIME_TYPE]: ['png'] },
+ mime: { [MIME_TYPE]: ["png"] },
constants: {
MIME_PNG: MIME_TYPE,
@@ -21,35 +21,33 @@ export default () => ({
PNG_FILTER_SUB,
PNG_FILTER_UP,
PNG_FILTER_AVERAGE,
- PNG_FILTER_PATH
+ PNG_FILTER_PATH,
},
hasAlpha: { [MIME_TYPE]: true },
decoders: { [MIME_TYPE]: PNG.sync.read },
encoders: {
- [MIME_TYPE]: data => {
+ [MIME_TYPE](data) {
const png = new PNG({
width: data.bitmap.width,
- height: data.bitmap.height
+ height: data.bitmap.height,
});
png.data = data.bitmap.data;
return PNG.sync.write(png, {
- width: data.bitmap.width,
- height: data.bitmap.height,
deflateLevel: data._deflateLevel,
deflateStrategy: data._deflateStrategy,
filterType: data._filterType,
colorType:
- typeof data._colorType === 'number'
+ typeof data._colorType === "number"
? data._colorType
: data._rgba
- ? 6
- : 2,
- inputHasAlpha: data._rgba
+ ? 6
+ : 2,
+ inputHasAlpha: data._rgba,
});
- }
+ },
},
class: {
@@ -65,12 +63,12 @@ export default () => ({
* @returns {Jimp} this for chaining of methods
*/
deflateLevel(l, cb) {
- if (typeof l !== 'number') {
- return throwError.call(this, 'l must be a number', cb);
+ if (typeof l !== "number") {
+ return throwError.call(this, "l must be a number", cb);
}
if (l < 0 || l > 9) {
- return throwError.call(this, 'l must be a number 0 - 9', cb);
+ return throwError.call(this, "l must be a number 0 - 9", cb);
}
this._deflateLevel = Math.round(l);
@@ -89,12 +87,12 @@ export default () => ({
* @returns {Jimp} this for chaining of methods
*/
deflateStrategy(s, cb) {
- if (typeof s !== 'number') {
- return throwError.call(this, 's must be a number', cb);
+ if (typeof s !== "number") {
+ return throwError.call(this, "s must be a number", cb);
}
if (s < 0 || s > 3) {
- return throwError.call(this, 's must be a number 0 - 3', cb);
+ return throwError.call(this, "s must be a number 0 - 3", cb);
}
this._deflateStrategy = Math.round(s);
@@ -113,14 +111,14 @@ export default () => ({
* @returns {Jimp} this for chaining of methods
*/
filterType(f, cb) {
- if (typeof f !== 'number') {
- return throwError.call(this, 'n must be a number', cb);
+ if (typeof f !== "number") {
+ return throwError.call(this, "n must be a number", cb);
}
if (f < -1 || f > 4) {
return throwError.call(
this,
- 'n must be -1 (auto) or a number 0 - 4',
+ "n must be -1 (auto) or a number 0 - 4",
cb
);
}
@@ -139,12 +137,12 @@ export default () => ({
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/ colorType(s, cb) {
- if (typeof s !== 'number') {
- return throwError.call(this, 's must be a number', cb);
+ if (typeof s !== "number") {
+ return throwError.call(this, "s must be a number", cb);
}
if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {
- return throwError.call(this, 's must be a number 0, 2, 4, 6.', cb);
+ return throwError.call(this, "s must be a number 0, 2, 4, 6.", cb);
}
this._colorType = Math.round(s);
@@ -154,6 +152,6 @@ export default () => ({
}
return this;
- }
- }
+ },
+ },
});
diff --git a/project starter code/node_modules/@jimp/png/test/png.test.js b/project starter code/node_modules/@jimp/png/test/png.test.js
index 30a297d6..ff10457c 100644
--- a/project starter code/node_modules/@jimp/png/test/png.test.js
+++ b/project starter code/node_modules/@jimp/png/test/png.test.js
@@ -1,84 +1,48 @@
-import { Jimp, getTestDir } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, getTestDir } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import expect from "@storybook/expect";
-import png from '../src';
+import png from "../src";
const jimp = configure({ types: [png] }, Jimp);
-describe('PNG', () => {
- const imagesDir = getTestDir(__dirname) + '/images';
+describe("PNG", () => {
+ const imagesDir = getTestDir(__dirname) + "/images";
- it('load PNG', async () => {
- const image = await jimp.read(imagesDir + '/dice.png');
+ it("load PNG", async () => {
+ const image = await jimp.read(imagesDir + "/dice.png");
- image.getPixelColor(10, 10).should.be.equal(0x00000000);
- image.getPixelColor(160, 80).should.be.equal(0x1c1cd4ff);
- image.getPixelColor(400, 250).should.be.equal(0x7e0c0cda);
+ expect(image.getPixelColor(10, 10)).toBe(0x00000000);
+ expect(image.getPixelColor(160, 80)).toBe(0x1c1cd4ff);
+ expect(image.getPixelColor(400, 250)).toBe(0x7e0c0cda);
});
- it('export PNG', async () => {
+ it("export PNG", async () => {
const jgd = await jimp.read({
width: 3,
height: 3,
data: [
- 0xff0000ff,
- 0xff0080ff,
- 0xff00ffff,
- 0xff0080ff,
- 0xff00ffff,
- 0x8000ffff,
- 0xff00ffff,
- 0x8000ffff,
- 0x0000ffff
- ]
+ 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
+ 0xff00ffff, 0x8000ffff, 0x0000ffff,
+ ],
});
- const buffer = await jgd.getBufferAsync('image/png');
+ const buffer = await jgd.getBufferAsync("image/png");
- buffer.toString().should.match(/^.PNG\r\n/);
+ expect(buffer.toString()).toMatch(/^.PNG\r\n/);
});
- it('should use png options', async () => {
+ it("should use png options", async () => {
const jgd = await jimp.read({
width: 20,
height: 20,
data: [
- 0xff0000ff,
- 0xff0080ff,
- 0xff00ffff,
- 0xff0080ff,
- 0xff00ffff,
- 0x8000ffff,
- 0xff00ffff,
- 0x8000ffff,
- 0x0000ffff,
- 0xff0000ff,
- 0xff0080ff,
- 0xff00ffff,
- 0xff0080ff,
- 0xff00ffff,
- 0x8000ffff,
- 0xff00ffff,
- 0x8000ffff,
- 0x0000ffff,
- 0xff0000ff,
- 0xff0080ff,
- 0xff00ffff,
- 0xff0080ff,
- 0xff00ffff,
- 0x8000ffff,
- 0xff00ffff,
- 0x8000ffff,
- 0x0000ffff,
- 0xff0000ff,
- 0xff0080ff,
- 0xff00ffff,
- 0xff0080ff,
- 0xff00ffff,
- 0x8000ffff,
- 0xff00ffff,
- 0x8000ffff,
- 0x0000ffff
- ]
+ 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
+ 0xff00ffff, 0x8000ffff, 0x0000ffff, 0xff0000ff, 0xff0080ff, 0xff00ffff,
+ 0xff0080ff, 0xff00ffff, 0x8000ffff, 0xff00ffff, 0x8000ffff, 0x0000ffff,
+ 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
+ 0xff00ffff, 0x8000ffff, 0x0000ffff, 0xff0000ff, 0xff0080ff, 0xff00ffff,
+ 0xff0080ff, 0xff00ffff, 0x8000ffff, 0xff00ffff, 0x8000ffff, 0x0000ffff,
+ ],
});
const image = await jgd
@@ -86,12 +50,12 @@ describe('PNG', () => {
.colorType(0)
.getBufferAsync(Jimp.MIME_PNG);
- const expected = await jimp.read(imagesDir + '/options.png');
+ const expected = await jimp.read(imagesDir + "/options.png");
const expectedBuffer = await expected
.deflateStrategy(0)
.colorType(0)
.getBufferAsync(Jimp.MIME_PNG);
- image.should.be.deepEqual(expectedBuffer);
+ expect(image).toEqual(expectedBuffer);
});
});
diff --git a/project starter code/node_modules/@jimp/tiff/CHANGELOG.md b/project starter code/node_modules/@jimp/tiff/CHANGELOG.md
index 26394e0f..dce8da69 100644
--- a/project starter code/node_modules/@jimp/tiff/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/tiff/CHANGELOG.md
@@ -1,3 +1,77 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.22.0 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
+
+#### Authors: 2
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.18.0 (Sun Feb 05 2023)
+
+#### 🚀 Enhancement
+
+- Update utif [#1143](https://github.com/jimp-dev/jimp/pull/1143) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +86,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +94,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/tiff/dist/index.js b/project starter code/node_modules/@jimp/tiff/dist/index.js
index cf242ccb..adea7438 100644
--- a/project starter code/node_modules/@jimp/tiff/dist/index.js
+++ b/project starter code/node_modules/@jimp/tiff/dist/index.js
@@ -1,47 +1,42 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _utif = _interopRequireDefault(require("utif"));
-
-var MIME_TYPE = 'image/tiff';
-
-var _default = function _default() {
- return {
- mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['tiff', 'tif']),
- constants: {
- MIME_TIFF: MIME_TYPE
- },
- decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) {
- var ifds = _utif["default"].decode(data);
-
- var page = ifds[0];
-
- _utif["default"].decodeImages(data, ifds);
-
- var rgba = _utif["default"].toRGBA8(page);
-
+exports.default = void 0;
+var _utif = _interopRequireDefault(require("utif2"));
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+const MIME_TYPE = "image/tiff";
+var _default = () => ({
+ mime: {
+ [MIME_TYPE]: ["tiff", "tif"]
+ },
+ constants: {
+ MIME_TIFF: MIME_TYPE
+ },
+ decoders: {
+ [MIME_TYPE]: data => {
+ const ifds = _utif.default.decode(data);
+ const page = ifds[0];
+ ifds.forEach(ifd => {
+ _utif.default.decodeImage(data, ifd);
+ });
+ const rgba = _utif.default.toRGBA8(page);
return {
data: Buffer.from(rgba),
width: page.t256[0],
height: page.t257[0]
};
- }),
- encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) {
- var tiff = _utif["default"].encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height);
-
+ }
+ },
+ encoders: {
+ [MIME_TYPE]: image => {
+ const tiff = _utif.default.encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height);
return Buffer.from(tiff);
- })
- };
-};
-
-exports["default"] = _default;
+ }
+ }
+});
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/tiff/dist/index.js.map b/project starter code/node_modules/@jimp/tiff/dist/index.js.map
index 639a6f4f..862d34d4 100644
--- a/project starter code/node_modules/@jimp/tiff/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/tiff/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","UTIF","decode","page","decodeImages","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"mappings":";;;;;;;;;;;AAAA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMC,IAAI,GAAGC,iBAAKC,MAAL,CAAYH,IAAZ,CAAb;;AACA,UAAMI,IAAI,GAAGH,IAAI,CAAC,CAAD,CAAjB;;AACAC,uBAAKG,YAAL,CAAkBL,IAAlB,EAAwBC,IAAxB;;AACA,UAAMK,IAAI,GAAGJ,iBAAKK,OAAL,CAAaH,IAAb,CAAb;;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEQ,MAAM,CAACC,IAAP,CAAYH,IAAZ,CADD;AAELI,QAAAA,KAAK,EAAEN,IAAI,CAACO,IAAL,CAAU,CAAV,CAFF;AAGLC,QAAAA,MAAM,EAAER,IAAI,CAACS,IAAL,CAAU,CAAV;AAHH,OAAP;AAKD,KAZK,CAPY;AAsBpBC,IAAAA,QAAQ,uCACLnB,SADK,EACO,UAAAoB,KAAK,EAAI;AACpB,UAAMC,IAAI,GAAGd,iBAAKe,WAAL,CACXF,KAAK,CAACG,MAAN,CAAalB,IADF,EAEXe,KAAK,CAACG,MAAN,CAAaR,KAFF,EAGXK,KAAK,CAACG,MAAN,CAAaN,MAHF,CAAb;;AAMA,aAAOJ,MAAM,CAACC,IAAP,CAAYO,IAAZ,CAAP;AACD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import UTIF from 'utif';\n\nconst MIME_TYPE = 'image/tiff';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['tiff', 'tif'] },\n\n constants: {\n MIME_TIFF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const ifds = UTIF.decode(data);\n const page = ifds[0];\n UTIF.decodeImages(data, ifds);\n const rgba = UTIF.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0]\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: image => {\n const tiff = UTIF.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","utif","decode","page","forEach","ifd","decodeImage","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"sources":["../src/index.js"],"sourcesContent":["import utif from \"utif2\";\n\nconst MIME_TYPE = \"image/tiff\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"tiff\", \"tif\"] },\n\n constants: {\n MIME_TIFF: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: (data) => {\n const ifds = utif.decode(data);\n const page = ifds[0];\n\n ifds.forEach((ifd) => {\n utif.decodeImage(data, ifd);\n });\n\n const rgba = utif.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0],\n };\n },\n },\n\n encoders: {\n [MIME_TYPE]: (image) => {\n const tiff = utif.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AAAyB;AAEzB,MAAMA,SAAS,GAAG,YAAY;AAAC,eAEhB,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK;EAAE,CAAC;EAEtCE,SAAS,EAAE;IACTC,SAAS,EAAEH;EACb,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMC,IAAI,GAAGC,aAAI,CAACC,MAAM,CAACH,IAAI,CAAC;MAC9B,MAAMI,IAAI,GAAGH,IAAI,CAAC,CAAC,CAAC;MAEpBA,IAAI,CAACI,OAAO,CAAEC,GAAG,IAAK;QACpBJ,aAAI,CAACK,WAAW,CAACP,IAAI,EAAEM,GAAG,CAAC;MAC7B,CAAC,CAAC;MAEF,MAAME,IAAI,GAAGN,aAAI,CAACO,OAAO,CAACL,IAAI,CAAC;MAE/B,OAAO;QACLJ,IAAI,EAAEU,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC;QACvBI,KAAK,EAAER,IAAI,CAACS,IAAI,CAAC,CAAC,CAAC;QACnBC,MAAM,EAAEV,IAAI,CAACW,IAAI,CAAC,CAAC;MACrB,CAAC;IACH;EACF,CAAC;EAEDC,QAAQ,EAAE;IACR,CAACrB,SAAS,GAAIsB,KAAK,IAAK;MACtB,MAAMC,IAAI,GAAGhB,aAAI,CAACiB,WAAW,CAC3BF,KAAK,CAACG,MAAM,CAACpB,IAAI,EACjBiB,KAAK,CAACG,MAAM,CAACR,KAAK,EAClBK,KAAK,CAACG,MAAM,CAACN,MAAM,CACpB;MAED,OAAOJ,MAAM,CAACC,IAAI,CAACO,IAAI,CAAC;IAC1B;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/tiff/es/index.js b/project starter code/node_modules/@jimp/tiff/es/index.js
index 3233d0e7..03159084 100644
--- a/project starter code/node_modules/@jimp/tiff/es/index.js
+++ b/project starter code/node_modules/@jimp/tiff/es/index.js
@@ -1,46 +1,32 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
-
-var _utif = _interopRequireDefault(require("utif"));
-
-var MIME_TYPE = 'image/tiff';
-
-var _default = function _default() {
- return {
- mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['tiff', 'tif']),
- constants: {
- MIME_TIFF: MIME_TYPE
- },
- decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) {
- var ifds = _utif["default"].decode(data);
-
- var page = ifds[0];
-
- _utif["default"].decodeImages(data, ifds);
-
- var rgba = _utif["default"].toRGBA8(page);
-
+import utif from "utif2";
+const MIME_TYPE = "image/tiff";
+export default (() => ({
+ mime: {
+ [MIME_TYPE]: ["tiff", "tif"]
+ },
+ constants: {
+ MIME_TIFF: MIME_TYPE
+ },
+ decoders: {
+ [MIME_TYPE]: data => {
+ const ifds = utif.decode(data);
+ const page = ifds[0];
+ ifds.forEach(ifd => {
+ utif.decodeImage(data, ifd);
+ });
+ const rgba = utif.toRGBA8(page);
return {
data: Buffer.from(rgba),
width: page.t256[0],
height: page.t257[0]
};
- }),
- encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) {
- var tiff = _utif["default"].encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height);
-
+ }
+ },
+ encoders: {
+ [MIME_TYPE]: image => {
+ const tiff = utif.encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height);
return Buffer.from(tiff);
- })
- };
-};
-
-exports["default"] = _default;
+ }
+ }
+}));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/tiff/es/index.js.map b/project starter code/node_modules/@jimp/tiff/es/index.js.map
index 639a6f4f..21755188 100644
--- a/project starter code/node_modules/@jimp/tiff/es/index.js.map
+++ b/project starter code/node_modules/@jimp/tiff/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","UTIF","decode","page","decodeImages","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"mappings":";;;;;;;;;;;AAAA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMC,IAAI,GAAGC,iBAAKC,MAAL,CAAYH,IAAZ,CAAb;;AACA,UAAMI,IAAI,GAAGH,IAAI,CAAC,CAAD,CAAjB;;AACAC,uBAAKG,YAAL,CAAkBL,IAAlB,EAAwBC,IAAxB;;AACA,UAAMK,IAAI,GAAGJ,iBAAKK,OAAL,CAAaH,IAAb,CAAb;;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEQ,MAAM,CAACC,IAAP,CAAYH,IAAZ,CADD;AAELI,QAAAA,KAAK,EAAEN,IAAI,CAACO,IAAL,CAAU,CAAV,CAFF;AAGLC,QAAAA,MAAM,EAAER,IAAI,CAACS,IAAL,CAAU,CAAV;AAHH,OAAP;AAKD,KAZK,CAPY;AAsBpBC,IAAAA,QAAQ,uCACLnB,SADK,EACO,UAAAoB,KAAK,EAAI;AACpB,UAAMC,IAAI,GAAGd,iBAAKe,WAAL,CACXF,KAAK,CAACG,MAAN,CAAalB,IADF,EAEXe,KAAK,CAACG,MAAN,CAAaR,KAFF,EAGXK,KAAK,CAACG,MAAN,CAAaN,MAHF,CAAb;;AAMA,aAAOJ,MAAM,CAACC,IAAP,CAAYO,IAAZ,CAAP;AACD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import UTIF from 'utif';\n\nconst MIME_TYPE = 'image/tiff';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['tiff', 'tif'] },\n\n constants: {\n MIME_TIFF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const ifds = UTIF.decode(data);\n const page = ifds[0];\n UTIF.decodeImages(data, ifds);\n const rgba = UTIF.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0]\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: image => {\n const tiff = UTIF.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n }\n }\n});\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["utif","MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","decode","page","forEach","ifd","decodeImage","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"sources":["../src/index.js"],"sourcesContent":["import utif from \"utif2\";\n\nconst MIME_TYPE = \"image/tiff\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"tiff\", \"tif\"] },\n\n constants: {\n MIME_TIFF: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: (data) => {\n const ifds = utif.decode(data);\n const page = ifds[0];\n\n ifds.forEach((ifd) => {\n utif.decodeImage(data, ifd);\n });\n\n const rgba = utif.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0],\n };\n },\n },\n\n encoders: {\n [MIME_TYPE]: (image) => {\n const tiff = utif.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n },\n },\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,OAAO;AAExB,MAAMC,SAAS,GAAG,YAAY;AAE9B,gBAAe,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK;EAAE,CAAC;EAEtCE,SAAS,EAAE;IACTC,SAAS,EAAEH;EACb,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMC,IAAI,GAAGP,IAAI,CAACQ,MAAM,CAACF,IAAI,CAAC;MAC9B,MAAMG,IAAI,GAAGF,IAAI,CAAC,CAAC,CAAC;MAEpBA,IAAI,CAACG,OAAO,CAAEC,GAAG,IAAK;QACpBX,IAAI,CAACY,WAAW,CAACN,IAAI,EAAEK,GAAG,CAAC;MAC7B,CAAC,CAAC;MAEF,MAAME,IAAI,GAAGb,IAAI,CAACc,OAAO,CAACL,IAAI,CAAC;MAE/B,OAAO;QACLH,IAAI,EAAES,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC;QACvBI,KAAK,EAAER,IAAI,CAACS,IAAI,CAAC,CAAC,CAAC;QACnBC,MAAM,EAAEV,IAAI,CAACW,IAAI,CAAC,CAAC;MACrB,CAAC;IACH;EACF,CAAC;EAEDC,QAAQ,EAAE;IACR,CAACpB,SAAS,GAAIqB,KAAK,IAAK;MACtB,MAAMC,IAAI,GAAGvB,IAAI,CAACwB,WAAW,CAC3BF,KAAK,CAACG,MAAM,CAACnB,IAAI,EACjBgB,KAAK,CAACG,MAAM,CAACR,KAAK,EAClBK,KAAK,CAACG,MAAM,CAACN,MAAM,CACpB;MAED,OAAOJ,MAAM,CAACC,IAAI,CAACO,IAAI,CAAC;IAC1B;EACF;AACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/tiff/index.d.ts b/project starter code/node_modules/@jimp/tiff/index.d.ts
index fdd0c5fe..851d7383 100644
--- a/project starter code/node_modules/@jimp/tiff/index.d.ts
+++ b/project starter code/node_modules/@jimp/tiff/index.d.ts
@@ -1,16 +1,16 @@
-import { DecoderFn, EncoderFn } from '@jimp/core';
+import { DecoderFn, EncoderFn } from "@jimp/core";
interface Tiff {
- mime: { 'image/tiff': string[] }
+ mime: { "image/tiff": string[] };
decoders: {
- 'image/tiff': DecoderFn
- }
+ "image/tiff": DecoderFn;
+ };
encoders: {
- 'image/tiff': EncoderFn
- }
+ "image/tiff": EncoderFn;
+ };
constants: {
- MIME_TIFF: 'image/tiff';
- }
+ MIME_TIFF: "image/tiff";
+ };
}
-export default function(): Tiff;
+export default function (): Tiff;
diff --git a/project starter code/node_modules/@jimp/tiff/package.json b/project starter code/node_modules/@jimp/tiff/package.json
index 157805ef..ef219133 100644
--- a/project starter code/node_modules/@jimp/tiff/package.json
+++ b/project starter code/node_modules/@jimp/tiff/package.json
@@ -1,12 +1,13 @@
{
"name": "@jimp/tiff",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Default Jimp tiff encoder/decoder.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
- "test": "cross-env BABEL_ENV=test mocha --require @babel/register",
+ "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",
"test:coverage": "nyc npm run test",
"build": "npm run build:node:production && npm run build:module",
@@ -20,18 +21,17 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "utif": "^2.0.1"
+ "utif2": "^4.0.1"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
},
"devDependencies": {
- "@jimp/custom": "^0.16.2",
- "@jimp/test-utils": "^0.16.2"
+ "@jimp/custom": "^0.22.12",
+ "@jimp/test-utils": "^0.22.12"
},
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/tiff/src/index.js b/project starter code/node_modules/@jimp/tiff/src/index.js
index c8dc3ee4..7942ae72 100644
--- a/project starter code/node_modules/@jimp/tiff/src/index.js
+++ b/project starter code/node_modules/@jimp/tiff/src/index.js
@@ -1,38 +1,42 @@
-import UTIF from 'utif';
+import utif from "utif2";
-const MIME_TYPE = 'image/tiff';
+const MIME_TYPE = "image/tiff";
export default () => ({
- mime: { [MIME_TYPE]: ['tiff', 'tif'] },
+ mime: { [MIME_TYPE]: ["tiff", "tif"] },
constants: {
- MIME_TIFF: MIME_TYPE
+ MIME_TIFF: MIME_TYPE,
},
decoders: {
- [MIME_TYPE]: data => {
- const ifds = UTIF.decode(data);
+ [MIME_TYPE]: (data) => {
+ const ifds = utif.decode(data);
const page = ifds[0];
- UTIF.decodeImages(data, ifds);
- const rgba = UTIF.toRGBA8(page);
+
+ ifds.forEach((ifd) => {
+ utif.decodeImage(data, ifd);
+ });
+
+ const rgba = utif.toRGBA8(page);
return {
data: Buffer.from(rgba),
width: page.t256[0],
- height: page.t257[0]
+ height: page.t257[0],
};
- }
+ },
},
encoders: {
- [MIME_TYPE]: image => {
- const tiff = UTIF.encodeImage(
+ [MIME_TYPE]: (image) => {
+ const tiff = utif.encodeImage(
image.bitmap.data,
image.bitmap.width,
image.bitmap.height
);
return Buffer.from(tiff);
- }
- }
+ },
+ },
});
diff --git a/project starter code/node_modules/@jimp/tiff/test/tiff.test.js b/project starter code/node_modules/@jimp/tiff/test/tiff.test.js
index 84cb9720..be1e98f0 100644
--- a/project starter code/node_modules/@jimp/tiff/test/tiff.test.js
+++ b/project starter code/node_modules/@jimp/tiff/test/tiff.test.js
@@ -1,41 +1,35 @@
-import { Jimp, getTestDir } from '@jimp/test-utils';
-import configure from '@jimp/custom';
+import { Jimp, getTestDir } from "@jimp/test-utils";
+import configure from "@jimp/custom";
+import expect from "@storybook/expect";
-import tiff from '../src';
+import tiff from "../src";
const jimp = configure({ types: [tiff] }, Jimp);
-describe('TIFF', () => {
- const imagesDir = getTestDir(__dirname) + '/images';
+describe("TIFF", () => {
+ const imagesDir = getTestDir(__dirname) + "/images";
- it('load TIFF', async () => {
- const image = await jimp.read(imagesDir + '/rgb.tiff');
+ it("load TIFF", async () => {
+ const image = await jimp.read(imagesDir + "/rgb.tiff");
- image.getPixelColor(10, 10).should.be.equal(0xa4988bff);
- image.getPixelColor(220, 190).should.be.equal(0xe0d7ddff);
- image.getPixelColor(350, 130).should.be.equal(0x565433ff);
+ expect(image.getPixelColor(10, 10)).toBe(0xa4988bff);
+ expect(image.getPixelColor(220, 190)).toBe(0xe0d7ddff);
+ expect(image.getPixelColor(350, 130)).toBe(0x565433ff);
});
const simpleJGD = {
width: 3,
height: 3,
data: [
- 0xff0000ff,
- 0xff0080ff,
- 0xff00ffff,
- 0xff0080ff,
- 0xff00ffff,
- 0x8000ffff,
- 0xff00ffff,
- 0x8000ffff,
- 0x0000ffff
- ]
+ 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
+ 0xff00ffff, 0x8000ffff, 0x0000ffff,
+ ],
};
- it('export TIFF', async () => {
+ it("export TIFF", async () => {
const image = await jimp.read(simpleJGD);
- const buffer = await image.getBufferAsync('image/tiff');
+ const buffer = await image.getBufferAsync("image/tiff");
- buffer.toString().should.match(/^MM\u0000*\u0000/);
+ expect(buffer.toString()).toMatch(/^MM\u0000*\u0000/);
});
});
diff --git a/project starter code/node_modules/@jimp/types/CHANGELOG.md b/project starter code/node_modules/@jimp/types/CHANGELOG.md
index 26394e0f..8d029143 100644
--- a/project starter code/node_modules/@jimp/types/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/types/CHANGELOG.md
@@ -1,3 +1,51 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -12,7 +60,7 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
@@ -20,4 +68,4 @@
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/types/dist/index.js b/project starter code/node_modules/@jimp/types/dist/index.js
index 6010c060..5fba82b6 100644
--- a/project starter code/node_modules/@jimp/types/dist/index.js
+++ b/project starter code/node_modules/@jimp/types/dist/index.js
@@ -1,28 +1,18 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports["default"] = void 0;
-
+exports.default = void 0;
var _timm = require("timm");
-
var _jpeg = _interopRequireDefault(require("@jimp/jpeg"));
-
var _png = _interopRequireDefault(require("@jimp/png"));
-
var _bmp = _interopRequireDefault(require("@jimp/bmp"));
-
var _tiff = _interopRequireDefault(require("@jimp/tiff"));
-
var _gif = _interopRequireDefault(require("@jimp/gif"));
-
-var _default = function _default() {
- return (0, _timm.mergeDeep)((0, _jpeg["default"])(), (0, _png["default"])(), (0, _bmp["default"])(), (0, _tiff["default"])(), (0, _gif["default"])());
-};
-
-exports["default"] = _default;
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+var _default = () => (0, _timm.mergeDeep)((0, _jpeg.default)(), (0, _png.default)(), (0, _bmp.default)(), (0, _tiff.default)(), (0, _gif.default)());
+exports.default = _default;
module.exports = exports.default;
+module.exports.default = exports.default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/types/dist/index.js.map b/project starter code/node_modules/@jimp/types/dist/index.js.map
index 197bdb02..fcaf8e11 100644
--- a/project starter code/node_modules/@jimp/types/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/types/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;eAEe;AAAA,SAAM,qBAAU,uBAAV,EAAkB,sBAAlB,EAAyB,sBAAzB,EAAgC,uBAAhC,EAAwC,sBAAxC,CAAN;AAAA,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport jpeg from '@jimp/jpeg';\nimport png from '@jimp/png';\nimport bmp from '@jimp/bmp';\nimport tiff from '@jimp/tiff';\nimport gif from '@jimp/gif';\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["mergeDeep","jpeg","png","bmp","tiff","gif"],"sources":["../src/index.js"],"sourcesContent":["import { mergeDeep } from \"timm\";\n\nimport jpeg from \"@jimp/jpeg\";\nimport png from \"@jimp/png\";\nimport bmp from \"@jimp/bmp\";\nimport tiff from \"@jimp/tiff\";\nimport gif from \"@jimp/gif\";\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AAA4B;AAAA,eAEb,MAAM,IAAAA,eAAS,EAAC,IAAAC,aAAI,GAAE,EAAE,IAAAC,YAAG,GAAE,EAAE,IAAAC,YAAG,GAAE,EAAE,IAAAC,aAAI,GAAE,EAAE,IAAAC,YAAG,GAAE,CAAC;AAAA;AAAA;AAAA"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/types/es/index.js b/project starter code/node_modules/@jimp/types/es/index.js
index 01ce8be9..0c66bcbf 100644
--- a/project starter code/node_modules/@jimp/types/es/index.js
+++ b/project starter code/node_modules/@jimp/types/es/index.js
@@ -1,27 +1,8 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports["default"] = void 0;
-
-var _timm = require("timm");
-
-var _jpeg = _interopRequireDefault(require("@jimp/jpeg"));
-
-var _png = _interopRequireDefault(require("@jimp/png"));
-
-var _bmp = _interopRequireDefault(require("@jimp/bmp"));
-
-var _tiff = _interopRequireDefault(require("@jimp/tiff"));
-
-var _gif = _interopRequireDefault(require("@jimp/gif"));
-
-var _default = function _default() {
- return (0, _timm.mergeDeep)((0, _jpeg["default"])(), (0, _png["default"])(), (0, _bmp["default"])(), (0, _tiff["default"])(), (0, _gif["default"])());
-};
-
-exports["default"] = _default;
+import { mergeDeep } from "timm";
+import jpeg from "@jimp/jpeg";
+import png from "@jimp/png";
+import bmp from "@jimp/bmp";
+import tiff from "@jimp/tiff";
+import gif from "@jimp/gif";
+export default (() => mergeDeep(jpeg(), png(), bmp(), tiff(), gif()));
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/types/es/index.js.map b/project starter code/node_modules/@jimp/types/es/index.js.map
index 197bdb02..c6cbaed2 100644
--- a/project starter code/node_modules/@jimp/types/es/index.js.map
+++ b/project starter code/node_modules/@jimp/types/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;eAEe;AAAA,SAAM,qBAAU,uBAAV,EAAkB,sBAAlB,EAAyB,sBAAzB,EAAgC,uBAAhC,EAAwC,sBAAxC,CAAN;AAAA,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport jpeg from '@jimp/jpeg';\nimport png from '@jimp/png';\nimport bmp from '@jimp/bmp';\nimport tiff from '@jimp/tiff';\nimport gif from '@jimp/gif';\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["mergeDeep","jpeg","png","bmp","tiff","gif"],"sources":["../src/index.js"],"sourcesContent":["import { mergeDeep } from \"timm\";\n\nimport jpeg from \"@jimp/jpeg\";\nimport png from \"@jimp/png\";\nimport bmp from \"@jimp/bmp\";\nimport tiff from \"@jimp/tiff\";\nimport gif from \"@jimp/gif\";\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,MAAM;AAEhC,OAAOC,IAAI,MAAM,YAAY;AAC7B,OAAOC,GAAG,MAAM,WAAW;AAC3B,OAAOC,GAAG,MAAM,WAAW;AAC3B,OAAOC,IAAI,MAAM,YAAY;AAC7B,OAAOC,GAAG,MAAM,WAAW;AAE3B,gBAAe,MAAML,SAAS,CAACC,IAAI,EAAE,EAAEC,GAAG,EAAE,EAAEC,GAAG,EAAE,EAAEC,IAAI,EAAE,EAAEC,GAAG,EAAE,CAAC"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/types/index.d.ts b/project starter code/node_modules/@jimp/types/index.d.ts
index ec2df4ec..98f0cceb 100644
--- a/project starter code/node_modules/@jimp/types/index.d.ts
+++ b/project starter code/node_modules/@jimp/types/index.d.ts
@@ -1,14 +1,14 @@
-import jpeg from '@jimp/jpeg';
-import png from '@jimp/png';
-import bmp from '@jimp/bmp';
-import tiff from '@jimp/tiff';
-import gif from '@jimp/gif';
+import jpeg from "@jimp/jpeg";
+import png from "@jimp/png";
+import bmp from "@jimp/bmp";
+import tiff from "@jimp/tiff";
+import gif from "@jimp/gif";
-type JpegRet = ReturnType
-type PngRet = ReturnType
-type BmpRet = ReturnType
-type TiffRet = ReturnType
-type GifRet = ReturnType
+type JpegRet = ReturnType;
+type PngRet = ReturnType;
+type BmpRet = ReturnType;
+type TiffRet = ReturnType;
+type GifRet = ReturnType;
/**
* This is made union and not intersection to avoid issues with
@@ -18,10 +18,6 @@ type GifRet = ReturnType
* In reality, this should be an intersection but our type data isn't
* clever enough to figure out what's a class and what's not/etc
*/
-type Types = JpegRet |
- PngRet |
- BmpRet |
- TiffRet |
- GifRet
+type Types = JpegRet | PngRet | BmpRet | TiffRet | GifRet;
-export default function(): Types;
+export default function (): Types;
diff --git a/project starter code/node_modules/@jimp/types/package.json b/project starter code/node_modules/@jimp/types/package.json
index 7d7f6817..7042428f 100644
--- a/project starter code/node_modules/@jimp/types/package.json
+++ b/project starter code/node_modules/@jimp/types/package.json
@@ -1,9 +1,10 @@
{
"name": "@jimp/types",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Default Jimp encoder/decoders.",
"main": "dist/index.js",
"module": "es/index.js",
+ "repository": "jimp-dev/jimp",
"types": "index.d.ts",
"scripts": {
"build": "npm run build:node:production && npm run build:module",
@@ -17,12 +18,11 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@babel/runtime": "^7.7.2",
- "@jimp/bmp": "^0.16.2",
- "@jimp/gif": "^0.16.2",
- "@jimp/jpeg": "^0.16.2",
- "@jimp/png": "^0.16.2",
- "@jimp/tiff": "^0.16.2",
+ "@jimp/bmp": "^0.22.12",
+ "@jimp/gif": "^0.22.12",
+ "@jimp/jpeg": "^0.22.12",
+ "@jimp/png": "^0.22.12",
+ "@jimp/tiff": "^0.22.12",
"timm": "^1.6.1"
},
"peerDependencies": {
@@ -34,5 +34,5 @@
"publishConfig": {
"access": "public"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/types/src/index.js b/project starter code/node_modules/@jimp/types/src/index.js
index 313982c6..1f6eb528 100644
--- a/project starter code/node_modules/@jimp/types/src/index.js
+++ b/project starter code/node_modules/@jimp/types/src/index.js
@@ -1,9 +1,9 @@
-import { mergeDeep } from 'timm';
+import { mergeDeep } from "timm";
-import jpeg from '@jimp/jpeg';
-import png from '@jimp/png';
-import bmp from '@jimp/bmp';
-import tiff from '@jimp/tiff';
-import gif from '@jimp/gif';
+import jpeg from "@jimp/jpeg";
+import png from "@jimp/png";
+import bmp from "@jimp/bmp";
+import tiff from "@jimp/tiff";
+import gif from "@jimp/gif";
export default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());
diff --git a/project starter code/node_modules/@jimp/utils/CHANGELOG.md b/project starter code/node_modules/@jimp/utils/CHANGELOG.md
index 5ba04890..8aae0bbe 100644
--- a/project starter code/node_modules/@jimp/utils/CHANGELOG.md
+++ b/project starter code/node_modules/@jimp/utils/CHANGELOG.md
@@ -1,3 +1,51 @@
+# v0.22.1 (Mon Feb 06 2023)
+
+#### 🏠 Internal
+
+- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.21.0 (Sun Feb 05 2023)
+
+### Release Notes
+
+#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
+
+Marking this as a "breaking release" because it might change what deps need to be installed.
+
+All modules should be exported as valid cjs and esm
+
+
+
+---
+
+#### 💥 Breaking Change
+
+- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
+# v0.16.3 (Sat Feb 04 2023)
+
+#### ⚠️ Pushed to `main`
+
+- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+#### Authors: 1
+
+- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
+
+---
+
# v0.11.0 (Fri May 15 2020)
#### 🚀 Enhancement
@@ -24,11 +72,11 @@
# v0.9.3 (Tue Nov 26 2019)
-#### 🐛 Bug Fix
+#### 🐛 Bug Fix
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
#### Authors: 2
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
\ No newline at end of file
+- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
diff --git a/project starter code/node_modules/@jimp/utils/README.md b/project starter code/node_modules/@jimp/utils/README.md
index 98cbfb74..51a52c4d 100644
--- a/project starter code/node_modules/@jimp/utils/README.md
+++ b/project starter code/node_modules/@jimp/utils/README.md
@@ -33,21 +33,24 @@ Scans through a region of the bitmap, calling a function for each pixel.
```js
function removeRed(image) {
- return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function(
- x,
- y,
- index
- ) {
- const red = this.bitmap.data[index + 0];
- const green = this.bitmap.data[index + 1];
- const blue = this.bitmap.data[index + 2];
- const alpha = this.bitmap.data[index + 3];
+ return scan(
+ image,
+ 0,
+ 0,
+ image.bitmap.width,
+ image.bitmap.height,
+ function (x, y, index) {
+ const red = this.bitmap.data[index + 0];
+ const green = this.bitmap.data[index + 1];
+ const blue = this.bitmap.data[index + 2];
+ const alpha = this.bitmap.data[index + 3];
- this.bitmap.data[index + 0] = 0;
- this.bitmap.data[index + 1] = green;
- this.bitmap.data[index + 2] = blue;
- this.bitmap.data[index + 3] = alpha;
- });
+ this.bitmap.data[index + 0] = 0;
+ this.bitmap.data[index + 1] = green;
+ this.bitmap.data[index + 2] = blue;
+ this.bitmap.data[index + 3] = alpha;
+ }
+ );
}
```
diff --git a/project starter code/node_modules/@jimp/utils/dist/index.js b/project starter code/node_modules/@jimp/utils/dist/index.js
index a3b9af90..f9a13154 100644
--- a/project starter code/node_modules/@jimp/utils/dist/index.js
+++ b/project starter code/node_modules/@jimp/utils/dist/index.js
@@ -1,114 +1,60 @@
"use strict";
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isNodePattern = isNodePattern;
-exports.throwError = throwError;
exports.scan = scan;
exports.scanIterator = scanIterator;
-
-var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
-
-var _marked =
-/*#__PURE__*/
-_regenerator["default"].mark(scanIterator);
-
+exports.throwError = throwError;
function isNodePattern(cb) {
- if (typeof cb === 'undefined') {
+ if (typeof cb === "undefined") {
return false;
}
-
- if (typeof cb !== 'function') {
- throw new TypeError('Callback must be a function');
+ if (typeof cb !== "function") {
+ throw new TypeError("Callback must be a function");
}
-
return true;
}
-
function throwError(error, cb) {
- if (typeof error === 'string') {
+ if (typeof error === "string") {
error = new Error(error);
}
-
- if (typeof cb === 'function') {
+ if (typeof cb === "function") {
return cb.call(this, error);
}
-
throw error;
}
-
function scan(image, x, y, w, h, f) {
// round input
x = Math.round(x);
y = Math.round(y);
w = Math.round(w);
h = Math.round(h);
-
- for (var _y = y; _y < y + h; _y++) {
- for (var _x = x; _x < x + w; _x++) {
- var idx = image.bitmap.width * _y + _x << 2;
+ for (let _y = y; _y < y + h; _y++) {
+ for (let _x = x; _x < x + w; _x++) {
+ const idx = image.bitmap.width * _y + _x << 2;
f.call(image, _x, _y, idx);
}
}
-
return image;
}
-
-function scanIterator(image, x, y, w, h) {
- var _y, _x, idx;
-
- return _regenerator["default"].wrap(function scanIterator$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- // round input
- x = Math.round(x);
- y = Math.round(y);
- w = Math.round(w);
- h = Math.round(h);
- _y = y;
-
- case 5:
- if (!(_y < y + h)) {
- _context.next = 17;
- break;
- }
-
- _x = x;
-
- case 7:
- if (!(_x < x + w)) {
- _context.next = 14;
- break;
- }
-
- idx = image.bitmap.width * _y + _x << 2;
- _context.next = 11;
- return {
- x: _x,
- y: _y,
- idx: idx,
- image: image
- };
-
- case 11:
- _x++;
- _context.next = 7;
- break;
-
- case 14:
- _y++;
- _context.next = 5;
- break;
-
- case 17:
- case "end":
- return _context.stop();
- }
+function* scanIterator(image, x, y, w, h) {
+ // round input
+ x = Math.round(x);
+ y = Math.round(y);
+ w = Math.round(w);
+ h = Math.round(h);
+ for (let _y = y; _y < y + h; _y++) {
+ for (let _x = x; _x < x + w; _x++) {
+ const idx = image.bitmap.width * _y + _x << 2;
+ yield {
+ x: _x,
+ y: _y,
+ idx,
+ image
+ };
}
- }, _marked);
+ }
}
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/utils/dist/index.js.map b/project starter code/node_modules/@jimp/utils/dist/index.js.map
index 14f767df..153b5a73 100644
--- a/project starter code/node_modules/@jimp/utils/dist/index.js.map
+++ b/project starter code/node_modules/@jimp/utils/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["scanIterator","isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width"],"mappings":";;;;;;;;;;;;;;;;6BAyCiBA,Y;;AAzCV,SAASC,aAAT,CAAuBC,EAAvB,EAA2B;AAChC,MAAI,OAAOA,EAAP,KAAc,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d,EAAkBD,EAAlB,EAAsBE,GAAtB;AACD;AACF;;AAED,SAAOV,KAAP;AACD;;AAEM,SAAUT,YAAV,CAAuBS,KAAvB,EAA8BC,CAA9B,EAAiCC,CAAjC,EAAoCC,CAApC,EAAuCC,CAAvC;AAAA;;AAAA;AAAA;AAAA;AAAA;AACL;AACAH,UAAAA,CAAC,GAAGK,IAAI,CAACC,KAAL,CAAWN,CAAX,CAAJ;AACAC,UAAAA,CAAC,GAAGI,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAJ;AACAC,UAAAA,CAAC,GAAGG,IAAI,CAACC,KAAL,CAAWJ,CAAX,CAAJ;AACAC,UAAAA,CAAC,GAAGE,IAAI,CAACC,KAAL,CAAWH,CAAX,CAAJ;AAESI,UAAAA,EAPJ,GAOSN,CAPT;;AAAA;AAAA,gBAOYM,EAAE,GAAGN,CAAC,GAAGE,CAPrB;AAAA;AAAA;AAAA;;AAQMK,UAAAA,EARN,GAQWR,CARX;;AAAA;AAAA,gBAQcQ,EAAE,GAAGR,CAAC,GAAGE,CARvB;AAAA;AAAA;AAAA;;AASKO,UAAAA,GATL,GASYV,KAAK,CAACW,MAAN,CAAaC,KAAb,GAAqBJ,EAArB,GAA0BC,EAA3B,IAAkC,CAT7C;AAAA;AAUD,iBAAM;AAAER,YAAAA,CAAC,EAAEQ,EAAL;AAASP,YAAAA,CAAC,EAAEM,EAAZ;AAAgBE,YAAAA,GAAG,EAAHA,GAAhB;AAAqBV,YAAAA,KAAK,EAALA;AAArB,WAAN;;AAVC;AAQ0BS,UAAAA,EAAE,EAR5B;AAAA;AAAA;;AAAA;AAOwBD,UAAAA,EAAE,EAP1B;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === 'undefined') {\n return false;\n }\n\n if (typeof cb !== 'function') {\n throw new TypeError('Callback must be a function');\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === 'string') {\n error = new Error(error);\n }\n\n if (typeof cb === 'function') {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width","scanIterator"],"sources":["../src/index.js"],"sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === \"undefined\") {\n return false;\n }\n\n if (typeof cb !== \"function\") {\n throw new TypeError(\"Callback must be a function\");\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === \"string\") {\n error = new Error(error);\n }\n\n if (typeof cb === \"function\") {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx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AC;MAC/CJ,CAAC,CAACP,IAAI,CAACE,KAAK,EAAES,EAAE,EAAED,EAAE,EAAEE,GAAG,CAAC;IAC5B;EACF;EAEA,OAAOV,KAAK;AACd;AAEO,UAAUa,YAAY,CAACb,KAAK,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAE;EAC/C;EACAH,CAAC,GAAGK,IAAI,CAACC,KAAK,CAACN,CAAC,CAAC;EACjBC,CAAC,GAAGI,IAAI,CAACC,KAAK,CAACL,CAAC,CAAC;EACjBC,CAAC,GAAGG,IAAI,CAACC,KAAK,CAACJ,CAAC,CAAC;EACjBC,CAAC,GAAGE,IAAI,CAACC,KAAK,CAACH,CAAC,CAAC;EAEjB,KAAK,IAAII,EAAE,GAAGN,CAAC,EAAEM,EAAE,GAAGN,CAAC,GAAGE,CAAC,EAAEI,EAAE,EAAE,EAAE;IACjC,KAAK,IAAIC,EAAE,GAAGR,CAAC,EAAEQ,EAAE,GAAGR,CAAC,GAAGE,CAAC,EAAEM,EAAE,EAAE,EAAE;MACjC,MAAMC,GAAG,GAAIV,KAAK,CAACW,MAAM,CAACC,KAAK,GAAGJ,EAAE,GAAGC,EAAE,IAAK,CAAC;MAC/C,MAAM;QAAER,CAAC,EAAEQ,EAAE;QAAEP,CAAC,EAAEM,EAAE;QAAEE,GAAG;QAAEV;MAAM,CAAC;IACpC;EACF;AACF"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/utils/es/index.js b/project starter code/node_modules/@jimp/utils/es/index.js
index a3b9af90..00a127b1 100644
--- a/project starter code/node_modules/@jimp/utils/es/index.js
+++ b/project starter code/node_modules/@jimp/utils/es/index.js
@@ -1,114 +1,51 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.isNodePattern = isNodePattern;
-exports.throwError = throwError;
-exports.scan = scan;
-exports.scanIterator = scanIterator;
-
-var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
-
-var _marked =
-/*#__PURE__*/
-_regenerator["default"].mark(scanIterator);
-
-function isNodePattern(cb) {
- if (typeof cb === 'undefined') {
+export function isNodePattern(cb) {
+ if (typeof cb === "undefined") {
return false;
}
-
- if (typeof cb !== 'function') {
- throw new TypeError('Callback must be a function');
+ if (typeof cb !== "function") {
+ throw new TypeError("Callback must be a function");
}
-
return true;
}
-
-function throwError(error, cb) {
- if (typeof error === 'string') {
+export function throwError(error, cb) {
+ if (typeof error === "string") {
error = new Error(error);
}
-
- if (typeof cb === 'function') {
+ if (typeof cb === "function") {
return cb.call(this, error);
}
-
throw error;
}
-
-function scan(image, x, y, w, h, f) {
+export function scan(image, x, y, w, h, f) {
// round input
x = Math.round(x);
y = Math.round(y);
w = Math.round(w);
h = Math.round(h);
-
- for (var _y = y; _y < y + h; _y++) {
- for (var _x = x; _x < x + w; _x++) {
- var idx = image.bitmap.width * _y + _x << 2;
+ for (let _y = y; _y < y + h; _y++) {
+ for (let _x = x; _x < x + w; _x++) {
+ const idx = image.bitmap.width * _y + _x << 2;
f.call(image, _x, _y, idx);
}
}
-
return image;
}
-
-function scanIterator(image, x, y, w, h) {
- var _y, _x, idx;
-
- return _regenerator["default"].wrap(function scanIterator$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- // round input
- x = Math.round(x);
- y = Math.round(y);
- w = Math.round(w);
- h = Math.round(h);
- _y = y;
-
- case 5:
- if (!(_y < y + h)) {
- _context.next = 17;
- break;
- }
-
- _x = x;
-
- case 7:
- if (!(_x < x + w)) {
- _context.next = 14;
- break;
- }
-
- idx = image.bitmap.width * _y + _x << 2;
- _context.next = 11;
- return {
- x: _x,
- y: _y,
- idx: idx,
- image: image
- };
-
- case 11:
- _x++;
- _context.next = 7;
- break;
-
- case 14:
- _y++;
- _context.next = 5;
- break;
-
- case 17:
- case "end":
- return _context.stop();
- }
+export function* scanIterator(image, x, y, w, h) {
+ // round input
+ x = Math.round(x);
+ y = Math.round(y);
+ w = Math.round(w);
+ h = Math.round(h);
+ for (let _y = y; _y < y + h; _y++) {
+ for (let _x = x; _x < x + w; _x++) {
+ const idx = image.bitmap.width * _y + _x << 2;
+ yield {
+ x: _x,
+ y: _y,
+ idx,
+ image
+ };
}
- }, _marked);
+ }
}
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/utils/es/index.js.map b/project starter code/node_modules/@jimp/utils/es/index.js.map
index 14f767df..dc3d73c3 100644
--- a/project starter code/node_modules/@jimp/utils/es/index.js.map
+++ b/project starter code/node_modules/@jimp/utils/es/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.js"],"names":["scanIterator","isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width"],"mappings":";;;;;;;;;;;;;;;;6BAyCiBA,Y;;AAzCV,SAASC,aAAT,CAAuBC,EAAvB,EAA2B;AAChC,MAAI,OAAOA,EAAP,KAAc,WAAlB,EAA+B;AAC7B,WAAO,KAAP;AACD;;AAED,MAAI,OAAOA,EAAP,KAAc,UAAlB,EAA8B;AAC5B,UAAM,IAAIC,SAAJ,CAAc,6BAAd,CAAN;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAASC,UAAT,CAAoBC,KAApB,EAA2BH,EAA3B,EAA+B;AACpC,MAAI,OAAOG,KAAP,KAAiB,QAArB,EAA+B;AAC7BA,IAAAA,KAAK,GAAG,IAAIC,KAAJ,CAAUD,KAAV,CAAR;AACD;;AAED,MAAI,OAAOH,EAAP,KAAc,UAAlB,EAA8B;AAC5B,WAAOA,EAAE,CAACK,IAAH,CAAQ,IAAR,EAAcF,KAAd,CAAP;AACD;;AAED,QAAMA,KAAN;AACD;;AAEM,SAASG,IAAT,CAAcC,KAAd,EAAqBC,CAArB,EAAwBC,CAAxB,EAA2BC,CAA3B,EAA8BC,CAA9B,EAAiCC,CAAjC,EAAoC;AACzC;AACAJ,EAAA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;AAAA;AAAA,gBAQcQ,EAAE,GAAGR,CAAC,GAAGE,CARvB;AAAA;AAAA;AAAA;;AASKO,UAAAA,GATL,GASYV,KAAK,CAACW,MAAN,CAAaC,KAAb,GAAqBJ,EAArB,GAA0BC,EAA3B,IAAkC,CAT7C;AAAA;AAUD,iBAAM;AAAER,YAAAA,CAAC,EAAEQ,EAAL;AAASP,YAAAA,CAAC,EAAEM,EAAZ;AAAgBE,YAAAA,GAAG,EAAHA,GAAhB;AAAqBV,YAAAA,KAAK,EAALA;AAArB,WAAN;;AAVC;AAQ0BS,UAAAA,EAAE,EAR5B;AAAA;AAAA;;AAAA;AAOwBD,UAAAA,EAAE,EAP1B;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === 'undefined') {\n return false;\n }\n\n if (typeof cb !== 'function') {\n throw new TypeError('Callback must be a function');\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === 'string') {\n error = new Error(error);\n }\n\n if (typeof cb === 'function') {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"file":"index.js"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width","scanIterator"],"sources":["../src/index.js"],"sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === \"undefined\") {\n return false;\n }\n\n if (typeof cb !== \"function\") {\n throw new TypeError(\"Callback must be a function\");\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === \"string\") {\n error = new Error(error);\n }\n\n if (typeof cb === \"function\") {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"mappings":"AAAA,OAAO,SAASA,aAAa,CAACC,EAAE,EAAE;EAChC,IAAI,OAAOA,EAAE,KAAK,WAAW,EAAE;IAC7B,OAAO,KAAK;EACd;EAEA,IAAI,OAAOA,EAAE,KAAK,UAAU,EAAE;IAC5B,MAAM,IAAIC,SAAS,CAAC,6BAA6B,CAAC;EACpD;EAEA,OAAO,IAAI;AACb;AAEA,OAAO,SAASC,UAAU,CAACC,KAAK,EAAEH,EAAE,EAAE;EACpC,IAAI,OAAOG,KAAK,KAAK,QAAQ,EAAE;IAC7BA,KAAK,GAAG,IAAIC,KAAK,CAACD,KAAK,CAAC;EAC1B;EAEA,IAAI,OAAOH,EAAE,KAAK,UAAU,EAAE;IAC5B,OAAOA,EAAE,CAACK,IAAI,CAAC,IAAI,EAAEF,KAAK,CAAC;EAC7B;EAEA,MAAMA,KAAK;AACb;AAE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,EAAEQ,EAAE,GAAGR,CAAC,GAAGE,CAAC,EAAEM,EAAE,EAAE,EAAE;MACjC,MAAMC,GAAG,GAAIV,KAAK,CAACW,MAAM,CAACC,KAAK,GAAGJ,EAAE,GAAGC,EAAE,IAAK,CAAC;MAC/C,MAAM;QAAER,CAAC,EAAEQ,EAAE;QAAEP,CAAC,EAAEM,EAAE;QAAEE,GAAG;QAAEV;MAAM,CAAC;IACpC;EACF;AACF"}
\ No newline at end of file
diff --git a/project starter code/node_modules/@jimp/utils/index.d.ts b/project starter code/node_modules/@jimp/utils/index.d.ts
index 79fbeaa4..612e9fce 100644
--- a/project starter code/node_modules/@jimp/utils/index.d.ts
+++ b/project starter code/node_modules/@jimp/utils/index.d.ts
@@ -1,9 +1,19 @@
-import { Image, Omit } from '@jimp/core';
-import { ThrowStatement } from 'typescript';
+import { Image, Omit } from "@jimp/core";
+import { ThrowStatement } from "typescript";
export function isNodePattern(cb: Function): true;
export function isNodePattern(cb: Omit): false;
-export function throwError(error: string | Error, cb?: (err: Error) => void): ThrowStatement;
+export function throwError(
+ error: string | Error,
+ cb?: (err: Error) => void
+): ThrowStatement;
-export function scan(image: Image, x: number, y: number, w: number, h: number, f: (image: Image, _x: number, _y: number, idx: number) => void): Image;
+export function scan(
+ image: Image,
+ x: number,
+ y: number,
+ w: number,
+ h: number,
+ f: (image: Image, _x: number, _y: number, idx: number) => void
+): Image;
diff --git a/project starter code/node_modules/@jimp/utils/package.json b/project starter code/node_modules/@jimp/utils/package.json
index f54b6b99..018d2d7c 100644
--- a/project starter code/node_modules/@jimp/utils/package.json
+++ b/project starter code/node_modules/@jimp/utils/package.json
@@ -1,10 +1,11 @@
{
"name": "@jimp/utils",
- "version": "0.16.2",
+ "version": "0.22.12",
"description": "Utils for jimp extensions.",
"main": "dist/index.js",
"module": "es/index.js",
"types": "index.d.ts",
+ "repository": "jimp-dev/jimp",
"scripts": {
"build": "npm run build:node:production && npm run build:module",
"build:watch": "npm run build:node:debug -- -- --watch --verbose",
@@ -20,8 +21,7 @@
"access": "public"
},
"dependencies": {
- "@babel/runtime": "^7.7.2",
"regenerator-runtime": "^0.13.3"
},
- "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4"
+ "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
}
diff --git a/project starter code/node_modules/@jimp/utils/src/index.js b/project starter code/node_modules/@jimp/utils/src/index.js
index 8f51fd35..723f2114 100644
--- a/project starter code/node_modules/@jimp/utils/src/index.js
+++ b/project starter code/node_modules/@jimp/utils/src/index.js
@@ -1,21 +1,21 @@
export function isNodePattern(cb) {
- if (typeof cb === 'undefined') {
+ if (typeof cb === "undefined") {
return false;
}
- if (typeof cb !== 'function') {
- throw new TypeError('Callback must be a function');
+ if (typeof cb !== "function") {
+ throw new TypeError("Callback must be a function");
}
return true;
}
export function throwError(error, cb) {
- if (typeof error === 'string') {
+ if (typeof error === "string") {
error = new Error(error);
}
- if (typeof cb === 'function') {
+ if (typeof cb === "function") {
return cb.call(this, error);
}
diff --git a/project starter code/node_modules/@tokenizer/token/README.md b/project starter code/node_modules/@tokenizer/token/README.md
new file mode 100644
index 00000000..1c1ba324
--- /dev/null
+++ b/project starter code/node_modules/@tokenizer/token/README.md
@@ -0,0 +1,19 @@
+[](https://www.npmjs.com/package/@tokenizer/token)
+[](https://npmcharts.com/compare/@tokenizer/token?interval=30)
+
+# @tokenizer/token
+
+TypeScript definition of an [strtok3](https://github.com/Borewit/strtok3) token.
+
+## Licence
+
+(The MIT License)
+
+Copyright (c) 2020 Borewit
+
+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/project starter code/node_modules/@tokenizer/token/index.d.ts b/project starter code/node_modules/@tokenizer/token/index.d.ts
new file mode 100644
index 00000000..d6c8122e
--- /dev/null
+++ b/project starter code/node_modules/@tokenizer/token/index.d.ts
@@ -0,0 +1,30 @@
+/**
+ * Read-only token
+ * See https://github.com/Borewit/strtok3 for more information
+ */
+export interface IGetToken {
+
+ /**
+ * Length of encoded token in bytes
+ */
+ len: number;
+
+ /**
+ * Decode value from buffer at offset
+ * @param array - Uint8Array to read the decoded value from
+ * @param offset - Decode offset
+ * @return decoded value
+ */
+ get(array: Array, offset: number): Value;
+}
+
+export interface IToken extends IGetToken {
+ /**
+ * Encode value to buffer
+ * @param array - Uint8Array to write the encoded value to
+ * @param offset - Buffer write offset
+ * @param value - Value to decode of type T
+ * @return offset plus number of bytes written
+ */
+ put(array: Array, offset: number, value: Value): number
+}
diff --git a/project starter code/node_modules/@tokenizer/token/package.json b/project starter code/node_modules/@tokenizer/token/package.json
new file mode 100644
index 00000000..ad87e5bb
--- /dev/null
+++ b/project starter code/node_modules/@tokenizer/token/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "@tokenizer/token",
+ "version": "0.3.0",
+ "description": "TypeScript definition for strtok3 token",
+ "main": "",
+ "types": "index.d.ts",
+ "files": [
+ "index.d.ts"
+ ],
+ "keywords": [
+ "token",
+ "interface",
+ "tokenizer",
+ "TypeScript"
+ ],
+ "author": {
+ "name": "Borewit",
+ "url": "https://github.com/Borewit"
+ },
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/Borewit/tokenizer-token.git"
+ },
+ "bugs": {
+ "url": "https://github.com/Borewit/tokenizer-token/issues"
+ },
+ "typeScriptVersion": "3.0",
+ "dependencies": {},
+ "devDependencies": {
+ "@types/node": "^13.1.0"
+ }
+}
diff --git a/project starter code/node_modules/@types/bluebird/LICENSE b/project starter code/node_modules/@types/bluebird/LICENSE
new file mode 100644
index 00000000..9e841e7a
--- /dev/null
+++ b/project starter code/node_modules/@types/bluebird/LICENSE
@@ -0,0 +1,21 @@
+ MIT License
+
+ Copyright (c) Microsoft Corporation.
+
+ 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/project starter code/node_modules/@types/bluebird/README.md b/project starter code/node_modules/@types/bluebird/README.md
new file mode 100644
index 00000000..4d164a60
--- /dev/null
+++ b/project starter code/node_modules/@types/bluebird/README.md
@@ -0,0 +1,15 @@
+# Installation
+> `npm install --save @types/bluebird`
+
+# Summary
+This package contains type definitions for bluebird (https://github.com/petkaantonov/bluebird).
+
+# Details
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bluebird.
+
+### Additional Details
+ * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
+ * Dependencies: none
+
+# Credits
+These definitions were written by [Leonard Hecker](https://github.com/lhecker).
diff --git a/project starter code/node_modules/@types/bluebird/index.d.ts b/project starter code/node_modules/@types/bluebird/index.d.ts
new file mode 100644
index 00000000..e52da821
--- /dev/null
+++ b/project starter code/node_modules/@types/bluebird/index.d.ts
@@ -0,0 +1,1365 @@
+/*!
+ * The code following this comment originates from:
+ * https://github.com/types/npm-bluebird
+ *
+ * Note for browser users: use bluebird-global typings instead of this one
+ * if you want to use Bluebird via the global Promise symbol.
+ *
+ * Licensed under:
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 unional
+ *
+ * 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.
+ */
+
+type Constructor = new(...args: any[]) => E;
+type CatchFilter = ((error: E) => boolean) | (object & E);
+type Resolvable = R | PromiseLike;
+type IterateFunction = (item: T, index: number, arrayLength: number) => Resolvable;
+
+type PromisifyAllKeys = T extends string ? `${T}Async` : never;
+type WithoutLast = T extends [...infer A, any] ? A : [];
+type Last = T extends [...any[], infer L] ? L : never;
+type ExtractCallbackValueType = T extends (error: any, ...data: infer D) => any ? D : never;
+
+type PromiseMethod = TReturn extends never ? never : (...args: WithoutLast) => Promise;
+
+type ExtractAsyncMethod = T extends (...args: infer A) => any
+ ? PromiseMethod>>[0]>
+ : never;
+
+type PromisifyAllItems = {
+ [K in keyof T as PromisifyAllKeys]: ExtractAsyncMethod;
+};
+
+type NonNeverValues = {
+ [K in keyof T as T[K] extends never ? never : K]: T[K];
+};
+
+// Drop `never` values
+type PromisifyAll = NonNeverValues> & T;
+
+declare class Bluebird implements PromiseLike, Bluebird.Inspection {
+ readonly [Symbol.toStringTag]: "Object";
+
+ /**
+ * Create a new promise. The passed in function will receive functions
+ * `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise.
+ *
+ * If promise cancellation is enabled, passed in function will receive
+ * one more function argument `onCancel` that allows to register an optional cancellation callback.
+ */
+ constructor(
+ callback: (
+ resolve: (thenableOrResult?: Resolvable) => void,
+ reject: (error?: any) => void,
+ onCancel?: (callback: () => void) => void,
+ ) => void,
+ );
+
+ /**
+ * Promises/A+ `.then()`. Returns a new promise chained from this promise.
+ *
+ * The new promise will be rejected or resolved depending on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
+ */
+ // Based on PromiseLike.then, but returns a Bluebird instance.
+ then(onFulfill?: (value: R) => Resolvable, onReject?: (error: any) => Resolvable): Bluebird; // For simpler signature help.
+ then(
+ onfulfilled?: ((value: R) => Resolvable) | null,
+ onrejected?: ((reason: any) => Resolvable) | null,
+ ): Bluebird;
+
+ /**
+ * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise.
+ *
+ * Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
+ *
+ * Alias `.caught();` for compatibility with earlier ECMAScript version.
+ */
+ catch(onReject: ((error: any) => Resolvable) | undefined | null): Bluebird;
+
+ /**
+ * This extends `.catch` to work more like catch-clauses in languages like Java or C#.
+ *
+ * Instead of manually checking `instanceof` or `.name === "SomeError"`,
+ * you may specify a number of error constructors which are eligible for this catch handler.
+ * The catch handler that is first met that has eligible constructors specified, is the one that will be called.
+ *
+ * This method also supports predicate-based filters.
+ * If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument.
+ * The return result of the predicate will be used determine whether the error handler should be called.
+ *
+ * Alias `.caught();` for compatibility with earlier ECMAScript version.
+ */
+ catch(
+ filter1: Constructor,
+ filter2: Constructor,
+ filter3: Constructor,
+ filter4: Constructor,
+ filter5: Constructor,
+ onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable,
+ ): Bluebird;
+
+ catch(
+ filter1: Constructor | CatchFilter,
+ filter2: Constructor | CatchFilter,
+ filter3: Constructor | CatchFilter,
+ filter4: Constructor | CatchFilter,
+ filter5: Constructor | CatchFilter,
+ onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable,
+ ): Bluebird;
+
+ catch(
+ filter1: Constructor,
+ filter2: Constructor,
+ filter3: Constructor,
+ filter4: Constructor,
+ onReject: (error: E1 | E2 | E3 | E4) => Resolvable,
+ ): Bluebird;
+
+ catch(
+ filter1: Constructor | CatchFilter,
+ filter2: Constructor | CatchFilter,
+ filter3: Constructor | CatchFilter,
+ filter4: Constructor | CatchFilter,
+ onReject: (error: E1 | E2 | E3 | E4) => Resolvable,
+ ): Bluebird;
+
+ catch(
+ filter1: Constructor,
+ filter2: Constructor,
+ filter3: Constructor,
+ onReject: (error: E1 | E2 | E3) => Resolvable,
+ ): Bluebird;
+
+ catch(
+ filter1: Constructor | CatchFilter,
+ filter2: Constructor | CatchFilter,
+ filter3: Constructor | CatchFilter,
+ onReject: (error: E1 | E2 | E3) => Resolvable,
+ ): Bluebird;
+
+ catch(
+ filter1: Constructor,
+ filter2: Constructor,
+ onReject: (error: E1 | E2) => Resolvable,
+ ): Bluebird;
+
+ catch(
+ filter1: Constructor | CatchFilter,
+ filter2: Constructor | CatchFilter,
+ onReject: (error: E1 | E2) => Resolvable,
+ ): Bluebird;
+
+ catch(
+ filter1: Constructor,
+ onReject: (error: E1) => Resolvable,
+ ): Bluebird;
+
+ catch(
+ // tslint:disable-next-line:unified-signatures
+ filter1: Constructor | CatchFilter,
+ onReject: (error: E1) => Resolvable,
+ ): Bluebird;
+
+ /**
+ * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise.
+ *
+ * Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
+ *
+ * Alias `.caught();` for compatibility with earlier ECMAScript version.
+ */
+ caught: Bluebird["catch"];
+
+ /**
+ * Like `.catch` but instead of catching all types of exceptions,
+ * it only catches those that don't originate from thrown errors but rather from explicit rejections.
+ */
+ error(onReject: (reason: any) => Resolvable): Bluebird;
+
+ /**
+ * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise.
+ *
+ * There are special semantics for `.finally()` in that the final value cannot be modified from the handler.
+ *
+ * Alias `.lastly();` for compatibility with earlier ECMAScript version.
+ */
+ finally(handler: () => Resolvable): Bluebird;
+
+ lastly: Bluebird["finally"];
+
+ /**
+ * Create a promise that follows this promise, but is bound to the given `thisArg` value.
+ * A bound promise will call its handlers with the bound value set to `this`.
+ *
+ * Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise.
+ */
+ bind(thisArg: any): Bluebird;
+
+ /**
+ * Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error.
+ */
+ done(onFulfilled?: (value: R) => Resolvable, onRejected?: (error: any) => Resolvable): void;
+
+ /**
+ * Like `.finally()`, but not called for rejections.
+ */
+ tap(onFulFill: (value: R) => Resolvable): Bluebird;
+
+ /**
+ * Like `.catch()` but rethrows the error
+ */
+ tapCatch(onReject: (error?: any) => Resolvable): Bluebird;
+
+ tapCatch(
+ filter1: Constructor,
+ filter2: Constructor,
+ filter3: Constructor,
+ filter4: Constructor,
+ filter5: Constructor,
+ onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable,
+ ): Bluebird;
+ tapCatch(
+ filter1: Constructor | CatchFilter,
+ filter2: Constructor | CatchFilter,
+ filter3: Constructor | CatchFilter,
+ filter4: Constructor | CatchFilter,
+ filter5: Constructor | CatchFilter,
+ onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable,
+ ): Bluebird;
+ tapCatch(
+ filter1: Constructor,
+ filter2: Constructor,
+ filter3: Constructor,
+ filter4: Constructor,
+ onReject: (error: E1 | E2 | E3 | E4) => Resolvable,
+ ): Bluebird;
+ tapCatch(
+ filter1: Constructor | CatchFilter,
+ filter2: Constructor | CatchFilter,
+ filter3: Constructor | CatchFilter,
+ filter4: Constructor | CatchFilter,
+ onReject: (error: E1 | E2 | E3 | E4) => Resolvable,
+ ): Bluebird;
+ tapCatch(
+ filter1: Constructor,
+ filter2: Constructor,
+ filter3: Constructor,
+ onReject: (error: E1 | E2 | E3) => Resolvable,
+ ): Bluebird;
+ tapCatch(
+ filter1: Constructor | CatchFilter,
+ filter2: Constructor | CatchFilter,
+ filter3: Constructor | CatchFilter,
+ onReject: (error: E1 | E2 | E3) => Resolvable,
+ ): Bluebird;
+ tapCatch(
+ filter1: Constructor,
+ filter2: Constructor,
+ onReject: (error: E1 | E2) => Resolvable,
+ ): Bluebird;
+ tapCatch(
+ filter1: Constructor | CatchFilter,
+ filter2: Constructor | CatchFilter,
+ onReject: (error: E1 | E2) => Resolvable,
+ ): Bluebird;
+ tapCatch(
+ filter1: Constructor,
+ onReject: (error: E1) => Resolvable,
+ ): Bluebird;
+ tapCatch(
+ // tslint:disable-next-line:unified-signatures
+ filter1: Constructor | CatchFilter,
+ onReject: (error: E1) => Resolvable,
+ ): Bluebird;
+
+ /**
+ * Same as calling `Promise.delay(ms, this)`.
+ */
+ delay(ms: number): Bluebird;
+
+ /**
+ * Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason.
+ * However, if this promise is not fulfilled or rejected within ms milliseconds, the returned promise
+ * is rejected with a TimeoutError or the error as the reason.
+ *
+ * You may specify a custom error message with the `message` parameter.
+ */
+ timeout(ms: number, message?: string | Error): Bluebird;
+
+ /**
+ * Register a node-style callback on this promise.
+ *
+ * When this promise is is either fulfilled or rejected,
+ * the node callback will be called back with the node.js convention
+ * where error reason is the first argument and success value is the second argument.
+ *
+ * The error argument will be `null` in case of success.
+ * If the `callback` argument is not a function, this method does not do anything.
+ */
+ nodeify(callback: (err: any, value?: R) => void, options?: Bluebird.SpreadOption): this;
+ nodeify(...sink: any[]): this;
+ asCallback(callback: (err: any, value?: R) => void, options?: Bluebird.SpreadOption): this;
+ asCallback(...sink: any[]): this;
+
+ /**
+ * See if this `promise` has been fulfilled.
+ */
+ isFulfilled(): boolean;
+
+ /**
+ * See if this `promise` has been rejected.
+ */
+ isRejected(): boolean;
+
+ /**
+ * See if this `promise` is still defer.
+ */
+ isPending(): boolean;
+
+ /**
+ * See if this `promise` has been cancelled.
+ */
+ isCancelled(): boolean;
+
+ /**
+ * See if this `promise` is resolved -> either fulfilled or rejected.
+ */
+ isResolved(): boolean;
+
+ /**
+ * Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet.
+ *
+ * throws `TypeError`
+ */
+ value(): R;
+
+ /**
+ * Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet.
+ *
+ * throws `TypeError`
+ */
+ reason(): any;
+
+ /**
+ * Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of
+ * the promise as snapshotted at the time of calling `.reflect()`.
+ */
+ reflect(): Bluebird>;
+
+ /**
+ * This is a convenience method for doing:
+ *
+ *
+ * promise.then(function(obj){
+ * return obj[propertyName].call(obj, arg...);
+ * });
+ *
+ */
+ call(
+ this: Bluebird,
+ propertyName: U,
+ ...args: any[]
+ ): Bluebird any ? ReturnType : never>;
+
+ /**
+ * This is a convenience method for doing:
+ *
+ *
+ * promise.then(function(obj){
+ * return obj[propertyName];
+ * });
+ *
+ */
+ get(key: U): Bluebird;
+
+ /**
+ * Convenience method for:
+ *
+ *
+ * .then(function() {
+ * return value;
+ * });
+ *
+ *
+ * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()`
+ *
+ * Alias `.thenReturn();` for compatibility with earlier ECMAScript version.
+ */
+ return(): Bluebird;
+ return(value: U): Bluebird;
+ thenReturn(): Bluebird;
+ thenReturn(value: U): Bluebird;
+
+ /**
+ * Convenience method for:
+ *
+ *
+ * .then(function() {
+ * throw reason;
+ * });
+ *
+ * Same limitations apply as with `.return()`.
+ *
+ * Alias `.thenThrow();` for compatibility with earlier ECMAScript version.
+ */
+ throw(reason: Error): Bluebird;
+ thenThrow(reason: Error): Bluebird;
+
+ /**
+ * Convenience method for:
+ *
+ *
+ * .catch(function() {
+ * return value;
+ * });
+ *
+ *
+ * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.catchReturn()`
+ */
+ catchReturn(value: U): Bluebird;
+
+ // No need to be specific about Error types in these overrides, since there's no handler function
+ catchReturn