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

x/ayonli_jsext/object/index.ts

A JavaScript extension package for building strong and modern applications.
Latest
import * as ayonliJsext from "https://deno.land/x/ayonli_jsext@v0.9.72/object/index.ts";

Functions for dealing with objects.

Functions

Checks if the value is an instance of the given type, returns the value itself if passed, otherwise returns null. This function is mainly used for the optional chaining syntax.

Compares two values, returns -1 if a < b, 0 if a === b and 1 if a > b. If the values are not comparable, a TypeError is thrown.

Performs a deep comparison between two values to see if they are equivalent or contain the same data.

Returns a new record with all entries of the given record except the ones that do not match the given predicate.

Create an object with flatted keys of the original object, the children nodes' properties will be transformed to a string-represented path.

Returns true if the specified object has the indicated property as its own property. If the property is inherited, or does not exist, the function returns false.

Returns true if the specified object has the indicated method as its own method (in its own prototype). If the method is inherited, or is not in the prototype, or does not exist, this function returns false.

Composes a new record with all keys and values inverted.

Returns true is the given value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.

Returns true if the given value is valid. The following values are considered invalid:

Applies the given transformer to all entries in the given record and returns a new record containing the results.

Creates an object composed without the picked keys.

Returns a tuple of two records with the first one containing all entries of the given record that match the given predicate and the second one containing all that do not.

Copies the key-value pairs that are presented in the source objects but are missing in the target object into the target, later pairs are skipped if the same key already exists.

Creates an object composed of the picked keys.

Creates an object base on the original object but without any invalid values (except for null), and trims the value if it's a string.

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

Returns a string representation or the constructor of the value's type.