Skip to content

Commit

Permalink
fix syntax/lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nbubna committed Dec 26, 2024
1 parent 0ef2405 commit 582a86c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/store.deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
*
* Status: ALPHA - currently only supports get
*/
; (function (_) {
;(function(_) {

// save original core accessor
var _get = _.get;
// replace with enhanced version
_.get = function (area, key, kid) {
_.get = function(area, key, kid) {
var s = _get(area, key);
if (s == null) {
var parts = _.split(key);
Expand All @@ -31,20 +31,20 @@
val = _.resolvePath(val, kid);
s = _.stringify(val);
} catch (e) {
console.error("Error accessing nested property:", e);
window.console.error("Error accessing nested property:", e);
return null;
}
}
return s;
};

// Helper function to resolve nested paths safely
_.resolvePath = function (obj, path) {
return path.split('.').reduce((acc, key) => acc && acc[key], obj);
_.resolvePath = function(obj, path) {
return path.split('.').reduce(function(acc, key) { return acc && acc[key]; }, obj);
};

// expose internals on the underscore to allow extensibility
_.split = function (key) {
_.split = function(key) {
var dot = key.lastIndexOf('.');
if (dot > 0) {
var kid = key.substring(dot + 1, key.length);
Expand Down

0 comments on commit 582a86c

Please sign in to comment.