diff --git a/package.json b/package.json index a449367b..fdc2b9ba 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,10 @@ "dependencies": { "foreman": "^2.0.0", "json-server": "^0.9.4", + "prop": "^0.1.1", "react": "^15.3.2", - "react-dom": "^15.3.2" + "react-dom": "^15.3.2", + "types": "^0.1.1" }, "scripts": { "start": "nf start", @@ -24,5 +26,5 @@ "test": "npm run lint && react-scripts test --env=jsdom", "eject": "react-scripts eject" }, - "proxy" : "http://localhost:3001" + "proxy": "http://localhost:3001" } diff --git a/src/App.js b/src/App.js deleted file mode 100644 index 0042c777..00000000 --- a/src/App.js +++ /dev/null @@ -1,19 +0,0 @@ -import React from "react"; -import logo from "./logo.svg"; -import "./App.css"; - -function App() { - return ( -
- To get started, edit src/App.js and save to reload.
-
{user.firstName}
+ ); + })} +{user.firstName}
+// ); +// })} +//{firstName}
+{lastName}
+{phone}
+{address}
+{occupation}
+ index.js | |
|---|---|
| Dotty makes it easy to programmatically access arbitrarily nested objects and +their properties. | |
|
Returns | var exists = module.exports.exists = function exists(object, path) {
+ if (typeof path === "string") {
+ path = path.split(".");
+ }
+
+ if (!(path instanceof Array) || path.length === 0) {
+ return false;
+ }
+
+ path = path.slice();
+
+ var key = path.shift();
+
+ if (typeof object !== "object" || object === null) {
+ return false;
+ }
+
+ if (path.length === 0) {
+ return Object.hasOwnProperty.apply(object, [key]);
+ } else {
+ return exists(object[key], path);
+ }
+}; |
| These arguments are the same as those for The return value, however, is the property you're trying to access, or
+ | var get = module.exports.get = function get(object, path) {
+ if (typeof path === "string") {
+ path = path.split(".");
+ }
+
+ if (!(path instanceof Array) || path.length === 0) {
+ return;
+ }
+
+ path = path.slice();
+
+ var key = path.shift();
+
+ if (typeof object !== "object" || object === null) {
+ return;
+ }
+
+ if (path.length === 0) {
+ return object[key];
+ }
+
+ if (path.length) {
+ return get(object[key], path);
+ }
+}; |
| Arguments are similar to The return value is an array of values where the key path matches the +specified criterion. If none match, an empty array will be returned. | var search = module.exports.search = function search(object, path) {
+ if (typeof path === "string") {
+ path = path.split(".");
+ }
+
+ if (!(path instanceof Array) || path.length === 0) {
+ return;
+ }
+
+ path = path.slice();
+
+ var key = path.shift();
+
+ if (typeof object !== "object" || object === null) {
+ return;
+ }
+
+ if (key === "*") {
+ key = ".*";
+ }
+
+ if (typeof key === "string") {
+ key = new RegExp(key);
+ }
+
+ if (path.length === 0) {
+ return Object.keys(object).filter(key.test.bind(key)).map(function(k) { return object[k]; });
+ } else {
+ return Array.prototype.concat.apply([], Object.keys(object).filter(key.test.bind(key)).map(function(k) { return search(object[k], path); }));
+ }
+}; |
| The first two arguments for The third argument is a value to The return value is | var put = module.exports.put = function put(object, path, value) {
+ if (typeof path === "string") {
+ path = path.split(".");
+ }
+
+ if (!(path instanceof Array) || path.length === 0) {
+ return false;
+ }
+
+ path = path.slice();
+
+ var key = path.shift();
+
+ if (typeof object !== "object" || object === null) {
+ return false;
+ }
+
+ if (path.length === 0) {
+ object[key] = value;
+ } else {
+ if (typeof object[key] === "undefined") {
+ object[key] = {};
+ }
+
+ if (typeof object[key] !== "object" || object[key] === null) {
+ return false;
+ }
+
+ return put(object[key], path, value);
+ }
+};
+
+ |