GitXplorerGitXplorer
d

dotty

public
127 stars
20 forks
12 issues

Commits

List of commits on branch master.
Verified
82981051d757d298eafc700ab2e133c107dc41c7

Fix documentation and contact links (#36)

jjinhei committed 2 years ago
Verified
c20f9186c0bbd4d235c86ba8da007b4018bb46a0

Add a security.md file (#33)

sstramel committed 3 years ago
Verified
88f61860dcc274a07a263c32cbe9d44c24ef02d7

Address different method of prototype pollution (#32)

sstramel committed 3 years ago
Unverified
5dc501fa6deef75da25a7c306dd911641d255a1a

Fix status badge

committed 4 years ago
Verified
643ec751a1f9c3521007508bbb683cfdf9568c86

Bump highlight.js from 9.12.0 to 10.5.0 (#27)

ddependabot[bot] committed 4 years ago
Verified
3f0843fb3fe0ca4b6a4bc785bdfcb8b0d1ef9611

Bump marked from 0.3.16 to 1.2.7 (#28)

ddependabot[bot] committed 4 years ago

README

The README file for this repository.

Dotty Build and Test npm

Access properties of nested objects using dot-path notation.

Overview

Dotty makes it easy to programmatically access arbitrarily nested objects and their properties.

Installation

Here's a link to the npm page.

npm install dotty

Usage

Also see the documentation and example.

var dotty = require("dotty");

var object = {
  a: {
    b: {
      x: "y",
    },
    c: {
      x: "z",
    },
  },
};

console.log(dotty.exists(object, "a.b.x")); // true
console.log(dotty.exists(object, ["a", "b", "x"])); // true
console.log(dotty.exists(object, "a.b.z")); // false
console.log(dotty.exists(object, ["a", "b", "z"])); // false

console.log(dotty.get(object, "a.b.x")); // "y"
console.log(dotty.get(object, ["a", "b", "x"])); // "y"
console.log(dotty.get(object, "a.b.z")); // undefined
console.log(dotty.get(object, ["a", "b", "z"])); // undefined

dotty.put(object, "a.b.hello", "hi");
dotty.put(object, ["a", "c", "yo"], "sup");

console.log(dotty.search(object, "a.b.*"));
console.log(dotty.search(object, ["a", "b", "*"]));
console.log(dotty.search(object, "a.*.x"));
console.log(dotty.search(object, ["a", "*", "x"]));
console.log(dotty.search(object, ["a", "*", /..+/]));
console.log(
  dotty.search(object, "a.b.*", function (value, parent, key) {
    parent[key] = value + "!";
  })
);

console.log(dotty.remove(object, "a.b.x"));
console.log(dotty.remove(object, "a.b.y"));

console.log(dotty.removeSearch(object, "a.*.x"));

console.log(dotty.deepKeys(object));
console.log(dotty.deepKeys(object, { leavesOnly: true }));
console.log(dotty.deepKeys(object, { leavesOnly: true, asStrings: true }));

console.log(object);

License

3-clause BSD. A copy is included with the source.

Contact