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 ( -
-
- logo -

Welcome to React

-
-

- To get started, edit src/App.js and save to reload. -

-
- ); -} - -export default App; diff --git a/src/App.css b/src/components/App.css similarity index 78% rename from src/App.css rename to src/components/App.css index 15adfdc7..5ab4f866 100644 --- a/src/App.css +++ b/src/components/App.css @@ -22,3 +22,10 @@ from { transform: rotate(0deg); } to { transform: rotate(360deg); } } + +.Grey-back { + background-color: #999; + height: 70px; + color: blue; + padding-top: 10px; +} diff --git a/src/components/App.js b/src/components/App.js new file mode 100644 index 00000000..d4aa9373 --- /dev/null +++ b/src/components/App.js @@ -0,0 +1,31 @@ +import React from "react"; +import logo from "./logo.svg"; +import "./App.css"; +import ListOfUsers from "./ListOfUsers"; +import UserDetails from "./UserDetails"; +import PropTypes from "prop-types"; + + + +function App(props) { + + return ( +
+
+ logo +
+
+

User List

+ +

User Details


+ +
+
+ ); +} + +App.propTypes = { + arrayOfUsers: PropTypes.array +}; + +export default App; diff --git a/src/App.test.js b/src/components/App.test.js similarity index 100% rename from src/App.test.js rename to src/components/App.test.js diff --git a/src/components/Button.js b/src/components/Button.js new file mode 100644 index 00000000..c326b0ee --- /dev/null +++ b/src/components/Button.js @@ -0,0 +1,15 @@ +import React, {Component} from "react"; + +class Button extends Component { + constructor() { + super(); + } + + render() { + return ( + + ); + } +} + +export default Button; diff --git a/src/components/Component2.js b/src/components/Component2.js new file mode 100644 index 00000000..603a23d4 --- /dev/null +++ b/src/components/Component2.js @@ -0,0 +1,12 @@ +import React from "react"; + + +export default class Component2 extends React.Component { + render() { + return ( +
+

Component2

+
+ ); + } +} diff --git a/src/components/ListOfUsers.js b/src/components/ListOfUsers.js new file mode 100644 index 00000000..cdbf55a8 --- /dev/null +++ b/src/components/ListOfUsers.js @@ -0,0 +1,61 @@ +import React, {Component} from "react"; +import PropTypes from "prop-types"; + +class ListOfUsers extends Component { + constructor(props) { + super(props); + this.state = { + buttonClicked: false + }; + } + + handleUserClick(event) { + console.log("Handle Click", event); + + this.setState({ + buttonClicked: !this.state.buttonClicked + }); + } + + render() { + if (!this.state.buttonClicked) { + return ( +
+
+ {this.props.arrayOfUsers.map(user => { + return ( +

{user.firstName}

+ ); + })} +
+ ); + } + return ( +
+ +
+ ); + } +} + +// commented out old functional component once class component was built +// function ListOfUsers(props) { +// return ( +//
+//
+// {props.arrayOfUsers.map(user => { +// return ( +//

{user.firstName}

+// ); +// })} +//
+// ); +// } + +ListOfUsers.propTypes = { + arrayOfUsers: PropTypes.array.isRequired +}; + +export default ListOfUsers; diff --git a/src/components/UserDetails.js b/src/components/UserDetails.js new file mode 100644 index 00000000..4939508a --- /dev/null +++ b/src/components/UserDetails.js @@ -0,0 +1,30 @@ +import React from "react"; +import * as Helpers from "../constants"; +import PropTypes from "prop-types"; + + +function UserDetails(props) { + // const selectUser = (array, index) => array[index]; + // commented out and saved in my "constants" folder + const {firstName, lastName, phone, address, occupation, avatar} = + Helpers.selectUser(props.arrayOfUsers, 0); + return ( +
+ +

{firstName}

+

{lastName}

+

{phone}

+

{address}

+

{occupation}

+
+ ); +} + +UserDetails.propTypes = { + arrayOfUsers: PropTypes.shape({ + firstName: PropTypes.string.isRequired, + lastName: PropTypes.string.isRequired, + }) +}; + +export default UserDetails; diff --git a/src/logo.svg b/src/components/logo.svg similarity index 100% rename from src/logo.svg rename to src/components/logo.svg diff --git a/src/constants/index.js b/src/constants/index.js new file mode 100644 index 00000000..28e625d9 --- /dev/null +++ b/src/constants/index.js @@ -0,0 +1,2 @@ +export const selectUser = (array, index) => array[index]; +export const log = a => console.log(a); diff --git a/src/index.js b/src/index.js index 8e6bfe35..e37739f8 100644 --- a/src/index.js +++ b/src/index.js @@ -1,13 +1,13 @@ import React from "react"; import ReactDOM from "react-dom"; -import App from "./App"; +import App from "./components/App"; import "./index.css"; import users from "./users"; function render() { ReactDOM.render( - , + , document.getElementById("root") ); } diff --git a/src/node_modules/.yarn-integrity b/src/node_modules/.yarn-integrity new file mode 100644 index 00000000..5622838d --- /dev/null +++ b/src/node_modules/.yarn-integrity @@ -0,0 +1,14 @@ +{ + "flags": [], + "linkedModules": [], + "topLevelPatters": [ + "prop@^0.1.1", + "types@^0.1.1" + ], + "lockfileEntries": { + "dotty@0.0.1": "https://registry.yarnpkg.com/dotty/-/dotty-0.0.1.tgz#cbe6d45c52abd92c4224c079206e2581d14d038a", + "prop@^0.1.1": "https://registry.yarnpkg.com/prop/-/prop-0.1.1.tgz#e464c772f6cec96e4c3db87b6b7ebb8257676441", + "types@^0.1.1": "https://registry.yarnpkg.com/types/-/types-0.1.1.tgz#860c6859d11366293f835d8c95aebcf95029838e" + }, + "files": [] +} \ No newline at end of file diff --git a/src/node_modules/dotty/.npmignore b/src/node_modules/dotty/.npmignore new file mode 100644 index 00000000..07e6e472 --- /dev/null +++ b/src/node_modules/dotty/.npmignore @@ -0,0 +1 @@ +/node_modules diff --git a/src/node_modules/dotty/LICENSE.md b/src/node_modules/dotty/LICENSE.md new file mode 100644 index 00000000..81b6b737 --- /dev/null +++ b/src/node_modules/dotty/LICENSE.md @@ -0,0 +1,26 @@ +Copyright (c) 2012, Deoxxa Development +====================================== +All rights reserved. +-------------------- + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of Deoxxa Development nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY DEOXXA DEVELOPMENT ''AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL DEOXXA DEVELOPMENT BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/node_modules/dotty/README.md b/src/node_modules/dotty/README.md new file mode 100644 index 00000000..c03c923e --- /dev/null +++ b/src/node_modules/dotty/README.md @@ -0,0 +1,64 @@ +Dotty +===== + +Access properties of nested objects using dot-path notation. + +Overview +-------- + +Dotty makes it easy to programmatically access arbitrarily nested objects and +their properties. + +Usage +----- + +Also see the [documentation](http://deoxxa.github.com/dotty/docs/) and +[example](example.js). + +```javascript +var dotty = require("dotty"); + +var object = { + a: { + b: { + x: "y", + }, + c: { + x: "z", + }, + }, +}; + +console.log(dotty.exists(object, "a.b.x")); // true +console.log(dotty.exists(object, ["a", "b", "x"])); // true +console.log(dotty.exists(object, "a.b.z")); // false +console.log(dotty.exists(object, ["a", "b", "z"])); // false + +console.log(dotty.get(object, "a.b.x")); // "y" +console.log(dotty.get(object, ["a", "b", "x"])); // "y" +console.log(dotty.get(object, "a.b.z")); // undefined +console.log(dotty.get(object, ["a", "b", "z"])); // undefine + +dotty.put(object, "a.b.hello", "hi"); +dotty.put(object, ["a", "c", "yo"], "sup"); + +console.log(dotty.search(object, "a.b.*")); +console.log(dotty.search(object, ["a", "b", "*"])); +console.log(dotty.search(object, "a.*.x")); +console.log(dotty.search(object, ["a", "*", "x"])); +console.log(dotty.search(object, ["a", "*", /..+/])); + +console.log(object); +``` + +License +------- + +3-clause BSD. A copy is included with the source. + +Contact +------- + +* GitHub ([http://github.com/deoxxa](deoxxa)) +* Twitter ([http://twitter.com/deoxxa](@deoxxa)) +* Email ([mailto:deoxxa@fknsrs.biz](deoxxa@fknsrs.biz)) diff --git a/src/node_modules/dotty/docs/docco.css b/src/node_modules/dotty/docs/docco.css new file mode 100644 index 00000000..5aa0a8d7 --- /dev/null +++ b/src/node_modules/dotty/docs/docco.css @@ -0,0 +1,186 @@ +/*--------------------- Layout and Typography ----------------------------*/ +body { + font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; + font-size: 15px; + line-height: 22px; + color: #252519; + margin: 0; padding: 0; +} +a { + color: #261a3b; +} + a:visited { + color: #261a3b; + } +p { + margin: 0 0 15px 0; +} +h1, h2, h3, h4, h5, h6 { + margin: 0px 0 15px 0; +} + h1 { + margin-top: 40px; + } +#container { + position: relative; +} +#background { + position: fixed; + top: 0; left: 525px; right: 0; bottom: 0; + background: #f5f5ff; + border-left: 1px solid #e5e5ee; + z-index: -1; +} +#jump_to, #jump_page { + background: white; + -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; + -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; + font: 10px Arial; + text-transform: uppercase; + cursor: pointer; + text-align: right; +} +#jump_to, #jump_wrapper { + position: fixed; + right: 0; top: 0; + padding: 5px 10px; +} + #jump_wrapper { + padding: 0; + display: none; + } + #jump_to:hover #jump_wrapper { + display: block; + } + #jump_page { + padding: 5px 0 3px; + margin: 0 0 25px 25px; + } + #jump_page .source { + display: block; + padding: 5px 10px; + text-decoration: none; + border-top: 1px solid #eee; + } + #jump_page .source:hover { + background: #f5f5ff; + } + #jump_page .source:first-child { + } +table td { + border: 0; + outline: 0; +} + td.docs, th.docs { + max-width: 450px; + min-width: 450px; + min-height: 5px; + padding: 10px 25px 1px 50px; + overflow-x: hidden; + vertical-align: top; + text-align: left; + } + .docs pre { + margin: 15px 0 15px; + padding-left: 15px; + } + .docs p tt, .docs p code { + background: #f8f8ff; + border: 1px solid #dedede; + font-size: 12px; + padding: 0 0.2em; + } + .pilwrap { + position: relative; + } + .pilcrow { + font: 12px Arial; + text-decoration: none; + color: #454545; + position: absolute; + top: 3px; left: -20px; + padding: 1px 2px; + opacity: 0; + -webkit-transition: opacity 0.2s linear; + } + td.docs:hover .pilcrow { + opacity: 1; + } + td.code, th.code { + padding: 14px 15px 16px 25px; + width: 100%; + vertical-align: top; + background: #f5f5ff; + border-left: 1px solid #e5e5ee; + } + pre, tt, code { + font-size: 12px; line-height: 18px; + font-family: Monaco, Consolas, "Lucida Console", monospace; + margin: 0; padding: 0; + } + + +/*---------------------- Syntax Highlighting -----------------------------*/ +td.linenos { background-color: #f0f0f0; padding-right: 10px; } +span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } +body .hll { background-color: #ffffcc } +body .c { color: #408080; font-style: italic } /* Comment */ +body .err { border: 1px solid #FF0000 } /* Error */ +body .k { color: #954121 } /* Keyword */ +body .o { color: #666666 } /* Operator */ +body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ +body .cp { color: #BC7A00 } /* Comment.Preproc */ +body .c1 { color: #408080; font-style: italic } /* Comment.Single */ +body .cs { color: #408080; font-style: italic } /* Comment.Special */ +body .gd { color: #A00000 } /* Generic.Deleted */ +body .ge { font-style: italic } /* Generic.Emph */ +body .gr { color: #FF0000 } /* Generic.Error */ +body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +body .gi { color: #00A000 } /* Generic.Inserted */ +body .go { color: #808080 } /* Generic.Output */ +body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +body .gs { font-weight: bold } /* Generic.Strong */ +body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +body .gt { color: #0040D0 } /* Generic.Traceback */ +body .kc { color: #954121 } /* Keyword.Constant */ +body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ +body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ +body .kp { color: #954121 } /* Keyword.Pseudo */ +body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ +body .kt { color: #B00040 } /* Keyword.Type */ +body .m { color: #666666 } /* Literal.Number */ +body .s { color: #219161 } /* Literal.String */ +body .na { color: #7D9029 } /* Name.Attribute */ +body .nb { color: #954121 } /* Name.Builtin */ +body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ +body .no { color: #880000 } /* Name.Constant */ +body .nd { color: #AA22FF } /* Name.Decorator */ +body .ni { color: #999999; font-weight: bold } /* Name.Entity */ +body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +body .nf { color: #0000FF } /* Name.Function */ +body .nl { color: #A0A000 } /* Name.Label */ +body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +body .nt { color: #954121; font-weight: bold } /* Name.Tag */ +body .nv { color: #19469D } /* Name.Variable */ +body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +body .w { color: #bbbbbb } /* Text.Whitespace */ +body .mf { color: #666666 } /* Literal.Number.Float */ +body .mh { color: #666666 } /* Literal.Number.Hex */ +body .mi { color: #666666 } /* Literal.Number.Integer */ +body .mo { color: #666666 } /* Literal.Number.Oct */ +body .sb { color: #219161 } /* Literal.String.Backtick */ +body .sc { color: #219161 } /* Literal.String.Char */ +body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ +body .s2 { color: #219161 } /* Literal.String.Double */ +body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +body .sh { color: #219161 } /* Literal.String.Heredoc */ +body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +body .sx { color: #954121 } /* Literal.String.Other */ +body .sr { color: #BB6688 } /* Literal.String.Regex */ +body .s1 { color: #219161 } /* Literal.String.Single */ +body .ss { color: #19469D } /* Literal.String.Symbol */ +body .bp { color: #954121 } /* Name.Builtin.Pseudo */ +body .vc { color: #19469D } /* Name.Variable.Class */ +body .vg { color: #19469D } /* Name.Variable.Global */ +body .vi { color: #19469D } /* Name.Variable.Instance */ +body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/src/node_modules/dotty/docs/index.html b/src/node_modules/dotty/docs/index.html new file mode 100644 index 00000000..c0568e3d --- /dev/null +++ b/src/node_modules/dotty/docs/index.html @@ -0,0 +1,135 @@ + index.js

index.js

Dotty makes it easy to programmatically access arbitrarily nested objects and +their properties.

object is an object, path is the path to the property you want to check +for existence of.

+ +

path can be provided as either a "string.separated.with.dots" or as +["an", "array"].

+ +

Returns true if the path can be completely resolved, false otherwise.

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 exists.

+ +

The return value, however, is the property you're trying to access, or +undefined if it can't be found. This means you won't be able to tell +the difference between an unresolved path and an undefined property, so you +should not use get to check for the existence of a property. Use exists +instead.

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 exists and get, with the exception that path +components are regexes with some special cases. If a path component is "*" +on its own, it'll be converted 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 put are the same as exists and get.

+ +

The third argument is a value to put at the path of the object. +Objects in the middle will be created if they don't exist, or added to if +they do. If a value is encountered in the middle of the path that is not +an object, it will not be overwritten.

+ +

The return value is true in the case that the value was put +successfully, or false otherwise.

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);
+  }
+};
+
+
\ No newline at end of file diff --git a/src/node_modules/dotty/example.js b/src/node_modules/dotty/example.js new file mode 100644 index 00000000..d4204eb0 --- /dev/null +++ b/src/node_modules/dotty/example.js @@ -0,0 +1,33 @@ +var dotty = require("./lib/index"); + +var object = { + a: { + b: { + x: "y", + }, + c: { + x: "z", + }, + }, +}; + +console.log(dotty.exists(object, "a.b.x")); // true +console.log(dotty.exists(object, ["a", "b", "x"])); // true +console.log(dotty.exists(object, "a.b.z")); // false +console.log(dotty.exists(object, ["a", "b", "z"])); // false + +console.log(dotty.get(object, "a.b.x")); // "y" +console.log(dotty.get(object, ["a", "b", "x"])); // "y" +console.log(dotty.get(object, "a.b.z")); // undefined +console.log(dotty.get(object, ["a", "b", "z"])); // undefine + +dotty.put(object, "a.b.hello", "hi"); +dotty.put(object, ["a", "c", "yo"], "sup"); + +console.log(dotty.search(object, "a.b.*")); +console.log(dotty.search(object, ["a", "b", "*"])); +console.log(dotty.search(object, "a.*.x")); +console.log(dotty.search(object, ["a", "*", "x"])); +console.log(dotty.search(object, ["a", "*", /..+/])); + +console.log(object); diff --git a/src/node_modules/dotty/lib/index.js b/src/node_modules/dotty/lib/index.js new file mode 100644 index 00000000..f03a09fe --- /dev/null +++ b/src/node_modules/dotty/lib/index.js @@ -0,0 +1,159 @@ +// +// Dotty makes it easy to programmatically access arbitrarily nested objects and +// their properties. +// + +// +// `object` is an object, `path` is the path to the property you want to check +// for existence of. +// +// `path` can be provided as either a `"string.separated.with.dots"` or as +// `["an", "array"]`. +// +// Returns `true` if the path can be completely resolved, `false` otherwise. +// + +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 `exists`. +// +// The return value, however, is the property you're trying to access, or +// `undefined` if it can't be found. This means you won't be able to tell +// the difference between an unresolved path and an undefined property, so you +// should not use `get` to check for the existence of a property. Use `exists` +// instead. +// + +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 `exists` and `get`, with the exception that path +// components are regexes with some special cases. If a path component is `"*"` +// on its own, it'll be converted 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 `put` are the same as `exists` and `get`. +// +// The third argument is a value to `put` at the `path` of the `object`. +// Objects in the middle will be created if they don't exist, or added to if +// they do. If a value is encountered in the middle of the path that is *not* +// an object, it will not be overwritten. +// +// The return value is `true` in the case that the value was `put` +// successfully, or `false` otherwise. +// + +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); + } +}; diff --git a/src/node_modules/dotty/package.json b/src/node_modules/dotty/package.json new file mode 100644 index 00000000..afefa209 --- /dev/null +++ b/src/node_modules/dotty/package.json @@ -0,0 +1,27 @@ +{ + "name": "dotty", + "version": "0.0.1", + "description": "Access properties of nested objects using dot-path notation", + "main": "lib/index.js", + "scripts": { + "test": "vows", + "prepublish": "docco lib/*" + }, + "repository": { + "type": "git", + "url": "git://github.com/deoxxa/dotty.git" + }, + "keywords": [ + "object", + "access", + "dot", + "path", + "mongodb" + ], + "author": "Conrad Pankoff (http://www.fknsrs.biz/)", + "license": "BSD", + "devDependencies": { + "vows": "~0.6.3", + "docco": "~0.3.0" + } +} diff --git a/src/node_modules/dotty/test/exists-test.js b/src/node_modules/dotty/test/exists-test.js new file mode 100644 index 00000000..e4abca75 --- /dev/null +++ b/src/node_modules/dotty/test/exists-test.js @@ -0,0 +1,62 @@ +var dotty = require("../lib/index"), + vows = require("vows"), + assert = require("assert"); + +vows.describe("exists").addBatch({ + "A simple path": { + "as a string": { + topic: dotty.exists({"a": "b"}, "a"), + "should return true": function(res) { + assert.isTrue(res); + }, + }, + "as an array": { + topic: dotty.exists({"a": "b"}, ["a"]), + "should return true": function(res) { + assert.isTrue(res); + }, + }, + }, + "A two-level path": { + "as a string": { + topic: dotty.exists({"a": {"b": "c"}}, "a.b"), + "should return true": function(res) { + assert.isTrue(res); + }, + }, + "as an array": { + topic: dotty.exists({"a": {"b": "c"}}, ["a", "b"]), + "should return true": function(res) { + assert.isTrue(res); + }, + }, + }, + "An unresolved path": { + "as a string": { + topic: dotty.exists({"a": {"b": "c"}}, "a.x"), + "should return false": function(res) { + assert.isFalse(res); + }, + }, + "as an array": { + topic: dotty.exists({"a": {"b": "c"}}, ["a", "x"]), + "should return false": function(res) { + assert.isFalse(res); + }, + }, + }, + "A property which is literally undefined, but with a resolved path": { + "as a string": { + topic: dotty.exists({"a": {"b": undefined}}, "a.b"), + "should return true": function(res) { + assert.isTrue(res); + }, + }, + "as an array": { + topic: dotty.exists({"a": {"b": undefined}}, ["a", "b"]), + "should return true": function(res) { + assert.isTrue(res); + }, + }, + }, +}).export(module); diff --git a/src/node_modules/dotty/test/get-test.js b/src/node_modules/dotty/test/get-test.js new file mode 100644 index 00000000..e92adeac --- /dev/null +++ b/src/node_modules/dotty/test/get-test.js @@ -0,0 +1,62 @@ +var dotty = require("../lib/index"), + vows = require("vows"), + assert = require("assert"); + +vows.describe("get").addBatch({ + "A simple path": { + "as a string": { + topic: dotty.get({"a": "b"}, "a"), + "should return the correct value": function(res) { + assert.equal(res, "b"); + }, + }, + "as an array": { + topic: dotty.get({"a": "b"}, ["a"]), + "should return the correct value": function(res) { + assert.equal(res, "b"); + }, + }, + }, + "A two-level path": { + "as a string": { + topic: dotty.get({"a": {"b": "c"}}, "a.b"), + "should return the correct value": function(res) { + assert.equal(res, "c"); + }, + }, + "as an array": { + topic: dotty.get({"a": {"b": "c"}}, ["a", "b"]), + "should return the correct value": function(res) { + assert.equal(res, "c"); + }, + }, + }, + "An unresolved path": { + "as a string": { + topic: dotty.get({"a": {"b": "c"}}, "a.x"), + "should return undefined": function(res) { + assert.isUndefined(res); + }, + }, + "as an array": { + topic: dotty.get({"a": {"b": "c"}}, ["a", "x"]), + "should return undefined": function(res) { + assert.isUndefined(res); + }, + }, + }, + "A property which is literally undefined, but with a resolved path": { + "as a string": { + topic: dotty.get({"a": {"b": undefined}}, "a.b"), + "should return undefined": function(res) { + assert.isUndefined(res); + }, + }, + "as an array": { + topic: dotty.get({"a": {"b": undefined}}, ["a", "b"]), + "should return undefined": function(res) { + assert.isUndefined(res); + }, + }, + }, +}).export(module); diff --git a/src/node_modules/dotty/test/put-test.js b/src/node_modules/dotty/test/put-test.js new file mode 100644 index 00000000..05ab5464 --- /dev/null +++ b/src/node_modules/dotty/test/put-test.js @@ -0,0 +1,48 @@ +var dotty = require("../lib/index"), + vows = require("vows"), + assert = require("assert"); + +vows.describe("put").addBatch({ + "A simple path": { + "as a string": { + topic: (function() { var x = {}; dotty.put(x, "a", "b"); return x; }()), + "should set the correct value": function(res) { + assert.equal(res.a, "b"); + }, + }, + "as an array": { + topic: (function() { var x = {}; dotty.put(x, ["a"], "b"); return x; }()), + "should set the correct value": function(res) { + assert.equal(res.a, "b"); + }, + }, + }, + "A two-level path": { + "as a string": { + topic: (function() { var x = {}; dotty.put(x, "a.b", "c"); return x; }()), + "should set the correct value": function(res) { + assert.equal(res.a.b, "c"); + }, + }, + "as an array": { + topic: (function() { var x = {}; dotty.put(x, ["a", "b"], "c"); return x; }()), + "should set the correct value": function(res) { + assert.equal(res.a.b, "c"); + }, + }, + }, + "An interrupted path": { + "as a string": { + topic: (function() { var x = {a: 1}; return dotty.put(x, "a.b", "c"); }()), + "should return false": function(res) { + assert.isFalse(res); + }, + }, + "as an array": { + topic: (function() { var x = {a: 1}; return dotty.put(x, ["a", "b"], "c"); }()), + "should return false": function(res) { + assert.isFalse(res); + }, + }, + }, +}).export(module); diff --git a/src/node_modules/dotty/test/search-test.js b/src/node_modules/dotty/test/search-test.js new file mode 100644 index 00000000..fab47a9b --- /dev/null +++ b/src/node_modules/dotty/test/search-test.js @@ -0,0 +1,193 @@ +var dotty = require("../lib/index"), + vows = require("vows"), + assert = require("assert"); + +vows.describe("search").addBatch({ + "A simple path": { + "as a string": { + topic: dotty.search({"a": "b"}, "a"), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return one value": function(res) { + assert.equal(res.length, 1); + }, + "should return the correct value": function(res) { + assert.equal(res[0], "b"); + }, + }, + "as an array": { + topic: dotty.search({"a": "b"}, ["a"]), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return one value": function(res) { + assert.equal(res.length, 1); + }, + "should return the correct value": function(res) { + assert.equal(res[0], "b"); + }, + }, + "as an array with a regex": { + topic: dotty.search({"a": "b"}, [/a/]), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return one value": function(res) { + assert.equal(res.length, 1); + }, + "should return the correct value": function(res) { + assert.equal(res[0], "b"); + }, + }, + }, + "A two-level path": { + "as a string": { + topic: dotty.search({"a": {"b": "c"}}, "a.b"), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return one value": function(res) { + assert.equal(res.length, 1); + }, + "should return the correct value": function(res) { + assert.equal(res[0], "c"); + }, + }, + "as an array": { + topic: dotty.search({"a": {"b": "c"}}, ["a", "b"]), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return one value": function(res) { + assert.equal(res.length, 1); + }, + "should return the correct value": function(res) { + assert.equal(res[0], "c"); + }, + }, + "as an array with regexes": { + topic: dotty.search({"a": {"b": "c"}}, [/a/, /b/]), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return one value": function(res) { + assert.equal(res.length, 1); + }, + "should return the correct value": function(res) { + assert.equal(res[0], "c"); + }, + }, + }, + "A two-level path matching two values": { + "as a string": { + topic: dotty.search({"a": {"b": "c", "d": "e"}}, "a.*"), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return two values": function(res) { + assert.equal(res.length, 2); + }, + "should return the correct value": function(res) { + assert.equal(res[0], "c"); + assert.equal(res[1], "e"); + }, + }, + "as an array": { + topic: dotty.search({"a": {"b": "c", "d": "e"}}, ["a", "*"]), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return two values": function(res) { + assert.equal(res.length, 2); + }, + "should return the correct values": function(res) { + assert.equal(res[0], "c"); + assert.equal(res[1], "e"); + }, + }, + "as an array with regexes": { + topic: dotty.search({"a": {"b": "c", "d": "e"}}, [/a/, /.*/]), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return two values": function(res) { + assert.equal(res.length, 2); + }, + "should return the correct values": function(res) { + assert.equal(res[0], "c"); + assert.equal(res[1], "e"); + }, + }, + }, + "A three-level mixed path matching two values": { + "as a string": { + topic: dotty.search({"a": {"b": {"x": "y"}, "c": {"x": "z"}}}, "a.*.x"), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return two values": function(res) { + assert.equal(res.length, 2); + }, + "should return the correct value": function(res) { + assert.equal(res[0], "y"); + assert.equal(res[1], "z"); + }, + }, + "as an array": { + topic: dotty.search({"a": {"b": {"x": "y"}, "c": {"x": "z"}}}, ["a", "*", "x"]), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return two values": function(res) { + assert.equal(res.length, 2); + }, + "should return the correct values": function(res) { + assert.equal(res[0], "y"); + assert.equal(res[1], "z"); + }, + }, + "as an array with regexes": { + topic: dotty.search({"a": {"b": {"x": "y"}, "c": {"x": "z"}}}, [/a/, /.*/, /x/]), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return two values": function(res) { + assert.equal(res.length, 2); + }, + "should return the correct values": function(res) { + assert.equal(res[0], "y"); + assert.equal(res[1], "z"); + }, + }, + }, + "An unresolved path": { + "as a string": { + topic: dotty.search({"a": {"b": "c"}}, "a.x"), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return zero values": function(res) { + assert.equal(res.length, 0); + }, + }, + "as an array": { + topic: dotty.search({"a": {"b": "c"}}, ["a", "x"]), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return zero values": function(res) { + assert.equal(res.length, 0); + }, + }, + "as an array with regexes": { + topic: dotty.search({"a": {"b": "c"}}, [/a/, /x/]), + "should return an array": function(res) { + assert.isArray(res); + }, + "should return zero values": function(res) { + assert.equal(res.length, 0); + }, + }, + }, +}).export(module); diff --git a/src/node_modules/prop/.npmignore b/src/node_modules/prop/.npmignore new file mode 100644 index 00000000..fd4f2b06 --- /dev/null +++ b/src/node_modules/prop/.npmignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/src/node_modules/prop/examples/simple.js b/src/node_modules/prop/examples/simple.js new file mode 100644 index 00000000..4dc694f1 --- /dev/null +++ b/src/node_modules/prop/examples/simple.js @@ -0,0 +1,20 @@ +var prop = require("..") + +var list = [{ + foo: "1" + }, { + foo: "2" + }, { + bar: { + baz: "3" + } + }, { + bar: {} + }, { + bar: { + baz: "4" + } + }] + +console.log("foos", list.map(prop("foo"))) +console.log("bazs", list.map(prop("bar.baz"))) diff --git a/src/node_modules/prop/index.js b/src/node_modules/prop/index.js new file mode 100644 index 00000000..1ae629f9 --- /dev/null +++ b/src/node_modules/prop/index.js @@ -0,0 +1,15 @@ +var dotty = require("dotty").get + +// prop +// +// functional routine to get a property from an object +// +// var obj = {foo: 'bar'} +// var result = prop('foo')(obj) +// +module.exports = function(name) { + return function(object) { + return dotty(object, name) + } +} + diff --git a/src/node_modules/prop/package.json b/src/node_modules/prop/package.json new file mode 100644 index 00000000..3ddd8b4a --- /dev/null +++ b/src/node_modules/prop/package.json @@ -0,0 +1,18 @@ +{ + "author": "Tom Wilson ", + "name": "prop", + "description": "Functional property method", + "version": "0.1.1", + "homepage": "http://github.com/twilson63/prop", + "repository": { + "url": "git://github.com/twilson63/prop.git" + }, + "dependencies": { + "dotty": "0.0.1" + }, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + } +} diff --git a/src/node_modules/prop/readme.md b/src/node_modules/prop/readme.md new file mode 100644 index 00000000..fa975725 --- /dev/null +++ b/src/node_modules/prop/readme.md @@ -0,0 +1,35 @@ +# prop + +Functional method to get a property from an object. + +## usage + +``` javascript +var obj = {foo: 'bar'} +var result = prop('foo')(obj) + +// Also with nested properties +var nested = { foo: { bar: "baz" }} +var result = prop("foo.bar")(nested) +``` +## install + +``` sh +npm install prop +``` + +## contribute + +pull requests welcome + +## license + +MIT + +## Thanks to + +## Thanks to + +- [functional-javascript](https://github.com/osteele/functional-javascript) +- [Christian Johansen](https://twitter.com/#!/cjno) + diff --git a/src/node_modules/types/.jshintignore b/src/node_modules/types/.jshintignore new file mode 100644 index 00000000..49012469 --- /dev/null +++ b/src/node_modules/types/.jshintignore @@ -0,0 +1,5 @@ +.git/ +doc/ +node_modules/ +tmp/ +test/fixtures/ diff --git a/src/node_modules/types/.jshintrc b/src/node_modules/types/.jshintrc new file mode 100644 index 00000000..df38ec3d --- /dev/null +++ b/src/node_modules/types/.jshintrc @@ -0,0 +1,72 @@ +{ + // Enforcing Options ///////////////////////////////////////////////////////// + + "bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.). + "curly" : true, // Require {} for every new block or scope. + "eqeqeq" : true, // Require triple equals i.e. `===`. + "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`. + "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` + "latedef" : true, // Prohibit hariable use before definition. + "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. + "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. + "noempty" : true, // Prohibit use of empty blocks. + "nonew" : true, // Prohibit use of constructors for side-effects. + "plusplus" : false, // Prohibit use of `++` & `--`. + "regexp" : false, // Prohibit `.` and `[^...]` in regular expressions. + "undef" : true, // Require all non-global variables be declared before they are used. + "strict" : true, // Require `use strict` pragma in every file. + "trailing" : true, // Prohibit trailing whitespaces. + + // Relaxing Options ////////////////////////////////////////////////////////// + + "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons). + "boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. + "debug" : false, // Allow debugger statements e.g. browser breakpoints. + "eqnull" : false, // Tolerate use of `== null`. + "es5" : true, // Allow ECMAScript 5 syntax. + "esnext" : false, // Allow ES.next specific features such as const and let + "evil" : false, // Tolerate use of `eval`. + "expr" : false, // Tolerate `ExpressionStatement` as Programs. + "funcscope" : false, // Tolerate declaring variables inside of control structures while accessing them later + "globalstrict" : true, // Allow global "use strict" (also enables 'strict'). + "iterator" : false, // Allow usage of __iterator__ property. + "lastsemic" : false, // Tolerate semicolon omited for the last statement. + "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. + "laxcomma" : true, // This option suppresses warnings about comma-first coding style + "loopfunc" : false, // Allow functions to be defined within loops. + "multistr" : false, // Tolerate multi-line strings. + "onecase" : false, // Tolerate swithes with only one case. + "proto" : false, // Allow usage of __proto__ property. + "regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`. + "scripturl" : true, // Tolerate script-targeted URLs. + "smarttabs" : false, // Allow mixed tabs and spaces when the latter are used for alignmnent only. + "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. + "sub" : true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. + "supernew" : true, // Tolerate `new function () { ... };` and `new Object;`. + + // Environments ////////////////////////////////////////////////////////////// + + "browser" : false, // Defines globals exposed by modern browsers + "couch" : false, // Defines globals exposed by CouchDB + "devel" : false, // Allow developments statements e.g. `console.log();`. + "dojo" : false, // Defines globals exposed by the Dojo Toolkit + "jquery" : false, // Defines globals exposed by the jQuery + "mootools" : false, // Defines globals exposed by the MooTools + "node" : true, // Defines globals exposed when running under Node.JS + "nonstandard" : false, // Defines non-standard but widely adopted globals such as escape and unescape + "prototypejs" : false, // Defines globals exposed by the Prototype + "rhino" : false, // Defines globals exposed when running under Rhino + "wsh" : false, // Defines globals exposed when running under WSH + + // Legacy //////////////////////////////////////////////////////////////////// + + "nomen" : false, // Prohibit use of initial or trailing underbars in names. + "onevar" : false, // Allow only one `var` statement per function. + "passfail" : false, // Stop on first error. + "white" : false, // Check against strict whitespace and indentation rules. + + // Undocumented ////////////////////////////////////////////////////////////// + + "maxerr" : 100, // Maximum error before stopping. + "indent" : 2 // Specify indentation spacing +} diff --git a/src/node_modules/types/.ndocrc b/src/node_modules/types/.ndocrc new file mode 100644 index 00000000..d8bd8599 --- /dev/null +++ b/src/node_modules/types/.ndocrc @@ -0,0 +1,18 @@ +# +# Common nodeca config +################################################################################ + +--index "./README.md" +--package "./package.json" +--gh-ribbon "{package.homepage}" +--output "doc" +--render "html" +--link-format "{package.homepage}/blob/master/{file}#L{line}" +--broken-links "throw" + + +# +# Paths with sources +################################################################################ + +lib diff --git a/src/node_modules/types/.npmignore b/src/node_modules/types/.npmignore new file mode 100644 index 00000000..2b2d2c06 --- /dev/null +++ b/src/node_modules/types/.npmignore @@ -0,0 +1,3 @@ +/node_modules/ +/doc/ +*.log diff --git a/src/node_modules/types/.travis.yml b/src/node_modules/types/.travis.yml new file mode 100644 index 00000000..66193926 --- /dev/null +++ b/src/node_modules/types/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 +before_script: "make dev-deps" +script: "make test" diff --git a/src/node_modules/types/HISTORY.md b/src/node_modules/types/HISTORY.md new file mode 100644 index 00000000..d966105b --- /dev/null +++ b/src/node_modules/types/HISTORY.md @@ -0,0 +1,15 @@ +0.1.1 / 2012-09-17 + +* Added SortedList#concat(otherList) that produces merged copy. + + +0.1.0 / 2012-05-15 +------------------ + +* Added Hash and Set structures + + +0.0.1 / 2012-02-09 +------------------ + +* First public release diff --git a/src/node_modules/types/LICENSE b/src/node_modules/types/LICENSE new file mode 100644 index 00000000..13de813e --- /dev/null +++ b/src/node_modules/types/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (C) 2011 by Vitaly Puzrin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/node_modules/types/Makefile b/src/node_modules/types/Makefile new file mode 100644 index 00000000..e7629fc9 --- /dev/null +++ b/src/node_modules/types/Makefile @@ -0,0 +1,104 @@ +PATH := ./node_modules/.bin:${PATH} + +NPM_PACKAGE := $(shell node -e 'process.stdout.write(require("./package.json").name)') +NPM_VERSION := $(shell node -e 'process.stdout.write(require("./package.json").version)') + +TMP_PATH := /tmp/${NPM_PACKAGE}-$(shell date +%s) + +REMOTE_NAME ?= origin +REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url) + +CURR_HEAD := $(firstword $(shell git show-ref --hash HEAD | cut --bytes=-6) master) +GITHUB_PROJ := nodeca/${NPM_PACKAGE} + + +help: + echo "make help - Print this help" + echo "make lint - Lint sources with JSHint" + echo "make test - Lint sources and run all tests" + echo "make doc - Build API docs" + echo "make dev-deps - Install developer dependencies" + echo "make gh-pages - Build and push API docs into gh-pages branch" + echo "make publish - Set new version tag and publish npm package" + echo "make todo - Find and list all TODOs" + + +lint: + if test ! `which jshint` ; then \ + echo "You need 'jshint' installed in order to run lint." >&2 ; \ + echo " $ make dev-deps" >&2 ; \ + exit 128 ; \ + fi + jshint . --show-non-errors + + +test: lint + @if test ! `which vows` ; then \ + echo "You need 'vows' installed in order to run tests." >&2 ; \ + echo " $ make dev-deps" >&2 ; \ + exit 128 ; \ + fi + NODE_ENV=test vows --spec + + +doc: + @if test ! `which ndoc` ; then \ + echo "You need 'ndoc' installed in order to generate docs." >&2 ; \ + echo " $ npm install -g ndoc" >&2 ; \ + exit 128 ; \ + fi + rm -rf ./doc + ndoc --link-format "{package.homepage}/blob/${CURR_HEAD}/{file}#L{line}" + + +dev-deps: + @if test ! `which npm` ; then \ + echo "You need 'npm' installed." >&2 ; \ + echo " See: http://npmjs.org/" >&2 ; \ + exit 128 ; \ + fi + npm install -g jshint + npm install + + +gh-pages: + @if test -z ${REMOTE_REPO} ; then \ + echo 'Remote repo URL not found' >&2 ; \ + exit 128 ; \ + fi + $(MAKE) doc && \ + cp -r ./doc ${TMP_PATH} && \ + touch ${TMP_PATH}/.nojekyll + cd ${TMP_PATH} && \ + git init && \ + git add . && \ + git commit -q -m 'Recreated docs' + cd ${TMP_PATH} && \ + git remote add remote ${REMOTE_REPO} && \ + git push --force remote +master:gh-pages + rm -rf ${TMP_PATH} + + +publish: + @if test 0 -ne `git status --porcelain | wc -l` ; then \ + echo "Unclean working tree. Commit or stash changes first." >&2 ; \ + exit 128 ; \ + fi + @if test 0 -ne `git fetch ; git status | grep '^# Your branch' | wc -l` ; then \ + echo "Local/Remote history differs. Please push/pull changes." >&2 ; \ + exit 128 ; \ + fi + @if test 0 -ne `git tag -l ${NPM_VERSION} | wc -l` ; then \ + echo "Tag ${NPM_VERSION} exists. Update package.json" >&2 ; \ + exit 128 ; \ + fi + git tag ${NPM_VERSION} && git push origin ${NPM_VERSION} + npm publish https://github.com/${GITHUB_PROJ}/tarball/${NPM_VERSION} + + +todo: + grep 'TODO' -n -r ./lib 2>/dev/null || test true + + +.PHONY: publish lint test doc dev-deps gh-pages todo +.SILENT: help lint test doc todo diff --git a/src/node_modules/types/README.md b/src/node_modules/types/README.md new file mode 100644 index 00000000..a2e668e4 --- /dev/null +++ b/src/node_modules/types/README.md @@ -0,0 +1,10 @@ +Types +===== + +[![Build Status](https://secure.travis-ci.org/nodeca/types.png?branch=master)](http://travis-ci.org/nodeca/types) + +Collection of extra types (structures, classes) for JavaScript. + +* Set - Array-like structure that holds only unique elements. +* Hash - Provides hashtable, where keys can be anything. +* SortedList - Sequences builder with weight prioritizing. diff --git a/src/node_modules/types/index.js b/src/node_modules/types/index.js new file mode 100644 index 00000000..9dbf81c7 --- /dev/null +++ b/src/node_modules/types/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/types'); diff --git a/src/node_modules/types/lib/types.js b/src/node_modules/types/lib/types.js new file mode 100644 index 00000000..bda52622 --- /dev/null +++ b/src/node_modules/types/lib/types.js @@ -0,0 +1,8 @@ +'use strict'; + + +module.exports = { + Hash: require('./types/hash.js'), + Set: require('./types/set.js'), + SortedList: require('./types/sorted_list.js') +}; diff --git a/src/node_modules/types/lib/types/hash.js b/src/node_modules/types/lib/types/hash.js new file mode 100644 index 00000000..48941880 --- /dev/null +++ b/src/node_modules/types/lib/types/hash.js @@ -0,0 +1,277 @@ +/** + * class Hash + * + * Provides hashtable, where keys can be anything + * + * var o1 = {}, + * o2 = {}, + * hash = new Hash(); + * + * hash.store(o1, 'abc'); + * hash.store(o2, 'def'); + * + * hash.retrieve(o1); // -> 'abc' + * hash.retrieve(o2); // -> 'def' + * hash.retrieve({}); // -> undefined + **/ + + +'use strict'; + + +function key_idx(self, key) { + return self.__hash_keys__.indexOf(key); +} + + +/** + * new Hash([defaultValue]) + * - defaultValue (Mixed): value returned by [[Hash#get]] when key not found. + * + * Creates new instance of Hash. + * + * var h1 = new Hash(-1); + * h1.retrieve('test'); + * // -> -1 + * + * var h2 = new Hash(); + * h2.retrieve('test'); + * // -> undefined + **/ +var Hash = module.exports = function Hash(defaultValue) { + this.__hash_index__ = 0; + this.__hash_keys__ = []; + this.__hash_vals__ = []; + this.__default_value__ = ('function' === typeof defaultValue) ? defaultValue + : function (/* h, k */) { return defaultValue; }; + this.__count__ = 0; +}; + + +/** + * Hash#store(key, val) -> Mixed + * - key (Mixed): Key. Can be any object (not only a string or number). + * - val (Mixed): Value. + * + * Associate `key` with `val`, and return `val` back. + * + * ##### Example + * + * hash.store(123, 'abc'); + * hash.store('string key', 'def'); + * hash.store([1, 2, 3], 'ghi'); + * hash.store({even: 'obj'}, 'jkl'); + * + * ##### Warning + * + * Native JS Object allows only keys, so it stringifies any key you give to it, + * thus array `[1, 2, 3]` becomes `[1,2,3]` (string) when used as key, and + * any object becomes something like `[object Object]`. + * + * Hash do not stringifies or anyhow modifies given object. That meanse that + * two instances of arrays (even with same values) are in fact different + * objects. See example: + * + * var a1 = [1,2,3], a2 = [1,2,3]; + * + * hash.store(a1, 'A1'); + * hash.store(a2, 'A2'); + * + * hash.retrieve(a1); // -> 'A1' + * hash.retrieve(a2); // -> 'A2' + * + * // Similar to: + * + * var o1 = {foo: 'bar'}, o2 = {foo: 'bar'}; + * + * hash.store(o1, 'O1'); + * hash.store(o2, 'O2'); + * + * hash.retrieve(o1); // -> 'O1' + * hash.retrieve(o2); // -> 'O2' + * + **/ +Hash.prototype.store = function store(key, val) { + var i = this.__hash_keys__.indexOf(key); + + if (0 <= i) { + this.__hash_vals__[i] = val; + return; + } + + i = this.__hash_index__; + this.__hash_index__ += 1; + this.__count__ += 1; + + this.__hash_keys__[i] = key; + this.__hash_vals__[i] = val; + + return val; +}; + + +/** alias of: Hash#store + * Hash#set(key, val) -> Void + **/ +Hash.prototype.set = Hash.prototype.store; + + +/** + * Hash#remove(key) -> Mixed + * - key (Mixed): Key to remove. + * + * Removes given `key` and returns associated value. + * + * ##### Example + * + * var key = {}; + * + * hash.store(key, 'abc'); + * hash.retrieve(key); // -> 'abc' + * hash.remove(key); // -> 'abc' + * hash.retrieve(key); // -> undefined + **/ +Hash.prototype.remove = function remove(key) { + var i = key_idx(this, key), val = this.__hash_vals__[i]; + + if (0 <= i) { + delete this.__hash_keys__[i]; + delete this.__hash_vals__[i]; + this.__count__ -= 1; + } + + return val; +}; + + +/** + * Hash#hasKey(key) -> Boolean + * - key (Mixed): Key of check. + * + * Returns boolean `TRUE` whenever `key` present in the hash. + * + * ##### Example + * + * var k1 = {}, k2 = {}; + * + * hash.store(key, 'abc'); + * hash.hasKey(k1); // -> true + * hash.hasKey(k2); // -> false + **/ +Hash.prototype.hasKey = function hasKey(key) { + return 0 <= key_idx(this, key); +}; + + +/** + * Hash#retrieve(key) -> Mixed + * - key (Mixed): Key of the value to retrieve. + * + * Returns value associated with `key`. + * + * ##### Example + * + * var k1 = {}, k2 = {}; + * + * hash.store(key, 'abc'); + * hash.retrieve(k1); // -> 'abc' + * hash.retrieve(k2); // -> undefined + **/ +Hash.prototype.retrieve = function retrieve(key) { + var i = key_idx(this, key); + return (0 <= i) ? this.__hash_vals__[i] : this.__default_value__(this, key); +}; + + +/** alias of: Hash#retrieve + * Hash#get(key, val) -> Void + **/ +Hash.prototype.get = Hash.prototype.retrieve; + + +/** + * Hash#isEmpty() -> Boolean + * + * Returns boolean `TRUE` whenever hash has no elements. + * + * ##### Example + * + * var key = {}; + * + * hash.isEmpty(); + * // -> true + * + * hash.store(key, 'abc'); + * hash.isEmpty(); + * // -> false + * + * hash.remove(key); + * hash.isEmpty(); + * // -> true + **/ +Hash.prototype.isEmpty = function isEmpty() { + return 0 === this.__count__; +}; + + +/** + * Hash#count -> Number + * + * Returns amount of hash elements. + * + * ##### Example + * + * var key = {}; + * + * hash.count + * // -> 0 + * + * hash.store(key, 'abc'); + * hash.count + * // -> 1 + * + * hash.remove(key); + * hash.count + * // -> 0 + **/ +Hash.prototype.__defineGetter__('count', function count() { + return this.__count__; +}); + + +/** + * Hash#keys -> Array + * + * Returns an array all keys presented in the hash + **/ +Hash.prototype.__defineGetter__('keys', function keys() { + return this.__hash_keys__.slice(); +}); + + +/** + * Hash#clone() -> Hash + * + * Returns copy of the hash. + **/ +Hash.prototype.clone = function () { + var copy = new Hash(this.__default_value__); + + this.__hash_keys__.forEach(function (k) { + if (this.hasKey(k)) { + copy.set(k, this.get(k)); + } + }, this); + + return copy; +}; + + +/** alias: Hash.new + * Hash.create() -> SortedSet + * + * Constructor proxy. + **/ +Hash.create = function create(defaultValue) { + return new Hash(defaultValue); +}; diff --git a/src/node_modules/types/lib/types/set.js b/src/node_modules/types/lib/types/set.js new file mode 100644 index 00000000..d7a06798 --- /dev/null +++ b/src/node_modules/types/lib/types/set.js @@ -0,0 +1,138 @@ +/** + * class Set + * + * Provides Array that contains only unique elements. + * + * ##### Example + * + * var set = new Set(); + * + * set.push('Hello').push('World!').push('Hello'); + * set.join(' '); + * // -> Hello World! + **/ + + +'use strict'; + + +/** + * new Set(arr) + * - arr (Array): Initial array to fill-in + * + * Creates new instance of Set. + * + * var s = new Set([1, 2, 1, 3]); + * s.toArray(); + * // -> [1, 2, 3] + **/ +function Set(arr) { + Object.defineProperty(this, '__arr__', {value: []}); + + if (arr) { + arr.forEach(function (el) { this.push(el); }, this); + } +} + + +/** + * Set#unshift(val) -> Void + * - val (Mixed) + * + * Prepends `val` to the head of the set. + * See native `Array#unshift` function for details. + **/ +Set.prototype.unshift = function (val) { + if (-1 === this.__arr__.indexOf(val)) { + this.__arr__.unshift(val); + } +}; + + +/** + * Set#push(val) -> Void + * - val (Mixed) + * + * Appends `val` to the tail of the set. + * See native `Array#push` function for details. + **/ +Set.prototype.push = function (val) { + if (-1 === this.__arr__.indexOf(val)) { + this.__arr__.push(val); + } +}; + + +/** + * Set#forEach(iterator[, thisArg]) -> Void + * - iterator (Function) + * - thisArg (Object) + * + * Proxy to `forEach` of internal array. + * See native `Array#forEach` function for details. + **/ + + +/** + * Set#slice(begin[, end]) -> Void + * + * Returns a one-level deep copy of a portion of a set. + * See native `Array#slice` function for details. + **/ + + +/** + * Set#join(separator) -> Void + * + * Joins all elements of a set into a string. + * See native `Array#join` function for details. + **/ + + +/** + * Set#shift() -> Mixed + * + * Removes the first element from a set and returns that element. + * See native `Array#shift` function for details. + **/ + + +/** + * Set#pop() -> Mixed + * + * Removes the last element from a set and returns that element. + * See native `Array#pop` function for details. + **/ + + +['forEach', 'slice', 'join', 'shift', 'pop'].forEach(function (name) { + Set.prototype[name] = function () { + return this.__arr__[name].apply(this.__arr__, arguments); + }; +}); + + +/** + * Set#length -> Numeric + * + * Reflects the number of elements in a set. + **/ +Object.defineProperty(Set.prototype, 'length', { + get: function () { return this.__arr__.length; } +}); + + +/** + * Set#toArray() -> Array + * + * Syntax sugar. Same as calling `set.slice()`. + **/ +Set.prototype.toArray = function () { + return this.slice(); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +module.exports = Set; diff --git a/src/node_modules/types/lib/types/sorted_list.js b/src/node_modules/types/lib/types/sorted_list.js new file mode 100644 index 00000000..b78e2443 --- /dev/null +++ b/src/node_modules/types/lib/types/sorted_list.js @@ -0,0 +1,122 @@ +/** + * class SortedList + * + * Provides easy way to build sequences of objects (or functions) based on + * priority weight. + * + * ##### Example + * + * var set = new SortedList(); + * + * set.add(20, 'World!').add(10, 'Hello'); + * set.sorted.join(' '); + * // -> Hello World! + * + * set.add(10, ', Cruel'); + * set.sorted.join(' '); + * // -> Hello, Cruel World! + **/ + + +'use strict'; + + +// callback for Array#sort to sort numbers adequately :)) +function sort_nums_asc(a, b) { + return a - b; +} + + +// returns sequence array for given weight +function get_sequence(self, weight) { + if (undefined === self.__sequences__[weight]) { + self.__sequences__[weight] = []; + } + + return self.__sequences__[weight]; +} + + +/** + * new SortedList() + **/ +var SortedList = module.exports = function SortedList() { + this.__sequences__ = {}; + this.__sorted__ = null; +}; + + +/** chainable + * SortedList#add(weight, val) -> SortedList + * - weight (Number): Weight of value + * - val (Mixed): Any value + * + * Appends `val` into the set with given `weight`. + **/ +SortedList.prototype.add = function add(weight, val) { + this.__sorted__ = null; + get_sequence(this, +weight).push(val); + return this; +}; + + +/** + * SortedList#sorted -> Array + * + * Returns array of all values sorted according to their weights + * + * ##### Example + * + * set.add(20, 'b').add(30, 'c').add(10, 'a'); + * set.flatten().join(''); + * // -> abc + **/ +SortedList.prototype.__defineGetter__('sorted', function sorted() { + var arr = [], self = this; + + if (null !== this.__sorted__) { + return this.__sorted__; + } + + function iterator(weight) { + get_sequence(self, weight).forEach(function (val) { + arr.push(val); + }); + } + + Object.getOwnPropertyNames(this.__sequences__) + .sort(sort_nums_asc) + .forEach(iterator); + + this.__sorted__ = arr; + return arr; +}); + + +/** + * SortedList#concat(other) -> SortedList + * + * Returns new SortedList containing elements from both original and other + * lists. + **/ +SortedList.prototype.concat = function concat(other) { + var result = SortedList.create(), store = result.__sequences__; + + [this, other].forEach(function (set) { + Object.getOwnPropertyNames(set.__sequences__).forEach(function (prio) { + store[prio] = (store[prio] || []).concat(set.__sequences__[prio]); + }); + }); + + return result; +}; + + +/** alias: SortedList.new + * SortedList.create() -> SortedList + * + * Constructor proxy. + **/ +SortedList.create = function create() { + return new SortedList(); +}; diff --git a/src/node_modules/types/package.json b/src/node_modules/types/package.json new file mode 100644 index 00000000..fe234e2c --- /dev/null +++ b/src/node_modules/types/package.json @@ -0,0 +1,19 @@ +{ + "name" : "types", + "version" : "0.1.1", + "description" : "Hash, SortedSet", + "keywords" : ["stdlib", "sorted list", "set", "hash"], + "homepage" : "https://github.com/nodeca/types", + + "author" : "Aleksey V Zapparov (http://ixti.net)", + + "bugs" : { "url": "https://github.com/nodeca/types/issues" }, + "license" : { "type": "MIT", "url": "https://github.com/nodeca/types/blob/master/LICENSE" }, + "repository" : { "type": "git", "url": "git://github.com/nodeca/types.git" }, + + "main" : "./index.js", + + "scripts" : { "test": "make test-all" }, + "devDependencies" : { "vows": "~ 0.6.0" }, + "engines" : { "node": ">= 0.6.0" } +} diff --git a/src/node_modules/types/test/hash-test.js b/src/node_modules/types/test/hash-test.js new file mode 100644 index 00000000..ba005862 --- /dev/null +++ b/src/node_modules/types/test/hash-test.js @@ -0,0 +1,102 @@ +'use strict'; + + +var Assert = require('assert'); +var Hash = require('../lib/types/hash'); + + +require('vows').describe('Hash').addBatch({ + 'With defaultValue given to the constructor': { + topic: new Hash('default'), + 'it is returned when key not found': function (h) { + Assert.equal(h.retrieve('foo'), 'default'); + } + }, + + 'Without defaultValue': { + topic: new Hash(), + 'undefined returned on key that does not exists': function (h) { + Assert.isUndefined(h.retrieve('foo')); + } + }, + + 'With non-scalar keys': { + topic: new Hash('none'), + + 'arrays are not stringified (joined)': function (h) { + var k = [1,2,3]; + h.store(k, 123); + + Assert.equal(h.retrieve(k), 123); + Assert.equal(h.retrieve('1,2,3'), 'none'); + Assert.equal(h.retrieve([1,2,3]), 'none'); + }, + + 'object are not stringified or ompared by values': function (h) { + var k = {foo: 'bar'}; + h.store(k, 123); + + Assert.equal(h.retrieve(k), 123); + Assert.equal(h.retrieve('[object Object]'), 'none'); + Assert.equal(h.retrieve({foo: 'bar'}), 'none'); + }, + + 'scalars are not stringified, thus type-sensitive': function (h) { + h.store(1, 123); + h.store('1', 'abc'); + + Assert.equal(h.retrieve(1), 123); + Assert.equal(h.retrieve('1'), 'abc'); + } + }, + + 'Hash without values': { + topic: new Hash(), + 'is empty': function (h) { + Assert.ok(h.isEmpty()); + }, + 'contains 0 elements': function (h) { + Assert.equal(h.count, 0); + } + }, + + 'When adding/removing keys': { + topic: new Hash(), + 'count of elements is raised when new pair is added': function (h) { + var count = h.count; + + h.store('foo', 'bar'); + Assert.equal(h.count, count + 1); + }, + + 'count of elements is lowered when key is removed': function (h) { + var count; + + h.store('foo', 'bar'); + count = h.count; + + h.remove('foo'); + Assert.equal(h.count, count - 1); + } + }, + + 'When key exists': { + topic: new Hash(), + 'we can check hasKey': function (h) { + h.store(1, 123); + + Assert.ok(h.hasKey(1)); + Assert.ok(!h.hasKey(2)); + } + }, + + + 'when defaultValue is function': { + topic: new Hash(function (h, k) { return h.set(k, []); }), + + 'it is called for unknown keys': function (h) { + Assert.isArray(h.get('foo')); + Assert.ok(h.hasKey('foo')); + } + } +}).export(module); diff --git a/src/node_modules/types/test/sorted_list-test.js b/src/node_modules/types/test/sorted_list-test.js new file mode 100644 index 00000000..0f9bf234 --- /dev/null +++ b/src/node_modules/types/test/sorted_list-test.js @@ -0,0 +1,70 @@ +'use strict'; + + +var Assert = require('assert'); +var SortedList = require('../lib/types/sorted_list'); + + +require('vows').describe('SortedList').addBatch({ + 'Adding weights': { + topic: function () { + var s = new SortedList(); + + s.add(-10, '-10'); + s.add(-20, '-20'); + s.add(-30, '-30'); + s.add(30, '+30'); + s.add(20, '+20'); + s.add(10, '+10'); + + return s; + }, + + 'weights are respected on sorting': function (s) { + Assert.equal(s.sorted.join(','), '-30,-20,-10,+10,+20,+30'); + }, + + 'with same width': { + topic: function (s) { + s.add(0, '.'); + s.add(0, 'o'); + s.add(0, '@'); + + return s; + }, + + 'values are sorted in order of appearance': function (s) { + Assert.equal(s.sorted.join(','), '-30,-20,-10,.,o,@,+10,+20,+30'); + } + } + }, + + 'Concatenation': { + topic: function () { + var a = new SortedList(), b = new SortedList, c; + + a.add(-10, '-10'); + a.add(-20, '-20'); + a.add(-30, '-30'); + + b.add(30, '+30'); + b.add(20, '+20'); + b.add(10, '+10'); + + c = a.concat(b); + + return [a, b, c]; + }, + + 'produces new list': function (lists) { + Assert.ok(lists[0] !== lists[2]); + Assert.ok(lists[1] !== lists[2]); + }, + + 'produces list with elements from original lists': function (lists) { + Assert.equal(lists[0].sorted.join(','), '-30,-20,-10'); + Assert.equal(lists[1].sorted.join(','), '+10,+20,+30'); + Assert.equal(lists[2].sorted.join(','), '-30,-20,-10,+10,+20,+30'); + } + } +}).export(module); diff --git a/src/package.json b/src/package.json new file mode 100644 index 00000000..9060a413 --- /dev/null +++ b/src/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "prop": "^0.1.1", + "types": "^0.1.1" + } +} diff --git a/src/users.js b/src/users.js index b700dc61..0b52ab36 100644 --- a/src/users.js +++ b/src/users.js @@ -1,8 +1,8 @@ export default [ { "id": 1, - "first_name": "george", - "last_name": "bluth", + "firstName": "george", + "lastName": "bluth", "address": "4116 Magnolia Drive, Portland, ME 04103", "phone": 15551234567, "occupation": "father", @@ -10,8 +10,8 @@ export default [ }, { "id": 2, - "first_name": "lucille", - "last_name": "bluth", + "firstName": "lucille", + "lastName": "bluth", "address": "6428 3rd Street East, Zion, IL 60099", "phone": 15552345678, "occupation": "mother", @@ -19,8 +19,8 @@ export default [ }, { "id": 3, - "first_name": "oscar", - "last_name": "bluth", + "firstName": "oscar", + "lastName": "bluth", "address": "4797 Sycamore Lane, Dover, NH 03820", "phone": 15553456789, "occupation": "uncle", @@ -28,8 +28,8 @@ export default [ }, { "id": 4, - "first_name": "steve", - "last_name": "holt", + "firstName": "steve", + "lastName": "holt", "address": "3722 Circle Drive, Bristow, VA 20136", "phone": 15554567890, "occupation": "friend", @@ -37,8 +37,8 @@ export default [ }, { "id": 5, - "first_name": "gob", - "last_name": "bluth", + "firstName": "gob", + "lastName": "bluth", "address": "959 Hilltop Road, Apple Valley, CA 92307", "phone": 15555678901, "occupation": "brother", @@ -46,8 +46,8 @@ export default [ }, { "id": 6, - "first_name": "tracey", - "last_name": "bluth", + "firstName": "tracey", + "lastName": "bluth", "address": "2640 Primrose Lane, Longview, TX 75604", "phone": 15556789012, "occupation": "wife", @@ -55,6 +55,3 @@ export default [ } ]; - - - diff --git a/src/yarn.lock b/src/yarn.lock new file mode 100644 index 00000000..ae4e6f81 --- /dev/null +++ b/src/yarn.lock @@ -0,0 +1,17 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +dotty@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/dotty/-/dotty-0.0.1.tgz#cbe6d45c52abd92c4224c079206e2581d14d038a" + +prop@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/prop/-/prop-0.1.1.tgz#e464c772f6cec96e4c3db87b6b7ebb8257676441" + dependencies: + dotty "0.0.1" + +types@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/types/-/types-0.1.1.tgz#860c6859d11366293f835d8c95aebcf95029838e" diff --git a/yarn.lock b/yarn.lock index 137072ec..ca01b8b2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -239,7 +239,7 @@ asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" -autoprefixer@6.5.1: +autoprefixer@6.5.1, autoprefixer@^6.3.1: version "6.5.1" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-6.5.1.tgz#ae759a5221e709f3da17c2d656230e67c43cbb75" dependencies: @@ -250,17 +250,6 @@ autoprefixer@6.5.1: postcss "^5.2.4" postcss-value-parser "^3.2.3" -autoprefixer@^6.3.1: - version "6.7.2" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-6.7.2.tgz#172ab07b998ae9b957530928a59a40be54a45023" - dependencies: - browserslist "^1.7.1" - caniuse-db "^1.0.30000618" - normalize-range "^0.1.2" - num2fraction "^1.2.2" - postcss "^5.2.11" - postcss-value-parser "^3.2.3" - aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" @@ -277,7 +266,7 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" -babel-core@6.17.0: +babel-core@6.17.0, babel-core@^6.0.0: version "6.17.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.17.0.tgz#6c4576447df479e241e58c807e4bc7da4db7f425" dependencies: @@ -303,30 +292,6 @@ babel-core@6.17.0: slash "^1.0.0" source-map "^0.5.0" -babel-core@^6.0.0: - version "6.22.1" - resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.22.1.tgz#9c5fd658ba1772d28d721f6d25d968fc7ae21648" - dependencies: - babel-code-frame "^6.22.0" - babel-generator "^6.22.0" - babel-helpers "^6.22.0" - babel-messages "^6.22.0" - babel-register "^6.22.0" - babel-runtime "^6.22.0" - babel-template "^6.22.0" - babel-traverse "^6.22.1" - babel-types "^6.22.0" - babylon "^6.11.0" - convert-source-map "^1.1.0" - debug "^2.1.1" - json5 "^0.5.0" - lodash "^4.2.0" - minimatch "^3.0.2" - path-is-absolute "^1.0.0" - private "^0.1.6" - slash "^1.0.0" - source-map "^0.5.0" - babel-core@^6.11.4, babel-core@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02" @@ -369,7 +334,7 @@ babel-eslint@^7.1.1: babel-types "^6.23.0" babylon "^6.16.1" -babel-generator@^6.17.0, babel-generator@^6.18.0, babel-generator@^6.22.0, babel-generator@^6.24.0: +babel-generator@^6.17.0, babel-generator@^6.18.0, babel-generator@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.0.tgz#eba270a8cc4ce6e09a61be43465d7c62c1f87c56" dependencies: @@ -483,14 +448,7 @@ babel-helper-get-function-arity@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" -babel-helper-hoist-variables@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.22.0.tgz#3eacbf731d80705845dd2e9718f600cfb9b4ba72" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.22.0" - -babel-helper-hoist-variables@^6.24.1: +babel-helper-hoist-variables@^6.22.0, babel-helper-hoist-variables@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz#1ecb27689c9d25513eadbc9914a73f5408be7a76" dependencies: @@ -569,7 +527,7 @@ babel-helper-replace-supers@^6.24.1: babel-traverse "^6.24.1" babel-types "^6.24.1" -babel-helpers@^6.16.0, babel-helpers@^6.22.0, babel-helpers@^6.23.0: +babel-helpers@^6.16.0, babel-helpers@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.23.0.tgz#4f8f2e092d0b6a8808a4bde79c27f1e2ecf0d992" dependencies: @@ -592,7 +550,7 @@ babel-loader@6.2.5: mkdirp "^0.5.1" object-assign "^4.0.1" -babel-messages@^6.22.0, babel-messages@^6.23.0, babel-messages@^6.8.0: +babel-messages@^6.23.0, babel-messages@^6.8.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" dependencies: @@ -1180,7 +1138,7 @@ babel-preset-react@6.16.0: babel-plugin-transform-react-jsx-self "^6.11.0" babel-plugin-transform-react-jsx-source "^6.3.13" -babel-register@^6.16.0, babel-register@^6.22.0, babel-register@^6.24.0: +babel-register@^6.16.0, babel-register@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.24.0.tgz#5e89f8463ba9970356d02eb07dabe3308b080cfd" dependencies: @@ -1226,7 +1184,7 @@ babel-template@^6.24.1: babylon "^6.11.0" lodash "^4.2.0" -babel-traverse@^6.15.0, babel-traverse@^6.16.0, babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.22.1, babel-traverse@^6.23.0, babel-traverse@^6.23.1: +babel-traverse@^6.15.0, babel-traverse@^6.16.0, babel-traverse@^6.18.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1: version "6.23.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" dependencies: @@ -1240,7 +1198,7 @@ babel-traverse@^6.15.0, babel-traverse@^6.16.0, babel-traverse@^6.18.0, babel-tr invariant "^2.2.0" lodash "^4.2.0" -babel-traverse@^6.24.1: +babel-traverse@^6.22.0, babel-traverse@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.24.1.tgz#ab36673fd356f9a0948659e7b338d5feadb31695" dependencies: @@ -1254,7 +1212,7 @@ babel-traverse@^6.24.1: invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.15.0, babel-types@^6.16.0, babel-types@^6.18.0, babel-types@^6.22.0, babel-types@^6.23.0: +babel-types@^6.15.0, babel-types@^6.16.0, babel-types@^6.18.0, babel-types@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" dependencies: @@ -1263,7 +1221,7 @@ babel-types@^6.15.0, babel-types@^6.16.0, babel-types@^6.18.0, babel-types@^6.22 lodash "^4.2.0" to-fast-properties "^1.0.1" -babel-types@^6.19.0, babel-types@^6.24.1: +babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.24.1.tgz#a136879dc15b3606bda0d90c1fc74304c2ff0975" dependencies: @@ -1382,14 +1340,14 @@ browserify-zlib@~0.1.4: dependencies: pako "~0.2.0" -browserslist@^1.0.1, browserslist@^1.4.0, browserslist@^1.5.2, browserslist@^1.7.1: +browserslist@^1.0.1, browserslist@^1.5.2: version "1.7.7" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-1.7.7.tgz#0bd76704258be829b2398bb50e4b62d1a166b0b9" dependencies: caniuse-db "^1.0.30000639" electron-to-chromium "^1.2.7" -browserslist@~1.4.0: +browserslist@^1.4.0, browserslist@~1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-1.4.0.tgz#9cfdcf5384d9158f5b70da2aa00b30e8ff019049" dependencies: @@ -1467,7 +1425,7 @@ caniuse-api@^1.5.2: lodash.memoize "^4.1.0" lodash.uniq "^4.3.0" -caniuse-db@^1.0.30000346, caniuse-db@^1.0.30000539, caniuse-db@^1.0.30000554, caniuse-db@^1.0.30000618, caniuse-db@^1.0.30000639: +caniuse-db@^1.0.30000346, caniuse-db@^1.0.30000539, caniuse-db@^1.0.30000554, caniuse-db@^1.0.30000639: version "1.0.30000646" resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000646.tgz#c724b90d61df24286e015fc528d062073c00def4" @@ -2094,6 +2052,10 @@ dotenv@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-2.0.0.tgz#bd759c357aaa70365e01c96b7b0bec08a6e0d949" +dotty@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/dotty/-/dotty-0.0.1.tgz#cbe6d45c52abd92c4224c079206e2581d14d038a" + duplexer2@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" @@ -2482,7 +2444,7 @@ events@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" -eventsource@0.1.6, eventsource@^0.1.3: +eventsource@^0.1.3: version "0.1.6" resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-0.1.6.tgz#0acede849ed7dd1ccc32c811bb11b944d4f29232" dependencies: @@ -2579,12 +2541,6 @@ faye-websocket@^0.10.0: dependencies: websocket-driver ">=0.5.1" -faye-websocket@~0.11.0: - version "0.11.1" - resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.1.tgz#f0efe18c4f56e4f40afc7e06c719fd5ee6188f38" - dependencies: - websocket-driver ">=0.5.1" - faye-websocket@~0.7.3: version "0.7.3" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.7.3.tgz#cc4074c7f4a4dfd03af54dd65c354b135132ce11" @@ -3043,7 +2999,7 @@ http-errors@~1.6.1: setprototypeof "1.0.3" statuses ">= 1.3.1 < 2" -http-proxy-middleware@0.17.2: +http-proxy-middleware@0.17.2, http-proxy-middleware@~0.17.1: version "0.17.2" resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.17.2.tgz#572d517a6d2fb1063a469de294eed96066352007" dependencies: @@ -3052,16 +3008,7 @@ http-proxy-middleware@0.17.2: lodash "^4.16.2" micromatch "^2.3.11" -http-proxy-middleware@~0.17.1: - version "0.17.3" - resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.17.3.tgz#940382147149b856084f5534752d5b5a8168cd1d" - dependencies: - http-proxy "^1.16.2" - is-glob "^3.1.0" - lodash "^4.17.2" - micromatch "^2.3.11" - -http-proxy@^1.15.1, http-proxy@^1.16.2: +http-proxy@^1.15.1: version "1.16.2" resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.16.2.tgz#06dff292952bf64dbe8471fa9df73066d4f37742" dependencies: @@ -3260,7 +3207,7 @@ is-glob@^2.0.0, is-glob@^2.0.1: dependencies: is-extglob "^1.0.0" -is-glob@^3.0.0, is-glob@^3.1.0: +is-glob@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" dependencies: @@ -3998,7 +3945,7 @@ lodash.words@^3.0.0: dependencies: lodash._root "^3.0.0" -lodash@4, "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.11.2, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.16.2, lodash@^4.16.4, lodash@^4.17.2, lodash@^4.2.0, lodash@^4.3.0: +lodash@4, "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.11.2, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.16.2, lodash@^4.16.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -4866,7 +4813,7 @@ postcss-zindex@^2.0.1: postcss "^5.0.4" uniqs "^2.0.0" -postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0.14, postcss@^5.0.16, postcss@^5.0.2, postcss@^5.0.4, postcss@^5.0.5, postcss@^5.0.6, postcss@^5.0.8, postcss@^5.2.11, postcss@^5.2.4: +postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0.14, postcss@^5.0.16, postcss@^5.0.2, postcss@^5.0.4, postcss@^5.0.5, postcss@^5.0.6, postcss@^5.0.8, postcss@^5.2.4: version "5.2.16" resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.16.tgz#732b3100000f9ff8379a48a53839ed097376ad57" dependencies: @@ -4926,6 +4873,12 @@ prop-types@^15.5.7, prop-types@~15.5.7: dependencies: fbjs "^0.8.9" +prop@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/prop/-/prop-0.1.1.tgz#e464c772f6cec96e4c3db87b6b7ebb8257676441" + dependencies: + dotty "0.0.1" + proxy-addr@~1.1.3: version "1.1.4" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-1.1.4.tgz#27e545f6960a44a627d9b44467e35c1b6b4ce2f3" @@ -5364,13 +5317,13 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.2.8, rimraf@^2.4.4, rimraf@^2.5.1, rimraf@^2.6.1: +rimraf@2, rimraf@^2.4.4, rimraf@^2.5.1, rimraf@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: glob "^7.0.5" -rimraf@2.5.4: +rimraf@2.5.4, rimraf@^2.2.8: version "2.5.4" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" dependencies: @@ -5541,7 +5494,7 @@ sntp@1.x.x: dependencies: hoek "2.x.x" -sockjs-client@1.0.3: +sockjs-client@1.0.3, sockjs-client@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/sockjs-client/-/sockjs-client-1.0.3.tgz#b0d8280998460eb2564c5d79d7e3d7cfd8a353ad" dependencies: @@ -5552,17 +5505,6 @@ sockjs-client@1.0.3: json3 "^3.3.2" url-parse "^1.0.1" -sockjs-client@^1.0.3: - version "1.1.2" - resolved "https://registry.yarnpkg.com/sockjs-client/-/sockjs-client-1.1.2.tgz#f0212a8550e4c9468c8cceaeefd2e3493c033ad5" - dependencies: - debug "^2.2.0" - eventsource "0.1.6" - faye-websocket "~0.11.0" - inherits "^2.0.1" - json3 "^3.3.2" - url-parse "^1.1.1" - sockjs@^0.3.15: version "0.3.18" resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.18.tgz#d9b289316ca7df77595ef299e075f0f937eb4207" @@ -5876,6 +5818,10 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +types@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/types/-/types-0.1.1.tgz#860c6859d11366293f835d8c95aebcf95029838e" + ua-parser-js@^0.7.9: version "0.7.12" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb" @@ -5965,7 +5911,7 @@ url-parse@1.0.x: querystringify "0.0.x" requires-port "1.0.x" -url-parse@^1.0.1, url-parse@^1.1.1: +url-parse@^1.0.1: version "1.1.8" resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.1.8.tgz#7a65b3a8d57a1e86af6b4e2276e34774167c0156" dependencies: