From c33df3147f0741cfb9ddc30e9f3b5601ffc6ecbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Am=C3=A9rico?= Date: Wed, 5 Dec 2018 22:10:09 -0300 Subject: [PATCH] Re-add keysIn module fixing baseClone and baseMerge (#4099) (#4100) --- keysIn.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 keysIn.js diff --git a/keysIn.js b/keysIn.js new file mode 100644 index 000000000..7ac244d24 --- /dev/null +++ b/keysIn.js @@ -0,0 +1,32 @@ +/** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ +function keysIn(object) { + const result = [] + for (key in object) { + result.push(key) + } + return result +} + +export default keysIn +