refactor: small perf win by eliminating string object keys

This commit is contained in:
Steven Arcangeli 2023-06-25 10:14:28 -07:00
parent db60c32d93
commit 4a4e0f4013
12 changed files with 151 additions and 111 deletions

View file

@ -1,6 +1,13 @@
local config = require("oil.config")
local constants = require("oil.constants")
local M = {}
local FIELD_ID = constants.FIELD_ID
local FIELD_NAME = constants.FIELD_NAME
local FIELD_TYPE = constants.FIELD_TYPE
local FIELD_META = constants.FIELD_META
---@param url string
---@return nil|string
---@return nil|string
@ -84,12 +91,11 @@ end
---@param entry oil.InternalEntry
---@return oil.Entry
M.export_entry = function(entry)
local FIELD = require("oil.constants").FIELD
return {
name = entry[FIELD.name],
type = entry[FIELD.type],
id = entry[FIELD.id],
meta = entry[FIELD.meta],
name = entry[FIELD_NAME],
type = entry[FIELD_TYPE],
id = entry[FIELD_ID],
meta = entry[FIELD_META],
}
end