Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/esm/object.js>sortKeys

A JavaScript extension package for building strong and modern applications.
Latest
function sortKeys
import { sortKeys } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/object.js";

Creates an object with sorted keys (in ascending order) of the original object.

NOTE: Symbol keys are not sorted and remain their original order.

NOTE: This function only operates on plain objects and arrays.

Examples

Example 1

import { sortKeys } from "@ayonli/jsext/object";

const obj = sortKeys({ foo: "Hello", bar: "World" });

console.log(JSON.stringify(obj)); // { "bar": "World", "foo": "Hello" }

Parameters

obj
optional
deep = [UNSUPPORTED]