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

a-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-toolbox - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

25

main.js

@@ -337,2 +337,3 @@ /* global Blob File FormData $ */

* get value in object using a flat key
* @todo check params
* @param {object} obj

@@ -353,2 +354,26 @@ * @param {string} fkey

return _walk
},
/**
* set value in object using a flat key
* @todo check params
* @param {object} obj
* @param {string} fkey
* @param {*} val
* @example tools.object.setByFlatKey({}, 'a.b.c', 1) >> { a: { b: {c: 1} } }
*/
setByFlatKey: function (obj, fkey, val) {
let _path = fkey.split('.')
let _walk = obj
for (let i = 0; i < _path.length; i++) {
if (!_walk[_path[i]]) {
// if it's the last step, add key as undefined
if (i === _path.length - 1) {
_walk[_path[i]] = undefined
return
}
_walk[_path[i]] = {}
}
_walk = _walk[_path[i]]
}
_walk = val
}

@@ -355,0 +380,0 @@ },

2

package.json
{
"name": "a-toolbox",
"version": "0.1.3",
"version": "0.1.4",
"description": "basic lightweight tools",

@@ -5,0 +5,0 @@ "main": "main.js",

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