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

camel-dot-prop-immutable

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

camel-dot-prop-immutable - npm Package Compare versions

Comparing version 1.3.2 to 1.4.0

13

dist/index.js

@@ -31,3 +31,12 @@ "use strict";

function camelCombos(prop) {
let regexes = [/\.\w/, /\.[^.]+$/];
if (Array.isArray(prop)) {
prop = prop.map(p => p.replace(".", "\\."));
prop = prop.join(".");
}
return camelStringCombos(prop);
}
function camelStringCombos(prop) {
let regexes = [/[^\\]\.\w/, /[^\\]\.[^.]+$/];
let combos = { [prop]: null };

@@ -40,3 +49,3 @@ let ogProp = prop;

do {
prop = prop.replace(regex, match => match.charAt(1).toUpperCase() + match.slice(2));
prop = prop.replace(regex, match => match.charAt(0) + match.charAt(2).toUpperCase() + match.slice(3));
combos[prop] = null;

@@ -43,0 +52,0 @@ } while (prop.match(regex));

@@ -19,3 +19,12 @@ import dot from "dot-prop-immutable"

function camelCombos(prop) {
let regexes = [/\.\w/, /\.[^.]+$/]
if (Array.isArray(prop)) {
prop = prop.map(p => p.replace(".", "\\."))
prop = prop.join(".")
}
return camelStringCombos(prop)
}
function camelStringCombos(prop) {
let regexes = [/[^\\]\.\w/, /[^\\]\.[^.]+$/]
let combos = { [prop]: null }

@@ -31,3 +40,5 @@ let ogProp = prop

match =>
match.charAt(1).toUpperCase() + match.slice(2)
match.charAt(0) +
match.charAt(2).toUpperCase() +
match.slice(3)
)

@@ -34,0 +45,0 @@ combos[prop] = null

2

package.json
{
"name": "camel-dot-prop-immutable",
"version": "1.3.2",
"version": "1.4.0",
"description":

@@ -5,0 +5,0 @@ "dot-prop-immutable w/ check for flattened props",

@@ -22,2 +22,10 @@ import dot from "../dist"

).toBe("unicorn")
expect(
dot.get({ foo: { barBuzz: "unicorn" } }, [
"foo",
"bar",
"buzz",
])
).toBe("unicorn")
})

@@ -43,2 +51,12 @@

})
expect(
dot.set(
{ "foo.fuu": { barBuzz: "a" } },
["foo.fuu", "bar", "buzz"],
"b"
)
).toEqual({
"foo.fuu": { barBuzz: "b" },
})
})

@@ -45,0 +63,0 @@

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