manipulating object? Nah, thats eazy!
BREAKING CHANGE when migrating from @cupglassdev/object. refCompare
was renamed to compareRef
You can install this in Node! (Yes, without transpilling) By running
$ npx jsr add @dunno/object
Or in Yarn
$ yarn dlx jsr add @dunno/object
Or in pnpm
$ pnpm dlx jsr add @dunno/object
Or in Deno (they provide their built in JSR system, so just do this)
$ deno add jsr:@dunno/object
Or in Bun
$ bunx jsr add @dunno/object
By 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 on the 'Links' section)
This package is licensed under MIT. You can see at LICENSE
- Repository https://github.com/teamdunno/object
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))