Skip to content

Commit

Permalink
refactor: use object.entries (#1446)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk authored May 21, 2022
1 parent 969b37c commit 7b25196
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
44 changes: 21 additions & 23 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
"@babel/register": "^7.17.7",
"archiver": "^5.3.1",
"copyfiles": "^2.4.1",
"eslint": "^8.15.0",
"eslint": "^8.16.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.25.4",
Expand Down
8 changes: 4 additions & 4 deletions src/lambda/LambdaFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '../config/index.js'
import { createUniqueId, splitHandlerPathAndName } from '../utils/index.js'

const { keys } = Object
const { entries } = Object
const { ceil } = Math

export default class LambdaFunction {
Expand Down Expand Up @@ -242,14 +242,14 @@ export default class LambdaFunction {
const zip = await jszip.loadAsync(data)

return Promise.all(
keys(zip.files).map(async (filename) => {
const fileData = await zip.files[filename].async('nodebuffer')
entries(zip.files).map(async ([filename, jsZipObj]) => {
const fileData = await jsZipObj.async('nodebuffer')
if (filename.endsWith('/')) {
return Promise.resolve()
}
await ensureDir(join(this.#codeDir, dirname(filename)))
return writeFile(join(this.#codeDir, filename), fileData, {
mode: zip.files[filename].unixPermissions,
mode: jsZipObj.unixPermissions,
})
}),
)
Expand Down

0 comments on commit 7b25196

Please sign in to comment.