From 7ce7615257b421294660943f2f0d6a8ee41f4d19 Mon Sep 17 00:00:00 2001 From: alper-batioglu Date: Tue, 29 Sep 2020 18:04:55 +0300 Subject: [PATCH] isShorthandProperty lookup perf. improvement Isn't key lookup faster than extracting all keys and checking them one by one, at least for a pure json object ? --- src/isShorthandProperty.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/isShorthandProperty.js b/src/isShorthandProperty.js index 4389f3d..3321cc0 100644 --- a/src/isShorthandProperty.js +++ b/src/isShorthandProperty.js @@ -6,5 +6,5 @@ const shortHandProperties = require('./formatted-data/shorthand-properties.json' * @returns {boolean} - true if property is a shorthand, false otherwise */ module.exports = function isShorthandProperty(property) { - return Object.keys(shortHandProperties).includes(property); + return shortHandProperties[property] != undefined; };