Skip to content

Commit

Permalink
Clone Triennial aliyotMap since hebcal-web will mutate the results
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Sep 23, 2022
1 parent 4a0f952 commit bf97993
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hebcal/triennial",
"version": "1.0.3",
"version": "1.0.4",
"description": "Javascript Triennial Torah Readings",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down Expand Up @@ -58,7 +58,7 @@
"eslint-config-google": "^0.14.0",
"jsdoc": "^3.6.11",
"jsdoc-to-markdown": "^7.1.1",
"rollup": "^2.79.0",
"rollup": "^2.79.1",
"rollup-plugin-terser": "^7.0.2"
}
}
3 changes: 2 additions & 1 deletion src/triennial.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export class Triennial {
* @return {Object<string,Aliyah>} a map of aliyot 1-7 plus "M"
*/
getReading(parsha, yearNum) {
// don't use clone() here because we want to preserve HDate objects
const reading = shallowCopy({}, this.readings[parsha][yearNum]);
if (reading.aliyot) {
Object.values(reading.aliyot).map((aliyah) => calculateNumVerses(aliyah));
Expand Down Expand Up @@ -376,7 +377,7 @@ export function getTriennialForParshaHaShavua(ev) {
if (typeof reading !== 'object') {
throw new ReferenceError(`Can't load reading for ${name} in ${hyear} (year number ${yearNum})`);
}
const aliyotMap = shallowCopy({}, reading.aliyot);
const aliyotMap = clone(reading.aliyot);
// possibly replace 7th aliyah and/or maftir
const reason = {};
specialReadings(hd, false, aliyotMap, reason, parsha);
Expand Down

0 comments on commit bf97993

Please sign in to comment.