Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dotty

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotty - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

LICENSE

83

lib/index.js

@@ -16,3 +16,3 @@ //

var exists = module.exports.exists = function exists(object, path) {
var exists = (module.exports.exists = function exists(object, path) {
if (typeof path === "string") {

@@ -39,3 +39,3 @@ path = path.split(".");

}
};
});

@@ -47,3 +47,3 @@ //

// `undefined` if it can't be found. This means you won't be able to tell
// the difference between an unresolved path and an undefined property, so you
// the difference between an unresolved path and an undefined property, so you
// should not use `get` to check for the existence of a property. Use `exists`

@@ -53,3 +53,3 @@ // instead.

var get = module.exports.get = function get(object, path) {
var get = (module.exports.get = function get(object, path) {
if (typeof path === "string") {

@@ -78,3 +78,3 @@ path = path.split(".");

}
};
});

@@ -93,3 +93,3 @@ //

var search = module.exports.search = function search(object, path, action) {
var search = (module.exports.search = function search(object, path, action) {
if (typeof path === "string") {

@@ -120,13 +120,22 @@ path = path.split(".");

if (path.length === 0) {
return Object.keys(object).filter(key.test.bind(key)).map(function(k) {
var value = object[k];
if(action){
action(value, object, k);
}
return value;
});
return Object.keys(object)
.filter(key.test.bind(key))
.map(function (k) {
var value = object[k];
if (action) {
action(value, object, k);
}
return value;
});
} else {
return Array.prototype.concat.apply([], Object.keys(object).filter(key.test.bind(key)).map(function(k) { return search(object[k], path, action); }));
return Array.prototype.concat.apply(
[],
Object.keys(object)
.filter(key.test.bind(key))
.map(function (k) {
return search(object[k], path, action);
})
);
}
};
});

@@ -138,8 +147,11 @@ //

var removeSearch = module.exports.removeSearch = function removeSearch(object, path){
search(object, path, function(value, object, key){
var removeSearch = (module.exports.removeSearch = function removeSearch(
object,
path
) {
search(object, path, function (value, object, key) {
delete object[key];
});
return object;
};
});

@@ -158,3 +170,3 @@ //

var put = module.exports.put = function put(object, path, value) {
var put = (module.exports.put = function put(object, path, value) {
if (typeof path === "string") {

@@ -167,3 +179,3 @@ path = path.split(".");

}
path = path.slice();

@@ -173,6 +185,5 @@

if (typeof object !== "object" || object === null) {
if (typeof object !== "object" || object === null || key === "__proto__") {
return false;
}
if (path.length === 0) {

@@ -191,3 +202,3 @@ object[key] = value;

}
};
});

@@ -201,3 +212,3 @@ //

var remove = module.exports.remove = function remove(object, path, value) {
var remove = (module.exports.remove = function remove(object, path, value) {
if (typeof path === "string") {

@@ -210,3 +221,3 @@ path = path.split(".");

}
path = path.slice();

@@ -231,3 +242,3 @@

}
};
});

@@ -249,3 +260,7 @@ //

var deepKeys = module.exports.deepKeys = function deepKeys(object, options, prefix) {
var deepKeys = (module.exports.deepKeys = function deepKeys(
object,
options,
prefix
) {
options = options || {};

@@ -269,3 +284,9 @@

if (typeof object[k] === "object" && object[k] !== null) {
keys = keys.concat(deepKeys(object[k], {leavesOnly: options.leavesOnly}, prefix.concat([k])));
keys = keys.concat(
deepKeys(
object[k],
{ leavesOnly: options.leavesOnly },
prefix.concat([k])
)
);
}

@@ -275,6 +296,8 @@ }

if (options.asStrings) {
keys = keys.map(function(e) { return e.join("."); });
keys = keys.map(function (e) {
return e.join(".");
});
}
return keys;
};
});
{
"name": "dotty",
"version": "0.1.0",
"version": "0.1.1",
"description": "Access properties of nested objects using dot-path notation",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -0,0 +0,0 @@ Dotty [![build status](https://secure.travis-ci.org/deoxxa/dotty.png)](http://travis-ci.org/deoxxa/dotty) [![npm](https://img.shields.io/npm/v/dotty.svg)](https://www.npmjs.com/package/dotty)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc