Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | 1x 1x 1x 1x 1x 403x 213x 190x 75x 1x 154x 154x 154x 154x 79x 79x 75x 75x 75x 75x 1x 1x 1x 213x 213x 213x 1x 308x 308x 308x 95x 213x 213x 1x 213x 158x 55x 55x 55x 75x 55x 20x 20x 55x 1x 1x 1x 1x 1x 1x 1x 1x 1x | "use strict"; var __values = (this && this.__values) || function (o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; }; var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spread = (this && this.__spread) || function () { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; }; Object.defineProperty(exports, "__esModule", { value: true }); var constants_1 = require("./constants"); function isState(state) { if (typeof state === 'string') { return false; } return 'value' in state && 'tree' in state && 'history' in state; } function keys(value) { return Object.keys(value); } exports.keys = keys; function matchesState(parentStateId, childStateId, delimiter) { Eif (delimiter === void 0) { delimiter = constants_1.STATE_DELIMITER; } var parentStateValue = toStateValue(parentStateId, delimiter); var childStateValue = toStateValue(childStateId, delimiter); if (typeof childStateValue === 'string') { Eif (typeof parentStateValue === 'string') { return childStateValue === parentStateValue; } // Parent more specific than child return false; } Iif (typeof parentStateValue === 'string') { return parentStateValue in childStateValue; } return keys(parentStateValue).every(function (key) { Iif (!(key in childStateValue)) { return false; } return matchesState(parentStateValue[key], childStateValue[key]); }); } exports.matchesState = matchesState; function getEventType(event) { try { return typeof event === 'string' || typeof event === 'number' ? "" + event : event.type; } catch (e) { throw new Error('Events must be strings or objects with a string event.type property.'); } } exports.getEventType = getEventType; function getActionType(action) { try { return typeof action === 'string' || typeof action === 'number' ? "" + action : typeof action === 'function' ? action.name : action.type; } catch (e) { throw new Error('Actions must be strings or objects with a string action.type property.'); } } exports.getActionType = getActionType; function toStatePath(stateId, delimiter) { try { Iif (Array.isArray(stateId)) { return stateId; } return stateId.toString().split(delimiter); } catch (e) { throw new Error("'" + stateId + "' is not a valid state path."); } } exports.toStatePath = toStatePath; function toStateValue(stateValue, delimiter) { Iif (isState(stateValue)) { return stateValue.value; } Iif (Array.isArray(stateValue)) { return pathToStateValue(stateValue); } if (typeof stateValue !== 'string' && !isState(stateValue)) { return stateValue; } var statePath = toStatePath(stateValue, delimiter); return pathToStateValue(statePath); } exports.toStateValue = toStateValue; function pathToStateValue(statePath) { if (statePath.length === 1) { return statePath[0]; } var value = {}; var marker = value; for (var i = 0; i < statePath.length - 1; i++) { if (i === statePath.length - 2) { marker[statePath[i]] = statePath[i + 1]; } else { marker[statePath[i]] = {}; marker = marker[statePath[i]]; } } return value; } exports.pathToStateValue = pathToStateValue; function mapValues(collection, iteratee) { var result = {}; keys(collection).forEach(function (key, i) { result[key] = iteratee(collection[key], key, collection, i); }); return result; } exports.mapValues = mapValues; function mapFilterValues(collection, iteratee, predicate) { var result = {}; keys(collection).forEach(function (key) { var item = collection[key]; if (!predicate(item)) { return; } result[key] = iteratee(item, key, collection); }); return result; } exports.mapFilterValues = mapFilterValues; /** * Retrieves a value at the given path. * @param props The deep path to the prop of the desired value */ exports.path = function (props) { return function (object) { var e_1, _a; var result = object; try { for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) { var prop = props_1_1.value; result = result[prop]; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1); } finally { if (e_1) throw e_1.error; } } return result; }; }; /** * Retrieves a value at the given path via the nested accessor prop. * @param props The deep path to the prop of the desired value */ function nestedPath(props, accessorProp) { return function (object) { var e_2, _a; var result = object; try { for (var props_2 = __values(props), props_2_1 = props_2.next(); !props_2_1.done; props_2_1 = props_2.next()) { var prop = props_2_1.value; result = result[accessorProp][prop]; } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (props_2_1 && !props_2_1.done && (_a = props_2.return)) _a.call(props_2); } finally { if (e_2) throw e_2.error; } } return result; }; } exports.nestedPath = nestedPath; exports.toStatePaths = function (stateValue) { if (!stateValue) { return [[]]; } if (typeof stateValue === 'string') { return [[stateValue]]; } var result = flatten(keys(stateValue).map(function (key) { return exports.toStatePaths(stateValue[key]).map(function (subPath) { return [key].concat(subPath); }); })); return result; }; exports.pathsToStateValue = function (paths) { var e_3, _a; var result = {}; if (paths && paths.length === 1 && paths[0].length === 1) { return paths[0][0]; } try { for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) { var currentPath = paths_1_1.value; var marker = result; // tslint:disable-next-line:prefer-for-of for (var i = 0; i < currentPath.length; i++) { var subPath = currentPath[i]; if (i === currentPath.length - 2) { marker[subPath] = currentPath[i + 1]; break; } marker[subPath] = marker[subPath] || {}; marker = marker[subPath]; } } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1); } finally { if (e_3) throw e_3.error; } } return result; }; function flatten(array) { var _a; return (_a = []).concat.apply(_a, __spread(array)); } exports.flatten = flatten; function toArray(value) { if (Array.isArray(value)) { return value; } if (value === undefined) { return []; } return [value]; } exports.toArray = toArray; |