@angular-wave/angular.ts 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/README.md +5 -3
  2. package/dist/angular-ts.esm.js +1 -1
  3. package/dist/angular-ts.umd.js +1 -1
  4. package/index.html +66 -57
  5. package/package.json +1 -1
  6. package/rollup.config.js +2 -6
  7. package/src/animations/animate-children-directive.js +1 -1
  8. package/src/animations/animate-css-driver.js +1 -1
  9. package/src/animations/animate-css.js +220 -15
  10. package/src/animations/animate-js-driver.js +1 -1
  11. package/src/animations/animate-js.js +2 -2
  12. package/src/animations/animate-queue.js +3 -4
  13. package/src/animations/animation.js +1 -1
  14. package/src/animations/module.js +750 -0
  15. package/src/animations/shared.js +15 -4
  16. package/src/core/animate-runner.js +1 -1
  17. package/src/core/animate.js +4 -5
  18. package/src/core/compile.js +6 -7
  19. package/src/core/controller.js +4 -3
  20. package/src/core/filter.js +1 -1
  21. package/src/core/interpolate.js +1 -1
  22. package/src/core/interval-factory.js +1 -1
  23. package/src/core/interval.js +1 -1
  24. package/src/core/location.js +1 -1
  25. package/src/core/parser/parse.js +1 -1
  26. package/src/core/q.js +2 -3
  27. package/src/core/root-scope.js +1 -1
  28. package/src/core/sanitize-uri.js +1 -1
  29. package/src/core/sce.js +1 -1
  30. package/src/core/task-tracker-factory.js +1 -1
  31. package/src/core/timeout.js +1 -1
  32. package/src/core/urlUtils.js +1 -1
  33. package/src/directive/attrs.js +1 -1
  34. package/src/directive/bind.js +1 -1
  35. package/src/directive/class.js +2 -2
  36. package/src/directive/events.js +1 -1
  37. package/src/directive/form.js +1 -1
  38. package/src/directive/include.js +1 -1
  39. package/src/directive/input.js +1 -1
  40. package/src/directive/list.js +2 -2
  41. package/src/directive/model-options.js +1 -1
  42. package/src/directive/model.js +1 -1
  43. package/src/directive/options.js +2 -3
  44. package/src/directive/ref.js +1 -1
  45. package/src/directive/repeat.js +1 -1
  46. package/src/directive/select.js +1 -1
  47. package/src/directive/switch.js +1 -1
  48. package/src/directive/transclude.js +1 -1
  49. package/src/directive/validators.js +1 -1
  50. package/src/exts/aria.js +1 -1
  51. package/src/exts/messages.js +3 -3
  52. package/src/exts/messages.md +28 -31
  53. package/src/filters/filter.js +2 -3
  54. package/src/filters/filters.js +1 -1
  55. package/src/filters/limit-to.js +1 -1
  56. package/src/filters/order-by.js +2 -3
  57. package/src/injector.js +8 -9
  58. package/src/jqLite.js +3 -4
  59. package/src/loader.js +2 -4
  60. package/src/public.js +1 -1
  61. package/src/router/common/coreservices.js +5 -0
  62. package/src/router/{core/common → common}/queue.js +1 -1
  63. package/src/router/{core/common → common}/trace.js +21 -19
  64. package/src/router/{adapter/directives → directives}/stateDirectives.js +24 -28
  65. package/src/router/{adapter/directives → directives}/viewDirective.js +10 -9
  66. package/src/router/{core/globals.js → globals.js} +13 -3
  67. package/src/router/{core/hooks → hooks}/coreResolvables.js +6 -4
  68. package/src/router/{core/hooks → hooks}/lazyLoad.js +5 -2
  69. package/src/router/{core/hooks → hooks}/redirectTo.js +1 -1
  70. package/src/router/{core/hooks → hooks}/resolve.js +5 -4
  71. package/src/router/{core/hooks → hooks}/updateGlobals.js +1 -1
  72. package/src/router/{core/hooks → hooks}/views.js +2 -3
  73. package/src/router/index.js +60 -0
  74. package/src/router/{adapter/injectables.js → injectables.js} +9 -9
  75. package/src/router/{adapter/locationServices.js → locationServices.js} +19 -12
  76. package/src/router/{core/params → params}/param.js +5 -10
  77. package/src/router/{core/params → params}/paramType.js +4 -4
  78. package/src/router/{core/params → params}/paramTypes.js +4 -3
  79. package/src/router/{core/params → params}/stateParams.js +1 -1
  80. package/src/router/{core/path → path}/pathNode.js +2 -2
  81. package/src/router/{core/path → path}/pathUtils.js +13 -7
  82. package/src/router/{core/resolve → resolve}/resolvable.js +5 -5
  83. package/src/router/{core/resolve → resolve}/resolveContext.js +16 -6
  84. package/src/router/router.js +171 -72
  85. package/src/router/{adapter/services.js → services.js} +47 -27
  86. package/src/router/{core/state → state}/stateBuilder.js +14 -10
  87. package/src/router/{core/state → state}/stateMatcher.js +2 -3
  88. package/src/router/{core/state → state}/stateObject.js +8 -6
  89. package/src/router/{core/state → state}/stateQueueManager.js +3 -3
  90. package/src/router/{core/state → state}/stateRegistry.js +6 -7
  91. package/src/router/{core/state → state}/stateService.js +12 -15
  92. package/src/router/{core/state → state}/targetState.js +2 -2
  93. package/src/router/{adapter/statebuilders → state}/views.js +17 -15
  94. package/src/router/{adapter/stateProvider.js → stateProvider.js} +51 -9
  95. package/src/router/{adapter/templateFactory.js → templateFactory.js} +10 -19
  96. package/src/router/{core/transition → transition}/hookBuilder.js +4 -3
  97. package/src/router/{core/transition → transition}/hookRegistry.js +3 -6
  98. package/src/router/{core/transition → transition}/rejectFactory.js +4 -5
  99. package/src/router/{core/transition → transition}/transition.js +10 -12
  100. package/src/router/{core/transition → transition}/transitionHook.js +4 -4
  101. package/src/router/{core/transition → transition}/transitionService.js +13 -13
  102. package/src/router/{core/url → url}/urlConfig.js +28 -19
  103. package/src/router/{core/url → url}/urlMatcher.js +14 -16
  104. package/src/router/{core/url → url}/urlMatcherFactory.js +7 -6
  105. package/src/router/{core/url → url}/urlRouter.js +6 -30
  106. package/src/router/{core/url → url}/urlRule.js +3 -3
  107. package/src/router/{core/url → url}/urlRules.js +10 -11
  108. package/src/router/{core/url → url}/urlService.js +12 -6
  109. package/src/router/{core/view → view}/view.js +32 -27
  110. package/src/router/{adapter/viewScroll.js → viewScroll.js} +3 -0
  111. package/src/services/anchor-scroll.js +1 -1
  112. package/src/services/browser.js +1 -1
  113. package/src/services/cache-factory.js +7 -1
  114. package/src/services/cookie-reader.js +1 -1
  115. package/src/services/http-backend.js +6 -1
  116. package/src/services/http.js +4 -5
  117. package/src/services/log.js +1 -1
  118. package/src/services/template-request.js +2 -2
  119. package/src/{router/core/common → shared}/common.js +35 -16
  120. package/src/{router/core/common → shared}/predicates.js +2 -12
  121. package/src/{router/core/common → shared}/strings.js +5 -13
  122. package/src/{core → shared}/utils.js +13 -29
  123. package/test/angular.spec.js +1 -31
  124. package/test/{ng → core}/animate.spec.js +1 -1
  125. package/test/{ng → core}/compile.spec.js +2 -3
  126. package/test/{ng → core}/http.spec.js +2 -2
  127. package/test/{ng → core}/on.spec.js +1 -1
  128. package/test/{ng → core}/parse.spec.js +1 -1
  129. package/test/{ng → core}/prop.spec.js +1 -1
  130. package/test/{ng → core}/scope.spec.js +1 -1
  131. package/test/{ng/directive → directive}/a.spec.js +4 -4
  132. package/test/{ng/directive → directive}/bind.spec.js +3 -3
  133. package/test/{ng/directive → directive}/boolean.spec.js +2 -2
  134. package/test/{ng/directive → directive}/change.spec.js +3 -3
  135. package/test/{ng/directive → directive}/class.spec.js +4 -4
  136. package/test/{ng/directive → directive}/click.spec.js +3 -3
  137. package/test/{ng/directive → directive}/cloak.spec.js +4 -4
  138. package/test/{ng/directive → directive}/constoller.spec.js +5 -5
  139. package/test/{ng/directive → directive}/element-style.spec.js +3 -3
  140. package/test/{ng/directive → directive}/event.spec.js +4 -4
  141. package/test/{ng/directive → directive}/form.spec.js +5 -5
  142. package/test/{ng/directive → directive}/href.spec.js +4 -4
  143. package/test/{ng/directive → directive}/if.spec.js +5 -5
  144. package/test/{ng/directive → directive}/include.spec.js +5 -5
  145. package/test/{ng/directive → directive}/init.spec.js +4 -4
  146. package/test/{ng/directive → directive}/input.spec.js +5 -5
  147. package/test/{ng/directive → directive}/list.spec.js +3 -3
  148. package/test/{ng/directive → directive}/model-options.spec.js +6 -6
  149. package/test/{ng/directive → directive}/model.spec.js +8 -8
  150. package/test/{ng/directive → directive}/non-bindable.spec.js +3 -3
  151. package/test/{ng/directive → directive}/options.spec.js +5 -5
  152. package/test/{ng/directive → directive}/ref.spec.js +2 -2
  153. package/test/{ng/directive → directive}/repeat.spec.js +5 -5
  154. package/test/{ng/directive → directive}/script.spec.js +3 -3
  155. package/test/{ng/directive → directive}/scrset.spec.js +3 -3
  156. package/test/{ng/directive → directive}/select.spec.js +5 -5
  157. package/test/{ng/directive → directive}/show-hide.spec.js +3 -3
  158. package/test/{ng/directive → directive}/src.spec.js +3 -3
  159. package/test/{ng/directive → directive}/style.spec.js +3 -3
  160. package/test/{ng/directive → directive}/switch.spec.js +3 -3
  161. package/test/{ng/directive → directive}/validators.spec.js +3 -3
  162. package/test/{ng/filter → filter}/filter.spec.js +4 -4
  163. package/test/{ng/filter → filter}/filters.spec.js +3 -3
  164. package/test/{ng/filter → filter}/limit-to.spec.js +3 -3
  165. package/test/{ng/filter → filter}/order-by.spec.js +2 -2
  166. package/test/injector.spec.js +1 -1
  167. package/test/jqlite.spec.js +1 -1
  168. package/test/messages/messages.spec.js +1 -1
  169. package/test/min-err.spec.js +1 -1
  170. package/test/original-test.html +4 -4
  171. package/test/router/glob.spec.js +78 -0
  172. package/test/router/state.spec.js +1010 -0
  173. package/test/sanitize/bing-html.spec.js +1 -1
  174. package/test/shared/common.spec.js +283 -0
  175. package/test/shared/hof.spec.js +60 -0
  176. package/test/shared/strings.spec.js +40 -0
  177. package/test/{ng → shared}/utils.spec.js +1 -1
  178. package/types/index.d.ts +1 -1
  179. package/types/router/angular.d.ts +1 -0
  180. package/types/router/core/common/common.d.ts +370 -0
  181. package/types/router/core/common/coreservices.d.ts +80 -0
  182. package/types/router/core/common/glob.d.ts +60 -0
  183. package/types/router/core/common/hof.d.ts +160 -0
  184. package/types/router/core/common/index.d.ts +8 -0
  185. package/types/router/core/common/predicates.d.ts +25 -0
  186. package/types/router/core/common/queue.d.ts +15 -0
  187. package/types/router/core/common/safeConsole.d.ts +5 -0
  188. package/types/router/core/common/strings.d.ts +64 -0
  189. package/types/router/core/common/trace.d.ts +114 -0
  190. package/types/router/core/globals.d.ts +45 -0
  191. package/types/router/core/hooks/coreResolvables.d.ts +4 -0
  192. package/types/router/core/hooks/ignoredTransition.d.ts +2 -0
  193. package/types/router/core/hooks/invalidTransition.d.ts +2 -0
  194. package/types/router/core/hooks/lazyLoad.d.ts +12 -0
  195. package/types/router/core/hooks/onEnterExitRetain.d.ts +4 -0
  196. package/types/router/core/hooks/redirectTo.d.ts +2 -0
  197. package/types/router/core/hooks/resolve.d.ts +5 -0
  198. package/types/router/core/hooks/updateGlobals.d.ts +2 -0
  199. package/types/router/core/hooks/url.d.ts +2 -0
  200. package/types/router/core/hooks/views.d.ts +3 -0
  201. package/types/router/core/index.d.ts +12 -0
  202. package/types/router/core/interface.d.ts +102 -0
  203. package/types/router/core/params/index.d.ts +12 -0
  204. package/types/router/core/params/interface.d.ts +606 -0
  205. package/types/router/core/params/param.d.ts +65 -0
  206. package/types/router/core/params/paramType.d.ts +65 -0
  207. package/types/router/core/params/paramTypes.d.ts +190 -0
  208. package/types/router/core/params/stateParams.d.ts +15 -0
  209. package/types/router/core/path/index.d.ts +2 -0
  210. package/types/router/core/path/pathNode.d.ts +60 -0
  211. package/types/router/core/path/pathUtils.d.ts +79 -0
  212. package/types/router/core/resolve/index.d.ts +3 -0
  213. package/types/router/core/resolve/interface.d.ts +210 -0
  214. package/types/router/core/resolve/resolvable.d.ts +69 -0
  215. package/types/router/core/resolve/resolveContext.d.ts +92 -0
  216. package/types/router/core/router.d.ts +95 -0
  217. package/types/router/core/state/index.d.ts +28 -0
  218. package/types/router/core/state/interface.d.ts +708 -0
  219. package/types/router/core/state/stateBuilder.d.ts +104 -0
  220. package/types/router/core/state/stateMatcher.d.ts +11 -0
  221. package/types/router/core/state/stateObject.d.ts +155 -0
  222. package/types/router/core/state/stateQueueManager.d.ts +24 -0
  223. package/types/router/core/state/stateRegistry.d.ts +136 -0
  224. package/types/router/core/state/stateService.d.ts +350 -0
  225. package/types/router/core/state/targetState.d.ts +100 -0
  226. package/types/router/core/transition/hookBuilder.d.ts +45 -0
  227. package/types/router/core/transition/hookRegistry.d.ts +93 -0
  228. package/types/router/core/transition/index.d.ts +20 -0
  229. package/types/router/core/transition/interface.d.ts +819 -0
  230. package/types/router/core/transition/rejectFactory.d.ts +103 -0
  231. package/types/router/core/transition/transition.d.ts +527 -0
  232. package/types/router/core/transition/transitionEventType.d.ts +17 -0
  233. package/types/router/core/transition/transitionHook.d.ts +88 -0
  234. package/types/router/core/transition/transitionService.d.ts +187 -0
  235. package/types/router/core/url/index.d.ts +8 -0
  236. package/types/router/core/url/interface.d.ts +156 -0
  237. package/types/router/core/url/urlConfig.d.ts +141 -0
  238. package/types/router/core/url/urlMatcher.d.ts +180 -0
  239. package/types/router/core/url/urlMatcherFactory.d.ts +52 -0
  240. package/types/router/core/url/urlRouter.d.ts +85 -0
  241. package/types/router/core/url/urlRule.d.ts +120 -0
  242. package/types/router/core/url/urlRules.d.ts +244 -0
  243. package/types/router/core/url/urlService.d.ts +206 -0
  244. package/types/router/core/vanilla.d.ts +1 -0
  245. package/types/router/core/view/index.d.ts +2 -0
  246. package/types/router/core/view/interface.d.ts +46 -0
  247. package/types/router/core/view/view.d.ts +167 -0
  248. package/types/router/directives/stateDirectives.d.ts +3 -0
  249. package/types/router/directives/viewDirective.d.ts +143 -0
  250. package/types/router/index.d.ts +19 -0
  251. package/types/router/interface.d.ts +491 -0
  252. package/types/router/legacy/resolveService.d.ts +44 -0
  253. package/types/router/legacy/stateEvents.d.ts +123 -0
  254. package/types/router/locationServices.d.ts +43 -0
  255. package/types/router/services.d.ts +15 -0
  256. package/types/router/stateFilters.d.ts +11 -0
  257. package/types/router/stateProvider.d.ts +254 -0
  258. package/types/router/statebuilders/onEnterExitRetain.d.ts +12 -0
  259. package/types/router/statebuilders/views.d.ts +41 -0
  260. package/types/router/templateFactory.d.ts +84 -0
  261. package/types/router/viewScroll.d.ts +9 -0
  262. package/src/animations/animate.css.md +0 -263
  263. package/src/animations/animate.md +0 -933
  264. package/src/router/adapter/statebuilders/onEnterExitRetain.js +0 -29
  265. package/src/router/core/common/coreservices.js +0 -15
  266. package/src/router/core/common/safeConsole.js +0 -37
  267. package/src/router/core/interface.js +0 -3
  268. package/src/router/core/resolve/interface.js +0 -10
  269. package/src/router/core/router.js +0 -203
  270. package/src/router/core/url/interface.js +0 -1
  271. package/src/router/core/view/interface.js +0 -1
  272. /package/src/router/{core/common → common}/glob.js +0 -0
  273. /package/src/router/{core/hooks → hooks}/ignoredTransition.js +0 -0
  274. /package/src/router/{core/hooks → hooks}/invalidTransition.js +0 -0
  275. /package/src/router/{core/hooks → hooks}/onEnterExitRetain.js +0 -0
  276. /package/src/router/{core/hooks → hooks}/url.js +0 -0
  277. /package/src/router/{core/params → params}/README.md +0 -0
  278. /package/src/router/{core/state → state}/README.md +0 -0
  279. /package/src/router/{adapter/stateFilters.js → stateFilters.js} +0 -0
  280. /package/src/router/{core/transition → transition}/interface.js +0 -0
  281. /package/src/router/{core/transition → transition}/transitionEventType.js +0 -0
  282. /package/src/{router/core/common → shared}/hof.js +0 -0
  283. /package/test/{ng → core}/cache-factor.spec.js +0 -0
  284. /package/test/{ng → core}/controller-provider.spec.js +0 -0
  285. /package/test/{ng → core}/cookie-reader.spec.js +0 -0
  286. /package/test/{ng → core}/document.spec.js +0 -0
  287. /package/test/{ng → core}/filter.spec.js +0 -0
  288. /package/test/{ng → core}/http-backend.spec.js +0 -0
  289. /package/test/{ng → core}/interpolate.spec.js +0 -0
  290. /package/test/{ng → core}/interval.spec.js +0 -0
  291. /package/test/{ng → core}/location.spec.js +0 -0
  292. /package/test/{ng → core}/q.spec.js +0 -0
  293. /package/test/{ng → core}/root-element.spec.js +0 -0
  294. /package/test/{ng → core}/sanitize-uri.spec.js +0 -0
  295. /package/test/{ng → core}/sce.spec.js +0 -0
  296. /package/test/{ng → core}/template-request.spec.js +0 -0
  297. /package/test/{ng → core}/timeout.spec.js +0 -0
  298. /package/test/{ng → core}/url-utils.spec.js +0 -0
  299. /package/{src/router/adapter/interface.js → types/router/injectables.d.ts} +0 -0
@@ -0,0 +1,370 @@
1
+ import { StateObject } from '../state/stateObject';
2
+ export declare const root: any;
3
+ export declare const fromJson: any;
4
+ export declare const toJson: any;
5
+ export declare const forEach: any;
6
+ export declare const extend: typeof _extend;
7
+ export declare const equals: any;
8
+ export declare function identity(x: any): any;
9
+ export declare function noop(): any;
10
+ export declare type Mapper<X, T> = (x: X, key?: string | number) => T;
11
+ export interface TypedMap<T> {
12
+ [key: string]: T;
13
+ }
14
+ export declare type Predicate<X> = (x?: X) => boolean;
15
+ export declare type PredicateBinary<X, Y> = (x?: X, y?: Y) => boolean;
16
+ /**
17
+ * An ng1-style injectable
18
+ *
19
+ * This could be a (non-minified) function such as:
20
+ * ```js
21
+ * function injectableFunction(SomeDependency) {
22
+ *
23
+ * }
24
+ * ```
25
+ *
26
+ * or an explicitly annotated function (minify safe)
27
+ * ```js
28
+ * injectableFunction.$inject = [ 'SomeDependency' ];
29
+ * function injectableFunction(SomeDependency) {
30
+ *
31
+ * }
32
+ * ```
33
+ *
34
+ * or an array style annotated function (minify safe)
35
+ * ```js
36
+ * ['SomeDependency', function injectableFunction(SomeDependency) {
37
+ *
38
+ * }];
39
+ * ```
40
+ */
41
+ export declare type IInjectable = Function | any[];
42
+ export interface Obj extends Object {
43
+ [key: string]: any;
44
+ }
45
+ /**
46
+ * Builds proxy functions on the `to` object which pass through to the `from` object.
47
+ *
48
+ * For each key in `fnNames`, creates a proxy function on the `to` object.
49
+ * The proxy function calls the real function on the `from` object.
50
+ *
51
+ *
52
+ * #### Example:
53
+ * This example creates an new class instance whose functions are prebound to the new'd object.
54
+ * ```js
55
+ * class Foo {
56
+ * constructor(data) {
57
+ * // Binds all functions from Foo.prototype to 'this',
58
+ * // then copies them to 'this'
59
+ * bindFunctions(Foo.prototype, this, this);
60
+ * this.data = data;
61
+ * }
62
+ *
63
+ * log() {
64
+ * console.log(this.data);
65
+ * }
66
+ * }
67
+ *
68
+ * let myFoo = new Foo([1,2,3]);
69
+ * var logit = myFoo.log;
70
+ * logit(); // logs [1, 2, 3] from the myFoo 'this' instance
71
+ * ```
72
+ *
73
+ * #### Example:
74
+ * This example creates a bound version of a service function, and copies it to another object
75
+ * ```
76
+ *
77
+ * var SomeService = {
78
+ * this.data = [3, 4, 5];
79
+ * this.log = function() {
80
+ * console.log(this.data);
81
+ * }
82
+ * }
83
+ *
84
+ * // Constructor fn
85
+ * function OtherThing() {
86
+ * // Binds all functions from SomeService to SomeService,
87
+ * // then copies them to 'this'
88
+ * bindFunctions(SomeService, this, SomeService);
89
+ * }
90
+ *
91
+ * let myOtherThing = new OtherThing();
92
+ * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'
93
+ * ```
94
+ *
95
+ * @param source A function that returns the source object which contains the original functions to be bound
96
+ * @param target A function that returns the target object which will receive the bound functions
97
+ * @param bind A function that returns the object which the functions will be bound to
98
+ * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)
99
+ * @param latebind If true, the binding of the function is delayed until the first time it's invoked
100
+ */
101
+ export declare function createProxyFunctions(source: Function, target: Obj, bind: Function, fnNames?: string[], latebind?: boolean): Obj;
102
+ /**
103
+ * prototypal inheritance helper.
104
+ * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it
105
+ */
106
+ export declare const inherit: (parent: Obj, extra?: Obj) => any;
107
+ /** Given an array, returns true if the object is found in the array, (using indexOf) */
108
+ export declare const inArray: typeof _inArray;
109
+ export declare function _inArray(array: any[], obj: any): boolean;
110
+ export declare function _inArray(array: any[]): (obj: any) => boolean;
111
+ /**
112
+ * Given an array, and an item, if the item is found in the array, it removes it (in-place).
113
+ * The same array is returned
114
+ */
115
+ export declare const removeFrom: typeof _removeFrom;
116
+ export declare function _removeFrom<T>(array: T[], obj: T): T[];
117
+ export declare function _removeFrom<T>(array: T[]): (obj: T) => T[];
118
+ /** pushes a values to an array and returns the value */
119
+ export declare const pushTo: typeof _pushTo;
120
+ export declare function _pushTo<T>(arr: T[], val: T): T;
121
+ export declare function _pushTo<T>(arr: T[]): (val: T) => T;
122
+ /** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */
123
+ export declare const deregAll: (functions: Function[]) => void;
124
+ /**
125
+ * Applies a set of defaults to an options object. The options object is filtered
126
+ * to only those properties of the objects in the defaultsList.
127
+ * Earlier objects in the defaultsList take precedence when applying defaults.
128
+ */
129
+ export declare function defaults(opts: any, ...defaultsList: Obj[]): any;
130
+ /** Reduce function that merges each element of the list into a single object, using extend */
131
+ export declare const mergeR: (memo: Obj, item: Obj) => any;
132
+ /**
133
+ * Finds the common ancestor path between two states.
134
+ *
135
+ * @param {Object} first The first state.
136
+ * @param {Object} second The second state.
137
+ * @return {Array} Returns an array of state names in descending order, not including the root.
138
+ */
139
+ export declare function ancestors(first: StateObject, second: StateObject): StateObject[];
140
+ /**
141
+ * Return a copy of the object only containing the whitelisted properties.
142
+ *
143
+ * #### Example:
144
+ * ```
145
+ * var foo = { a: 1, b: 2, c: 3 };
146
+ * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }
147
+ * ```
148
+ * @param obj the source object
149
+ * @param propNames an Array of strings, which are the whitelisted property names
150
+ */
151
+ export declare function pick(obj: Obj, propNames: string[]): Obj;
152
+ /**
153
+ * Return a copy of the object omitting the blacklisted properties.
154
+ *
155
+ * @example
156
+ * ```
157
+ *
158
+ * var foo = { a: 1, b: 2, c: 3 };
159
+ * var ab = omit(foo, ['a', 'b']); // { c: 3 }
160
+ * ```
161
+ * @param obj the source object
162
+ * @param propNames an Array of strings, which are the blacklisted property names
163
+ */
164
+ export declare function omit(obj: Obj, propNames: string[]): Obj;
165
+ /** Given an array of objects, maps each element to a named property of the element. */
166
+ export declare function pluck<T>(collection: Obj[], propName: string): T[];
167
+ /** Given an object, maps each property of the object to a named property of the property. */
168
+ export declare function pluck(collection: {
169
+ [key: string]: any;
170
+ }, propName: string): {
171
+ [key: string]: any;
172
+ };
173
+ /** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */
174
+ export declare function filter<T>(collection: T[], callback: (t: T, key?: number) => boolean): T[];
175
+ /** Given an object, returns a new object with only those properties that passed the callback predicate */
176
+ export declare function filter<T>(collection: TypedMap<T>, callback: (t: T, key?: string) => boolean): TypedMap<T>;
177
+ /** Given an object, return the first property of that object which passed the callback predicate */
178
+ export declare function find<T>(collection: TypedMap<T>, callback: Predicate<T>): T;
179
+ /** Given an array of objects, returns the first object which passed the callback predicate */
180
+ export declare function find<T>(collection: T[], callback: Predicate<T>): T;
181
+ /** Given an object, returns a new object, where each property is transformed by the callback function */
182
+ export declare let mapObj: <T, U>(collection: {
183
+ [key: string]: T;
184
+ }, callback: Mapper<T, U>, target?: typeof collection) => {
185
+ [key: string]: U;
186
+ };
187
+ /** Given an array, returns a new array, where each element is transformed by the callback function */
188
+ export declare function map<T, U>(collection: T[], callback: Mapper<T, U>, target?: typeof collection): U[];
189
+ export declare function map<T, U>(collection: {
190
+ [key: string]: T;
191
+ }, callback: Mapper<T, U>, target?: typeof collection): {
192
+ [key: string]: U;
193
+ };
194
+ /**
195
+ * Given an object, return its enumerable property values
196
+ *
197
+ * @example
198
+ * ```
199
+ *
200
+ * let foo = { a: 1, b: 2, c: 3 }
201
+ * let vals = values(foo); // [ 1, 2, 3 ]
202
+ * ```
203
+ */
204
+ export declare const values: <T>(obj: TypedMap<T>) => T[];
205
+ /**
206
+ * Reduce function that returns true if all of the values are truthy.
207
+ *
208
+ * @example
209
+ * ```
210
+ *
211
+ * let vals = [ 1, true, {}, "hello world"];
212
+ * vals.reduce(allTrueR, true); // true
213
+ *
214
+ * vals.push(0);
215
+ * vals.reduce(allTrueR, true); // false
216
+ * ```
217
+ */
218
+ export declare const allTrueR: (memo: boolean, elem: any) => any;
219
+ /**
220
+ * Reduce function that returns true if any of the values are truthy.
221
+ *
222
+ * * @example
223
+ * ```
224
+ *
225
+ * let vals = [ 0, null, undefined ];
226
+ * vals.reduce(anyTrueR, true); // false
227
+ *
228
+ * vals.push("hello world");
229
+ * vals.reduce(anyTrueR, true); // true
230
+ * ```
231
+ */
232
+ export declare const anyTrueR: (memo: boolean, elem: any) => any;
233
+ /**
234
+ * Reduce function which un-nests a single level of arrays
235
+ * @example
236
+ * ```
237
+ *
238
+ * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ];
239
+ * input.reduce(unnestR, []) // [ "a", "b", "c", "d", [ "double, "nested" ] ]
240
+ * ```
241
+ */
242
+ export declare const unnestR: (memo: any[], elem: any[]) => any[];
243
+ /**
244
+ * Reduce function which recursively un-nests all arrays
245
+ *
246
+ * @example
247
+ * ```
248
+ *
249
+ * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ];
250
+ * input.reduce(unnestR, []) // [ "a", "b", "c", "d", "double, "nested" ]
251
+ * ```
252
+ */
253
+ export declare const flattenR: (memo: any[], elem: any) => any[];
254
+ /**
255
+ * Reduce function that pushes an object to an array, then returns the array.
256
+ * Mostly just for [[flattenR]] and [[uniqR]]
257
+ */
258
+ export declare function pushR(arr: any[], obj: any): any[];
259
+ /** Reduce function that filters out duplicates */
260
+ export declare const uniqR: <T>(acc: T[], token: T) => T[];
261
+ /**
262
+ * Return a new array with a single level of arrays unnested.
263
+ *
264
+ * @example
265
+ * ```
266
+ *
267
+ * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ];
268
+ * unnest(input) // [ "a", "b", "c", "d", [ "double, "nested" ] ]
269
+ * ```
270
+ */
271
+ export declare const unnest: (arr: any[]) => any;
272
+ /**
273
+ * Return a completely flattened version of an array.
274
+ *
275
+ * @example
276
+ * ```
277
+ *
278
+ * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ];
279
+ * flatten(input) // [ "a", "b", "c", "d", "double, "nested" ]
280
+ * ```
281
+ */
282
+ export declare const flatten: (arr: any[]) => any;
283
+ /**
284
+ * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.
285
+ * @example
286
+ * ```
287
+ *
288
+ * let isNumber = (obj) => typeof(obj) === 'number';
289
+ * let allNumbers = [ 1, 2, 3, 4, 5 ];
290
+ * allNumbers.filter(assertPredicate(isNumber)); //OK
291
+ *
292
+ * let oneString = [ 1, 2, 3, 4, "5" ];
293
+ * oneString.filter(assertPredicate(isNumber, "Not all numbers")); // throws Error(""Not all numbers"");
294
+ * ```
295
+ */
296
+ export declare const assertPredicate: <T>(predicate: Predicate<T>, errMsg: string | Function) => Predicate<T>;
297
+ /**
298
+ * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.
299
+ * @example
300
+ * ```
301
+ *
302
+ * var data = { foo: 1, bar: 2 };
303
+ *
304
+ * let keys = [ 'foo', 'bar' ]
305
+ * let values = keys.map(assertMap(key => data[key], "Key not found"));
306
+ * // values is [1, 2]
307
+ *
308
+ * let keys = [ 'foo', 'bar', 'baz' ]
309
+ * let values = keys.map(assertMap(key => data[key], "Key not found"));
310
+ * // throws Error("Key not found")
311
+ * ```
312
+ */
313
+ export declare const assertMap: <T, U>(mapFn: (t: T) => U, errMsg: string | Function) => (t: T) => U;
314
+ export declare function assertFn(predicateOrMap: Function, errMsg?: string | Function): any;
315
+ /**
316
+ * Like _.pairs: Given an object, returns an array of key/value pairs
317
+ *
318
+ * @example
319
+ * ```
320
+ *
321
+ * pairs({ foo: "FOO", bar: "BAR }) // [ [ "foo", "FOO" ], [ "bar": "BAR" ] ]
322
+ * ```
323
+ */
324
+ export declare const pairs: (obj: Obj) => any[][];
325
+ /**
326
+ * Given two or more parallel arrays, returns an array of tuples where
327
+ * each tuple is composed of [ a[i], b[i], ... z[i] ]
328
+ *
329
+ * @example
330
+ * ```
331
+ *
332
+ * let foo = [ 0, 2, 4, 6 ];
333
+ * let bar = [ 1, 3, 5, 7 ];
334
+ * let baz = [ 10, 30, 50, 70 ];
335
+ * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]
336
+ * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]
337
+ * ```
338
+ */
339
+ export declare function arrayTuples(...args: any[]): any[];
340
+ /**
341
+ * Reduce function which builds an object from an array of [key, value] pairs.
342
+ *
343
+ * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.
344
+ *
345
+ * Each keyValueTuple should be an array with values [ key: string, value: any ]
346
+ *
347
+ * @example
348
+ * ```
349
+ *
350
+ * var pairs = [ ["fookey", "fooval"], ["barkey", "barval"] ]
351
+ *
352
+ * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})
353
+ * // pairsToObj == { fookey: "fooval", barkey: "barval" }
354
+ *
355
+ * // Or, more simply:
356
+ * var pairsToObj = pairs.reduce(applyPairs, {})
357
+ * // pairsToObj == { fookey: "fooval", barkey: "barval" }
358
+ * ```
359
+ */
360
+ export declare function applyPairs(memo: TypedMap<any>, keyValTuple: any[]): TypedMap<any>;
361
+ /** Get the last element of an array */
362
+ export declare function tail<T>(arr: T[]): T;
363
+ /**
364
+ * shallow copy from src to dest
365
+ */
366
+ export declare function copy(src: Obj, dest?: Obj): any;
367
+ /** Like Object.assign() */
368
+ export declare function _extend(toObj: Obj, ...fromObjs: Obj[]): any;
369
+ export declare const silenceUncaughtInPromise: (promise: Promise<any>) => Promise<any>;
370
+ export declare const silentRejection: (error: any) => Promise<any>;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * This module is a stub for core services such as Dependency Injection or Browser Location.
3
+ * Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ import { IInjectable, Obj } from './common';
8
+ import { Disposable } from '../interface';
9
+ import { UrlConfig, UrlService } from '../url';
10
+ export declare const makeStub: <T>(service: string, methods: (keyof T)[]) => T;
11
+ declare const services: CoreServices;
12
+ export interface $QLikeDeferred {
13
+ resolve: (val?: any) => void;
14
+ reject: (reason?: any) => void;
15
+ promise: Promise<any>;
16
+ }
17
+ export interface $QLike {
18
+ when<T>(value?: T | PromiseLike<T>): Promise<T>;
19
+ reject<T>(reason: any): Promise<T>;
20
+ defer(): $QLikeDeferred;
21
+ all(promises: {
22
+ [key: string]: Promise<any>;
23
+ }): Promise<any>;
24
+ all(promises: Promise<any>[]): Promise<any[]>;
25
+ }
26
+ export interface $InjectorLike {
27
+ strictDi?: boolean;
28
+ get(token: any): any;
29
+ get<T>(token: any): T;
30
+ has(token: any): boolean;
31
+ invoke(fn: IInjectable, context?: any, locals?: Obj): any;
32
+ annotate(fn: IInjectable, strictDi?: boolean): any[];
33
+ }
34
+ export interface CoreServices {
35
+ $q: $QLike;
36
+ $injector: $InjectorLike;
37
+ }
38
+ /**
39
+ * Handles low level URL read/write
40
+ *
41
+ * This service handles low level reads and updates of the URL and listens for url changes.
42
+ * Implementors should pass these through to the underlying URL mechanism.
43
+ * The underlying URL mechanism might be browser APIs, framework APIs, or some 3rd party URL management library.
44
+ *
45
+ * UI-Router Core includes three basic implementations:
46
+ *
47
+ * - [[PushStateLocationService]]
48
+ * - [[HashLocationService]]
49
+ * - [[MemoryLocationService]]
50
+ */
51
+ export interface LocationServices extends Disposable {
52
+ /** See: [[UrlService.url]] */ url: UrlService['url'];
53
+ /** See: [[UrlService.path]] */ path: UrlService['path'];
54
+ /** See: [[UrlService.search]] */ search: UrlService['search'];
55
+ /** See: [[UrlService.hash]] */ hash: UrlService['hash'];
56
+ /** See: [[UrlService.onChange]] */ onChange: UrlService['onChange'];
57
+ }
58
+ /**
59
+ * Returns low level URL configuration and metadata
60
+ *
61
+ * This service returns information about the location configuration.
62
+ * This service is primarily used when building URLs (e.g., for `hrefs`)
63
+ *
64
+ * Implementors should pass these through to the underlying URL APIs.
65
+ * The underlying URL mechanism might be browser APIs, framework APIs, or some 3rd party URL management library.
66
+ *
67
+ * UI-Router Core includes two basic implementations:
68
+ *
69
+ * - [[BrowserLocationConfig]]
70
+ * - [[MemoryLocationConfig]]
71
+ */
72
+ export interface LocationConfig extends Disposable {
73
+ /** See: [[UrlConfig.port]] */ port: UrlConfig['port'];
74
+ /** See: [[UrlConfig.protocol]] */ protocol: UrlConfig['protocol'];
75
+ /** See: [[UrlConfig.host]] */ host: UrlConfig['host'];
76
+ /** See: [[UrlConfig.baseHref]] */ baseHref: UrlConfig['baseHref'];
77
+ /** See: [[UrlConfig.html5Mode]] */ html5Mode: UrlConfig['html5Mode'];
78
+ /** See: [[UrlConfig.hashPrefix]] */ hashPrefix: UrlConfig['hashPrefix'];
79
+ }
80
+ export { services };
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Matches state names using glob-like pattern strings.
3
+ *
4
+ * Globs can be used in specific APIs including:
5
+ *
6
+ * - [[StateService.is]]
7
+ * - [[StateService.includes]]
8
+ * - The first argument to Hook Registration functions like [[TransitionService.onStart]]
9
+ * - [[HookMatchCriteria]] and [[HookMatchCriterion]]
10
+ *
11
+ * A `Glob` string is a pattern which matches state names.
12
+ * Nested state names are split into segments (separated by a dot) when processing.
13
+ * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']
14
+ *
15
+ * Globs work according to the following rules:
16
+ *
17
+ * ### Exact match:
18
+ *
19
+ * The glob `'A.B'` matches the state named exactly `'A.B'`.
20
+ *
21
+ * | Glob |Matches states named|Does not match state named|
22
+ * |:------------|:--------------------|:---------------------|
23
+ * | `'A'` | `'A'` | `'B'` , `'A.C'` |
24
+ * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` |
25
+ * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`|
26
+ *
27
+ * ### Single star (`*`)
28
+ *
29
+ * A single star (`*`) is a wildcard that matches exactly one segment.
30
+ *
31
+ * | Glob |Matches states named |Does not match state named |
32
+ * |:------------|:---------------------|:--------------------------|
33
+ * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` |
34
+ * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` |
35
+ * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|
36
+ *
37
+ * ### Double star (`**`)
38
+ *
39
+ * A double star (`'**'`) is a wildcard that matches *zero or more segments*
40
+ *
41
+ * | Glob |Matches states named |Does not match state named |
42
+ * |:------------|:----------------------------------------------|:----------------------------------|
43
+ * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) |
44
+ * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` |
45
+ * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |
46
+ * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |
47
+ *
48
+ * @packageDocumentation
49
+ */
50
+ export declare class Glob {
51
+ text: string;
52
+ glob: Array<string>;
53
+ regexp: RegExp;
54
+ /** Returns true if the string has glob-like characters in it */
55
+ static is(text: string): boolean;
56
+ /** Returns a glob from the string, or null if the string isn't Glob-like */
57
+ static fromString(text: string): Glob;
58
+ constructor(text: string);
59
+ matches(name: string): boolean;
60
+ }
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Higher order functions
3
+ *
4
+ * These utility functions are exported, but are subject to change without notice.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ import { Predicate } from './common';
9
+ /**
10
+ * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.
11
+ *
12
+ * Given a function with N parameters, returns a new function that supports partial application.
13
+ * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters,
14
+ * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to
15
+ * accept more parameters until all N parameters have been supplied.
16
+ *
17
+ *
18
+ * This contrived example uses a partially applied function as an predicate, which returns true
19
+ * if an object is found in both arrays.
20
+ * @example
21
+ * ```
22
+ * // returns true if an object is in both of the two arrays
23
+ * function inBoth(array1, array2, object) {
24
+ * return array1.indexOf(object) !== -1 &&
25
+ * array2.indexOf(object) !== 1;
26
+ * }
27
+ * let obj1, obj2, obj3, obj4, obj5, obj6, obj7
28
+ * let foos = [obj1, obj3]
29
+ * let bars = [obj3, obj4, obj5]
30
+ *
31
+ * // A curried "copy" of inBoth
32
+ * let curriedInBoth = curry(inBoth);
33
+ * // Partially apply both the array1 and array2
34
+ * let inFoosAndBars = curriedInBoth(foos, bars);
35
+ *
36
+ * // Supply the final argument; since all arguments are
37
+ * // supplied, the original inBoth function is then called.
38
+ * let obj1InBoth = inFoosAndBars(obj1); // false
39
+ *
40
+ * // Use the inFoosAndBars as a predicate.
41
+ * // Filter, on each iteration, supplies the final argument
42
+ * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];
43
+ * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]
44
+ *
45
+ * ```
46
+ *
47
+ * @param fn
48
+ * @returns {*|function(): (*|any)}
49
+ */
50
+ export declare function curry(fn: Function): Function;
51
+ /**
52
+ * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left
53
+ * given: f(x), g(x), h(x)
54
+ * let composed = compose(f,g,h)
55
+ * then, composed is: f(g(h(x)))
56
+ */
57
+ export declare function compose(): () => any;
58
+ /**
59
+ * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right
60
+ * given: f(x), g(x), h(x)
61
+ * let piped = pipe(f,g,h);
62
+ * then, piped is: h(g(f(x)))
63
+ */
64
+ export declare function pipe(...funcs: Function[]): (obj: any) => any;
65
+ /**
66
+ * Given a property name, returns a function that returns that property from an object
67
+ * let obj = { foo: 1, name: "blarg" };
68
+ * let getName = prop("name");
69
+ * getName(obj) === "blarg"
70
+ */
71
+ export declare const prop: (name: string) => (obj: any) => any;
72
+ /**
73
+ * Given a property name and a value, returns a function that returns a boolean based on whether
74
+ * the passed object has a property that matches the value
75
+ * let obj = { foo: 1, name: "blarg" };
76
+ * let getName = propEq("name", "blarg");
77
+ * getName(obj) === true
78
+ */
79
+ export declare const propEq: Function;
80
+ /**
81
+ * Given a dotted property name, returns a function that returns a nested property from an object, or undefined
82
+ * let obj = { id: 1, nestedObj: { foo: 1, name: "blarg" }, };
83
+ * let getName = prop("nestedObj.name");
84
+ * getName(obj) === "blarg"
85
+ * let propNotFound = prop("this.property.doesnt.exist");
86
+ * propNotFound(obj) === undefined
87
+ */
88
+ export declare const parse: (name: string) => any;
89
+ /**
90
+ * Given a function that returns a truthy or falsey value, returns a
91
+ * function that returns the opposite (falsey or truthy) value given the same inputs
92
+ */
93
+ export declare const not: (fn: Predicate<any>) => Predicate<any>;
94
+ /**
95
+ * Given two functions that return truthy or falsey values, returns a function that returns truthy
96
+ * if both functions return truthy for the given arguments
97
+ */
98
+ export declare function and(fn1: Predicate<any>, fn2: Predicate<any>): Predicate<any>;
99
+ /**
100
+ * Given two functions that return truthy or falsey values, returns a function that returns truthy
101
+ * if at least one of the functions returns truthy for the given arguments
102
+ */
103
+ export declare function or(fn1: Predicate<any>, fn2: Predicate<any>): Predicate<any>;
104
+ /**
105
+ * Check if all the elements of an array match a predicate function
106
+ *
107
+ * @param fn1 a predicate function `fn1`
108
+ * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array
109
+ */
110
+ export declare const all: (fn1: Predicate<any>) => (arr: any[]) => boolean;
111
+ export declare const any: (fn1: Predicate<any>) => (arr: any[]) => boolean;
112
+ /** Given a class, returns a Predicate function that returns true if the object is of that class */
113
+ export declare const is: <T>(ctor: new (...args: any[]) => T) => (obj: any) => obj is T;
114
+ /** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */
115
+ export declare const eq: (comp: any) => Predicate<any>;
116
+ /** Given a value, returns a function which returns the value */
117
+ export declare const val: <T>(v: T) => () => T;
118
+ export declare function invoke(fnName: string): Function;
119
+ export declare function invoke(fnName: string, args: any[]): Function;
120
+ /**
121
+ * Sorta like Pattern Matching (a functional programming conditional construct)
122
+ *
123
+ * See http://c2.com/cgi/wiki?PatternMatching
124
+ *
125
+ * This is a conditional construct which allows a series of predicates and output functions
126
+ * to be checked and then applied. Each predicate receives the input. If the predicate
127
+ * returns truthy, then its matching output function (mapping function) is provided with
128
+ * the input and, then the result is returned.
129
+ *
130
+ * Each combination (2-tuple) of predicate + output function should be placed in an array
131
+ * of size 2: [ predicate, mapFn ]
132
+ *
133
+ * These 2-tuples should be put in an outer array.
134
+ *
135
+ * @example
136
+ * ```
137
+ *
138
+ * // Here's a 2-tuple where the first element is the isString predicate
139
+ * // and the second element is a function that returns a description of the input
140
+ * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];
141
+ *
142
+ * // Second tuple: predicate "isNumber", mapfn returns a description
143
+ * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];
144
+ *
145
+ * let third = [ (input) => input === null, (input) => `Oh, null...` ];
146
+ *
147
+ * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];
148
+ *
149
+ * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);
150
+ *
151
+ * console.log(descriptionOf(undefined)); // 'notdefined'
152
+ * console.log(descriptionOf(55)); // '(55) That's a number!'
153
+ * console.log(descriptionOf("foo")); // 'Here's your string foo'
154
+ * ```
155
+ *
156
+ * @param struct A 2D array. Each element of the array should be an array, a 2-tuple,
157
+ * with a Predicate and a mapping/output function
158
+ * @returns {function(any): *}
159
+ */
160
+ export declare function pattern(struct: Function[][]): Function;
@@ -0,0 +1,8 @@
1
+ export * from './common';
2
+ export * from './coreservices';
3
+ export * from './glob';
4
+ export * from './hof';
5
+ export * from './predicates';
6
+ export * from './queue';
7
+ export * from './strings';
8
+ export * from './trace';