tamb / object-bystring Goto Github PK
View Code? Open in Web Editor NEWAccess and alter deeply nested object properties by string notation
License: MIT License
Access and alter deeply nested object properties by string notation
License: MIT License
Write the code to be more legible.
I strongly suggest you work on your code's legibility. I assume you're a relatively junior developer.
Making code terse (almost "leetcode") might sound cool in principle, but it's incredibly hard to read. So, please name variables in a way that's clear what they are. Single-letter variables aren't helping with performance in any way and just make things harder.
s = s.toString().replace(/^./, ""); I get regex's are cool, but you could just do if (s[0] == '.') { s = s.slice(1); }. Much easier to read (many devs hate regexs) and possibly faster too
There's no attribution to the original source for the code.
I tried the demo attached to your readme. This works as expected, where when I provide an accessor I get it's associated value. The project available on NPM however, does not work this way.
Consider the following object:
{
person: {
name: "Joe",
age: 33,
}
}
Expected result for accessor person.name
is Joe
as a string. Actual result was an object like { name: Joe }
.
Create UMD to not clutter the Object.prototype
. This should simply export a utility method.
UMD utility : object-bystring/util
Polyfill: object-bystring
UMD should export polyfill in object and util by default.
THIS IS A BREAKING CHANGE.
end results should be
// default util
import byString from 'object-bystring';
// polyfill
import { byStringPolyfill } from 'object-bystring';
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.