Skip to content

Commit

Permalink
fix: use object destruction instead of Object.assign
Browse files Browse the repository at this point in the history
  • Loading branch information
arlac77 committed May 24, 2019
1 parent ff1feca commit 39f4fc6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/context.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export async function loadPackage(dir) {
return JSON.parse(await fs.promises.readFile(pkgFile, utf8StreamOptions));
}

/**
* Used as a reference throuhout the runtime of the npm-pkgbuild
* @param {string} dir
* @param {Object} properties
*/
export async function createContext(dir, properties = {}) {
Object.keys(properties).forEach(k => {
if (properties[k] === undefined) {
Expand All @@ -17,10 +22,10 @@ export async function createContext(dir, properties = {}) {

const pkg = await loadPackage(dir);

properties = Object.assign({ arch: "any", installdir: "", pkgver: pkg.version }, pkg, properties);
properties = { arch: "any", installdir: "", pkgver: pkg.version, ...pkg, ...properties };

function evaluate(expression) {
let value = properties[expression];
const value = properties[expression];
return value;
}

Expand Down

0 comments on commit 39f4fc6

Please sign in to comment.