GithubHelp home page GithubHelp logo

ljharb / find-value-locations Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 116 KB

Given an object, and a value, return a tuple of the property name, and the object on which it is an own property.

License: MIT License

JavaScript 100.00%
javascript find value prototype locations property

find-value-locations's Introduction

find-value-locations Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Given an object, and a value, return a tuple of the property name, the object on which it is an own property, and the property descriptor.

Works with string keys, Symbol keys, both enumerable and non-enumerable keys, and crawls up the prototype chain to find the exact object it's located on.

Example

var findValue = require('find-value-locations');
var assert = require('assert');

var value = {};

function Foo() {}
function Bar() {}
function Baz() {}

Object.prototype.property = value;
Function.prototype.property = value;

Bar.prototype = Baz;

Foo.prototype = new Bar();
Foo.prototype.property = value;
var symbol = Symbol('a symbol property');
Foo.prototype[symbol] = value;

var tuples = findValue(new Foo(), value);

assert.deepEqual(tuples, [
	[Foo.prototype, 'property', Object.getOwnPropertyDescriptor(Foo.prototype, 'property')],
	[Foo.prototype, symbol, Object.getOwnPropertyDescriptor(Foo.prototype, symbol)],
	[Function.prototype, 'property', Object.getOwnPropertyDescriptor(Function.prototype, 'property')],
	[Object.prototype, 'property', Object.getOwnPropertyDescriptor(Object.prototype, 'property')]
]);

Tests

Simply clone the repo, npm install, and run npm test

find-value-locations's People

Contributors

ljharb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kalanathushara

find-value-locations's Issues

An in-range update of eslint is breaking the build ๐Ÿšจ

Version 3.19.0 of eslint just got published.

Branch Build failing ๐Ÿšจ
Dependency eslint
Current Version 3.18.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช


Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes v3.19.0
  • e09132f Fix: no-extra-parens false positive with exports and object literals (#8359) (Teddy Katz)
  • 91baed4 Update: allow custom messages in no-restricted-syntax (fixes #8298) (#8357) (Vitor Balocco)
  • 35c93e6 Fix: prevent space-before-function-paren from checking type annotations (#8349) (Teddy Katz)
  • 3342e9f Fix: don't modify operator precedence in operator-assignment autofixer (#8358) (Teddy Katz)
  • f88375f Docs: clarify that no-unsafe-negation is in eslint:recommended (#8371) (Teddy Katz)
  • 02f0d27 Docs: Add soda0289 to Development Team (#8367) (Kai Cataldo)
  • 155424c Fix: ignore empty path in patterns (fixes #8362) (#8364) (alberto)
  • 27616a8 Fix: prefer-const false positive with object spread (fixes #8187) (#8297) (Vitor Balocco)
  • 8569a90 Docs: add note about git's linebreak handling to linebreak-style docs (#8361) (Teddy Katz)
  • 5878593 Chore: fix invalid syntax in no-param-reassign test (#8360) (Teddy Katz)
  • 1b1046b Fix: don't classify plugins that throw errors as "missing" (fixes #6874) (#8323) (Teddy Katz)
  • 29f4ba5 Fix: no-useless-computed-key invalid autofix for getters and setters (#8335) (Teddy Katz)
  • 0541eaf Fix: no-implicit-coercion invalid autofix with consecutive identifiers (#8340) (Teddy Katz)
  • 41b9786 Fix: no-extra-parens false positive with objects following arrows (#8339) (Teddy Katz)
  • 3146167 Fix: eslint.verify should not mutate config argument (fixes #8329) (#8334) (alberto)
  • 927de90 Fix: dot-notation autofix produces invalid syntax for integer properties (#8332) (Teddy Katz)
  • a9d1bea Fix: comma-style autofix produces errors on parenthesized elements (#8331) (Teddy Katz)
  • d52173f Fix: don't generate invalid options in config-rule (#8326) (Teddy Katz)
  • 6eda3b5 Fix: no-extra-parens invalid autofix in for-of statements (#8337) (Teddy Katz)
  • 6c819d8 Fix: dot-notation autofix produces errors on parenthesized computed keys (#8330) (Teddy Katz)
  • 2d883d7 Fix: object-shorthand autofix produces errors on parenthesized functions (#8328) (Teddy Katz)
  • cd9b774 Fix: quotes false positive with backtick option in method names (#8327) (Teddy Katz)
  • d064ba2 Fix: no-else-return false positive for ifs in single-statement position (#8338) (Teddy Katz)
  • 6a718ba Chore: enable max-statements-per-line on ESLint codebase (#8321) (Teddy Katz)
  • 614b62e Chore: update sinon calls to deprecated API. (#8310) (alberto)
  • 0491572 Chore: use precalculated counts in codeframe formatter (#8296) (Vitor Balocco)
  • 8733e6a Chore: Fix incorrect error location properties in tests (#8307) (alberto)
  • c4ffb49 Chore: Fix typos in test option assertions (#8305) (Teddy Katz)
  • 79a97cb Upgrade: devDependencies (#8303) (alberto)
  • e4da200 Upgrade: Mocha to 3.2.0 (#8299) (Ilya Volodin)
  • 2f144ca Fix: operator-assignment autofix errors with parentheses (fixes #8293) (#8294) (Teddy Katz)
  • 7521cd5 Chore: update token logic in rules to use ast-utils (#8288) (Teddy Katz)
  • 9b509ce Chore: refactor space-before-function-paren rule (#8284) (Teddy Katz)
  • ddc6350 Fix: no-param-reassign false positive on destructuring (fixes #8279) (#8281) (Teddy Katz)
  • f8176b3 Chore: improve test coverage for node-event-generator (#8287) (Teddy Katz)
  • 602e9c2 Docs: fix incorrect selector examples (#8278) (Teddy Katz)
Commits

The new version differs by 38 commits .

  • 421aab4 3.19.0
  • 26a4dd5 Build: changelog update for 3.19.0
  • e09132f Fix: no-extra-parens false positive with exports and object literals (#8359)
  • 91baed4 Update: allow custom messages in no-restricted-syntax (fixes #8298) (#8357)
  • 35c93e6 Fix: prevent space-before-function-paren from checking type annotations (#8349)
  • 3342e9f Fix: don't modify operator precedence in operator-assignment autofixer (#8358)
  • f88375f Docs: clarify that no-unsafe-negation is in eslint:recommended (#8371)
  • 02f0d27 Docs: Add soda0289 to Development Team (#8367)
  • 155424c Fix: ignore empty path in patterns (fixes #8362) (#8364)
  • 27616a8 Fix: prefer-const false positive with object spread (fixes #8187) (#8297)
  • 8569a90 Docs: add note about git's linebreak handling to linebreak-style docs (#8361)
  • 5878593 Chore: fix invalid syntax in no-param-reassign test (#8360)
  • 1b1046b Fix: don't classify plugins that throw errors as "missing" (fixes #6874) (#8323)
  • 29f4ba5 Fix: no-useless-computed-key invalid autofix for getters and setters (#8335)
  • 0541eaf Fix: no-implicit-coercion invalid autofix with consecutive identifiers (#8340)

There are 38 commits in total. See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of eslint is breaking the build ๐Ÿšจ

Version 4.11.0 of eslint was just published.

Branch Build failing ๐Ÿšจ
Dependency eslint
Current Version 4.10.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes v4.11.0
  • d4557a6 Docs: disallow use of the comma operator using no-restricted-syntax (#9585) (่–›ๅฎš่ฐ”็š„็Œซ)
  • d602f9e Upgrade: espree v3.5.2 (#9611) (Kai Cataldo)
  • 4def876 Chore: avoid handling rules instances in config-validator (#9364) (Teddy Katz)
  • fe5ac7e Chore: fix incorrect comment in safe-emitter.js (#9605) (Teddy Katz)
  • 6672fae Docs: Fixed a typo on lines-between-class-members doc (#9603) (Moinul Hossain)
  • 980ecd3 Chore: Update copyright and license info (#9599) (่–›ๅฎš่ฐ”็š„็Œซ)
  • cc2c7c9 Build: use Node 8 in appveyor (#9595) (่–›ๅฎš่ฐ”็š„็Œซ)
  • 2542f04 Docs: Add missing options for lines-around-comment (#9589) (Clรฉment Fiorio)
  • b6a7490 Build: ensure fuzzer tests get run with npm test (#9590) (Teddy Katz)
  • 1073bc5 Build: remove shelljs-nodecli (refs #9533) (#9588) (Teddy Katz)
  • 7e3bf6a Fix: edge-cases of semi-style (#9560) (Toru Nagashima)
  • e5a37ce Fix: object-curly-newline for flow code (#9458) (Tiddo Langerak)
  • 9064b9c Chore: add equalTokens in ast-utils. (#9500) (่–›ๅฎš่ฐ”็š„็Œซ)
  • b7c5b19 Fix: Correct [object Object] output of error.data. (#9561) (Jonathan Pool)
  • 51c8cf0 Docs: Disambiguate definition of Update tag (#9584) (Jonathan Pool)
  • afc3c75 Docs: clarify what eslint-config-eslint is (#9582) (Teddy Katz)
  • aedae9d Docs: fix spelling in valid-typeof example (#9574) (Maksim Degtyarev)
  • 4c5aaf3 Docs: Fix typo in no-underscore-dangle rule (#9567) (Fabien Lucas)
  • 3623600 Chore: upgrade [email protected] (#9557) (่–›ๅฎš่ฐ”็š„็Œซ)
  • 1b606cd Chore: Remove an indirect dependency on jsonify (#9444) (Rouven WeรŸling)
  • 4d7d7ab Update: Resolve npm installed formatters (#5900) (#9464) (Tom Erik Stรธwer)
  • accc490 Fix: Files with no failures get "passing" testcase (#9547) (Samuel Levy)
  • ab0f66d Docs: Add examples to better show rule coverage. (#9548) (Jonathan Pool)
  • 88d2303 Chore: Add object-property-newline tests to increase coverage. (#9553) (Jonathan Pool)
  • 7f37b1c Build: test Node 9 on Travis (#9556) (Teddy Katz)
  • acccfbd Docs: Minor rephrase in no-invalid-this. (#9542) (Francisc)
  • 8f9c0fe Docs: improve id-match usage advice (#9544) (Teddy Katz)
  • a9606a3 Fix: invalid tests with super (fixes #9539) (#9545) (Teddy Katz)
  • 8e1a095 Chore: enable a modified version of multiline-comment-style on codebase (#9452) (Teddy Katz)
  • cb60285 Chore: remove commented test for HTML formatter (#9532) (Teddy Katz)
  • 06b491e Docs: fix duplicate entries in changelog (#9530) (Teddy Katz)
  • 2224733 Chore: use eslint-plugin-rulesdir instead of --rulesdir for self-linting (#9164) (Teddy Katz)
  • 9cf4ebe Docs: add .md to link(for github users) (#9529) (่–›ๅฎš่ฐ”็š„็Œซ)
Commits

The new version differs by 35 commits.

  • 1a9a6a5 4.11.0
  • ef4d268 Build: changelog update for 4.11.0
  • d4557a6 Docs: disallow use of the comma operator using no-restricted-syntax (#9585)
  • d602f9e Upgrade: espree v3.5.2 (#9611)
  • 4def876 Chore: avoid handling rules instances in config-validator (#9364)
  • fe5ac7e Chore: fix incorrect comment in safe-emitter.js (#9605)
  • 6672fae Docs: Fixed a typo on lines-between-class-members doc (#9603)
  • 980ecd3 Chore: Update copyright and license info (#9599)
  • cc2c7c9 Build: use Node 8 in appveyor (#9595)
  • 2542f04 Docs: Add missing options for lines-around-comment (#9589)
  • b6a7490 Build: ensure fuzzer tests get run with npm test (#9590)
  • 1073bc5 Build: remove shelljs-nodecli (refs #9533) (#9588)
  • 7e3bf6a Fix: edge-cases of semi-style (#9560)
  • e5a37ce Fix: object-curly-newline for flow code (#9458)
  • 9064b9c Chore: add equalTokens in ast-utils. (#9500)

There are 35 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of semver is breaking the build ๐Ÿšจ

Version 5.4.0 of semver just got published.

Branch Build failing ๐Ÿšจ
Dependency semver
Current Version 5.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As semver is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช

Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 16 commits.

  • e1c49c8 v5.4.0
  • 3ebc11d more test coverage
  • 5b30513 speed up tests a lot, add coverage
  • e1668ce add top level intersects function
  • 6cb2bcb intersection: use semver.version, not semver.raw
  • 4bacbfa Make exposed apis more clear
  • 8b86a26 Reduce line length and remove unused platform parameter
  • 99f133e Add range and comparator intersection docs to README
  • afbe8ca Move methods to comparator and range
  • 67c9ed7 Add support for range and comparators comparison
  • caeeac4 remove 0.x from Travis, cache npm stuff, use containers
  • bdda1a4 Add Node.js 8 to .travis.yml
  • 8fff305 Add node 6 to travis
  • aaba710 Added syntax highlighting to readme example
  • 32802c5 minimize heap allocations for maxSatisfying/minSatisfying

There are 16 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of tape is breaking the build ๐Ÿšจ

Version 4.7.0 of tape just got published.

Branch Build failing ๐Ÿšจ
Dependency tape
Current Version 4.6.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As tape is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช

Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 19 commits.

  • 1d0df26 v4.7.0
  • 51597e2 Merge pull request #374 from feross/master
  • b06f914 [Refactor] instead of throwing on undefined.forEach, throw explicitly.
  • dd93216 [Fix] fix spurious "test exited without ending"
  • 1a8e936 [Deps] update glob, resolve
  • 7eb9e36 [Dev Deps] update falafel, js-yaml
  • e030260 [Tests] on node v8; no need for sudo; v0.8 passes now; allow v5/v7/iojs to fail.
  • 4375661 [Tests] npm v5+ breaks on node < v4
  • df48bfa Only apps should have lock files.
  • 35e47e1 [Tests] npm v4.6+ breaks on node < v1
  • dc1ffa5 [Deps] update object-inspect
  • 66519cb [Deps] update resolve
  • e6d4625 [Dev Deps] update concat-stream, js-yaml
  • bdf2b04 tap-min moved to derhuerst/tap-min
  • 8b3a77e [Tests] fix thrower stack in node 0.8

There are 19 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Pending Approval

These branches will be created by Renovate only once you click their checkbox below.

  • [Deps] Update Update eslint to v8.57.0
  • [Deps] Update Update eslint to v9
  • [Deps] Update Update nyc to v15
  • [Deps] Update Update actions/checkout action to v4
  • ๐Ÿ” Create all pending approval PRs at once ๐Ÿ”

Detected dependencies

github-actions
.github/workflows/node-aught.yml
.github/workflows/node-pretest.yml
.github/workflows/node-tens.yml
.github/workflows/rebase.yml
  • actions/checkout v3
.github/workflows/require-allow-edits.yml
npm
package.json
  • call-bind ^1.0.2
  • for-each ^0.3.3
  • object-is ^1.1.5
  • protochain ^1.0.5
  • reflect.ownkeys ^1.1.3
  • safe-array-concat ^1.0.0
  • @ljharb/eslint-config ^21.0.1
  • aud ^2.0.2
  • auto-changelog ^2.4.0
  • eslint =8.8.0
  • npmignore ^0.3.0
  • nyc ^10.3.2
  • object.assign ^4.1.4
  • safe-publish-latest ^2.0.0
  • tape ^5.6.3
  • node >= 0.4

  • Check this box to trigger a request for Renovate to run again on this repository

An in-range update of covert is breaking the build ๐Ÿšจ

The devDependency covert was updated from 1.1.0 to 1.1.1.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

covert is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 3 commits.

  • b2f79d7 v1.1.1
  • db3d7f8 Only apps should have lockfiles
  • ffa04cf [Deps] update browserify, coverify, parents, minimist, resolve

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of tape is breaking the build ๐Ÿšจ

The devDependency tape was updated from 4.9.1 to 4.9.2.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

tape is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 11 commits.

  • a1e8f7e v4.9.2
  • 4b9c951 [Dev Deps] update eslint, eclint
  • 9ced991 [Fix] notEqual and notDeepEqual show "expected" value on failure
  • 75c467e [Docs] Updated readme to make test, test.only and test.skip consistent.
  • 1225d01 Merge pull request #450 from axelpale/patch-1
  • f53e3f1 Clarify doesNotThrow parameters
  • 96de340 Adding tap-junit
  • b1df632 [readme] Change broken image to use web archive
  • 5f1c5a2 [Docs] cleanup from #439
  • 6c633d0 Merge pull request #439 from abelmokadem/master
  • 4337f58 Convert list of tap reporters to links

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of nsp is breaking the build ๐Ÿšจ

Version 2.7.0 of nsp just got published.

Branch Build failing ๐Ÿšจ
Dependency nsp
Current Version 2.6.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As nsp is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช

Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 13 commits.

  • e88fb8a 2.7.0
  • f207e03 fix package.json so things actually work
  • 11d5635 Merge pull request #178 from nodesecurity/quiet-flag
  • cf32c95 remove unused code
  • 5ee23ec Merge pull request #164 from dblandin/devon/update-dockerfile
  • c41e59d Pick Lint
  • a9491bd Add quiet to --output usage
  • 215432f add quiet output
  • c20afb3 drone config
  • d9ba63b Update Dockerfile
  • 73c321d Merge pull request #158 from koresar/patch-1
  • 904dc3e Make sure the table width is a minimum width
  • da2b275 Fix nsp CLI crash in the no window (CI) envs

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of replace is breaking the build ๐Ÿšจ

The devDependency replace was updated from 1.0.0 to 1.0.1.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

replace is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 2 commits.

  • 86fc01b Merge pull request #1 from bnjmnt4n/yargs
  • 4d1c5bf Replace nomnom with yargs.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.