object-walker-js

1.1.8 • Public • Published

ObjectWalker - Js 🚶‍♂️

Description 📝

Object-Walker-Js is a simple command that lets you search for any object in any other object. Without dependencies, it is a simple and efficient tool to search for objects in objects.

Installation 📦

Library 📚

$ npm install object-walker-js

Binary 📦

Local 🏠

$ npm install object-walker-js
[...]
$ ./node_modules/.bin/object-walker-js --help
Usage: node index.js [options]
Options:
    --h, --help           Display help
    --type                Type of source object
    --target              Target object
    --targetType          Target type of object target, must be:
                          object, function, string, number, boolean, symbol, bigint, any
    --depth               Depth of the search (default: 5)
    --disable-TypeError   Disable TypeError message

Global 🌐

$ sudo npm install -g object-walker-js
[...]
$ object-walker-js --help
Usage: node index.js [options]
Options:
    --h, --help           Display help
    --type                Type of source object
    --target              Target object
    --targetType          Target type of object target, must be:
                          object, function, string, number, boolean, symbol, bigint, any
    --depth               Depth of the search (default: 5)
    --disable-TypeError   Disable TypeError message

Exemple 🎁

Binary 🏹

[!TIP] The --target is evaluated with the eval function, so you can use any valid JavaScript expression.

Type Object 🪙

$ object-walker-js --type '({})' --target '__proto__' --targetType "object" --depth 50
--- Properties and methods of ({}) ---
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.toString.__defineSetter__.hasOwnProperty.__lookupGetter__.__lookupSetter__.isPrototypeOf.propertyIsEnumerable.toString.valueOf.toLocaleString.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.toString.__defineSetter__.hasOwnProperty.__lookupGetter__.__lookupSetter__.isPrototypeOf.propertyIsEnumerable.toString.valueOf.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.toString.__defineSetter__.hasOwnProperty.__lookupGetter__.__lookupSetter__.isPrototypeOf.propertyIsEnumerable.toString.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.toString.__defineSetter__.hasOwnProperty.__lookupGetter__.__lookupSetter__.isPrototypeOf.propertyIsEnumerable.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.toString.__defineSetter__.hasOwnProperty.__lookupGetter__.__lookupSetter__.isPrototypeOf.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.toString.__defineSetter__.hasOwnProperty.__lookupGetter__.__lookupSetter__.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.toString.__defineSetter__.hasOwnProperty.__lookupGetter__.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.toString.__defineSetter__.hasOwnProperty.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.toString.__defineSetter__.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.toString.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.call.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.bind.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.apply.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.prototype.__proto__
[+] ({}).constructor.prototype.__defineGetter__.constructor.__proto__
[+] ({}).constructor.prototype.__defineGetter__.__proto__
[+] ({}).constructor.prototype.__proto__
[+] ({}).constructor.assign.__proto__
[+] ({}).constructor.getOwnPropertyDescriptor.__proto__
[+] ({}).constructor.getOwnPropertyDescriptors.__proto__
[+] ({}).constructor.getOwnPropertyNames.__proto__
[+] ({}).constructor.getOwnPropertySymbols.__proto__
[+] ({}).constructor.hasOwn.__proto__
[+] ({}).constructor.is.__proto__
[+] ({}).constructor.preventExtensions.__proto__
[+] ({}).constructor.seal.__proto__
[+] ({}).constructor.create.__proto__
[+] ({}).constructor.defineProperties.__proto__
[+] ({}).constructor.defineProperty.__proto__
[+] ({}).constructor.freeze.__proto__
[+] ({}).constructor.getPrototypeOf.__proto__
[+] ({}).constructor.setPrototypeOf.__proto__
[+] ({}).constructor.isExtensible.__proto__
[+] ({}).constructor.isFrozen.__proto__
[+] ({}).constructor.isSealed.__proto__
[+] ({}).constructor.keys.__proto__
[+] ({}).constructor.entries.__proto__
[+] ({}).constructor.fromEntries.__proto__
[+] ({}).constructor.values.__proto__
[+] ({}).constructor.__proto__
[+] ({}).__proto__

Type Module 📦

$ object-walker-js --type 'import("fs")' --target 'toString' --targetType "function" --depth 500
[/] --- Properties and methods of import("fs") ---
[+] import("fs").Dir.prototype.read.constructor.prototype.apply.bind.call.toString
[+] import("fs").Dir.prototype.read.constructor.prototype.apply.bind.call.toString.toString
[+] import("fs").Dir.prototype.read.constructor.prototype.apply.bind.call.toString.constructor.prototype.__defineGetter__.toString        
[+] import("fs").Dir.prototype.read.constructor.prototype.apply.bind.call.toString.constructor.prototype.__defineGetter__.__defineSetter__.toString
[+] import("fs").Dir.prototype.read.constructor.prototype.apply.bind.call.toString.constructor.prototype.__defineGetter__.__defineSetter__.hasOwnProperty.toString
[+] import("fs").Dir.prototype.read.constructor.prototype.apply.bind.call.toString.constructor.prototype.__defineGetter__.__defineSetter__.hasOwnProperty.__lookupGetter__.toString
[...]

Library 📚

import { ObjectWalker } from 'object-walker-js';

const type = {};
const target = 'constructor';
const targetType = 'function';
const depth = 5;
const visited = new WeakSet();
const name = '{}';
const displayTypeError = false;
const uniqueProps = ObjectWalker(type, target, targetType, depth, visited, name, displayTypeError);
uniqueProps.forEach(prop => {
   console.log(prop);
});

License 📜

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i object-walker-js

Weekly Downloads

15

Version

1.1.8

License

MIT

Unpacked Size

38.7 kB

Total Files

20

Last publish

Collaborators

  • mistrale