manipulating object? Nah, thats eazy!
This includes type-checking at runtime, so when you compare these objects, you are very VERY safe!
Unlike Valibot, Zod and others, this only checks types at JS. Some functions are supported to return as full Typescript types
Details
- Added
SeeMakerclass for typechecking at JS, including; - Addded function
SeeMaker.see()or defaultsee()function, so you can access.check(),.checkAsync(),.into(),.intoAsync() - Added
typerto work on typechecking at JS - Added
withTyperfortyperwrapper forSeeMaker.see()
You can do that by checking the main branch of Object.js, and get the raw link
https://raw.githubusercontent.com/teamdunno/object/refs/heads/main/Object.js
or just download the release and get the Object.js file
You can install this in Node! (Yes, without transpiling manually) By running
$ npx jsr add @dunno/objectOr in Yarn
$ yarn dlx jsr add @dunno/objectOr in pnpm
$ pnpm dlx jsr add @dunno/objectOr in Deno (they provide their built in JSR system, so just do this)
$ deno add jsr:@dunno/objectOr in Bun
$ bunx jsr add @dunno/objectBy default, the module dosent have a default export. You can do it like this
import * as obj from "@dunno/object";Or for Deno users
import * as obj from "jsr:@dunno/object";If you want to report a bug, or suggestion, make a new issue under our repository (see Links)
This package is licensed under MIT. You can see at LICENSE
- Repository https://github.com/teamdunno/object
- JSR page https://jsr.io/@dunno/object
- Live Playground: https://dash.deno.com/playground/dunno-object-example
You can also see our live playground (see Links)
import * as obj from "@dunno/object";
// This is our reference one
const helloArray = ["Hello"];
// This variable just re-forwards the reference one
const hiArray = helloArray;
// The output should be `true`
console.log(obj.compareRef(helloArray, hiArray));import * as obj from "@dunno/object";
// This is our reference one
const helloArray = ["Hello"];
/*
This is our reference two
(because it dosent re-forward reference one
like we do in the first example)
*/
const hiArray = ["Hello"];
/*
The output should be `false`.
Even though the value are exactly same
*/
console.log(obj.compareRef(helloArray, hiArray));import * as obj from "@dunno/object";
// make a new, normal array
const test = ["Hello"];
/*
The output should be `true`,
because its using the normal Array class
*/
console.log(obj.isLiteralArray(test));
// The output should be `false`
console.log(obj.isExtendedArray(test));import * as obj from "@dunno/object";
// make a new Int16Array
const test = new Int16Array([8]);
// The output should be `false`
console.log(obj.isLiteralArray(test));
/*
The output should be `true`,
because its not a standard array class
*/
console.log(obj.isExtendedArray(test));