angular-slickgrid 4.2.1 → 4.2.2

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 (205) hide show
  1. package/LICENSE +20 -20
  2. package/app/modules/angular-slickgrid/components/angular-slickgrid.component.d.ts +2 -2
  3. package/app/modules/angular-slickgrid/extensions/slickRowDetailView.d.ts +0 -2
  4. package/docs/assets/lib/multiple-select/README.md +17 -17
  5. package/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +14 -14
  6. package/esm2020/app/modules/angular-slickgrid/constants.mjs +1 -1
  7. package/esm2020/app/modules/angular-slickgrid/extensions/index.mjs +1 -1
  8. package/esm2020/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +2 -4
  9. package/esm2020/app/modules/angular-slickgrid/global-grid-options.mjs +1 -1
  10. package/esm2020/app/modules/angular-slickgrid/index.mjs +1 -1
  11. package/esm2020/app/modules/angular-slickgrid/models/angularComponentOutput.interface.mjs +1 -1
  12. package/esm2020/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +1 -1
  13. package/esm2020/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +1 -1
  14. package/esm2020/app/modules/angular-slickgrid/models/gridOption.interface.mjs +1 -1
  15. package/esm2020/app/modules/angular-slickgrid/models/index.mjs +1 -1
  16. package/esm2020/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +1 -1
  17. package/esm2020/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +1 -1
  18. package/esm2020/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +7 -10
  19. package/esm2020/app/modules/angular-slickgrid/services/angularUtil.service.mjs +4 -4
  20. package/esm2020/app/modules/angular-slickgrid/services/bsDropdown.service.mjs +4 -4
  21. package/esm2020/app/modules/angular-slickgrid/services/container.service.mjs +4 -4
  22. package/esm2020/app/modules/angular-slickgrid/services/index.mjs +1 -1
  23. package/esm2020/app/modules/angular-slickgrid/services/translater.service.mjs +4 -4
  24. package/esm2020/app/modules/angular-slickgrid/services/utilities.mjs +1 -1
  25. package/esm2020/app/modules/angular-slickgrid/slickgrid-config.mjs +1 -1
  26. package/esm2020/public_api.mjs +1 -1
  27. package/fesm2015/angular-slickgrid.mjs +32 -37
  28. package/fesm2015/angular-slickgrid.mjs.map +1 -1
  29. package/fesm2020/angular-slickgrid.mjs +32 -37
  30. package/fesm2020/angular-slickgrid.mjs.map +1 -1
  31. package/i18n/en.json +89 -89
  32. package/i18n/fr.json +90 -90
  33. package/{angular-slickgrid.d.ts → index.d.ts} +0 -0
  34. package/package.json +11 -11
  35. package/test/cypress/node_modules/@cypress/request/README.md +1038 -0
  36. package/test/cypress/node_modules/@cypress/xvfb/README.md +48 -0
  37. package/test/cypress/node_modules/@cypress/xvfb/node_modules/debug/README.md +437 -0
  38. package/test/cypress/node_modules/@types/node/README.md +16 -0
  39. package/test/cypress/node_modules/@types/sinonjs__fake-timers/README.md +16 -0
  40. package/test/cypress/node_modules/@types/sizzle/README.md +16 -0
  41. package/test/cypress/node_modules/@types/yauzl/README.md +16 -0
  42. package/test/cypress/node_modules/@types/yauzl/node_modules/@types/node/README.md +16 -0
  43. package/test/cypress/node_modules/aggregate-error/README.md +61 -0
  44. package/test/cypress/node_modules/ansi-colors/README.md +315 -0
  45. package/test/cypress/node_modules/ansi-escapes/README.md +245 -0
  46. package/test/cypress/node_modules/ansi-regex/README.md +78 -0
  47. package/test/cypress/node_modules/ansi-styles/README.md +152 -0
  48. package/test/cypress/node_modules/arch/README.md +71 -0
  49. package/test/cypress/node_modules/asn1/README.md +50 -0
  50. package/test/cypress/node_modules/assert-plus/README.md +162 -0
  51. package/test/cypress/node_modules/astral-regex/README.md +46 -0
  52. package/test/cypress/node_modules/async/README.md +60 -0
  53. package/test/cypress/node_modules/asynckit/README.md +233 -0
  54. package/test/cypress/node_modules/at-least-node/README.md +25 -0
  55. package/test/cypress/node_modules/aws-sign2/README.md +4 -0
  56. package/test/cypress/node_modules/aws4/README.md +183 -0
  57. package/test/cypress/node_modules/balanced-match/README.md +91 -0
  58. package/test/cypress/node_modules/base64-js/README.md +34 -0
  59. package/test/cypress/node_modules/bcrypt-pbkdf/README.md +45 -0
  60. package/test/cypress/node_modules/blob-util/README.md +623 -0
  61. package/test/cypress/node_modules/bluebird/README.md +57 -0
  62. package/test/cypress/node_modules/brace-expansion/README.md +129 -0
  63. package/test/cypress/node_modules/buffer/README.md +410 -0
  64. package/test/cypress/node_modules/buffer-crc32/README.md +47 -0
  65. package/test/cypress/node_modules/cachedir/README.md +27 -0
  66. package/test/cypress/node_modules/caseless/README.md +45 -0
  67. package/test/cypress/node_modules/chalk/README.md +293 -0
  68. package/test/cypress/node_modules/chalk/node_modules/supports-color/README.md +76 -0
  69. package/test/cypress/node_modules/check-more-types/README.md +952 -0
  70. package/test/cypress/node_modules/ci-info/README.md +114 -0
  71. package/test/cypress/node_modules/clean-stack/README.md +76 -0
  72. package/test/cypress/node_modules/cli-cursor/README.md +55 -0
  73. package/test/cypress/node_modules/cli-table3/README.md +218 -0
  74. package/test/cypress/node_modules/cli-truncate/README.md +139 -0
  75. package/test/cypress/node_modules/color-convert/README.md +68 -0
  76. package/test/cypress/node_modules/color-name/README.md +11 -0
  77. package/test/cypress/node_modules/colorette/README.md +102 -0
  78. package/test/cypress/node_modules/colors/README.md +221 -0
  79. package/test/cypress/node_modules/combined-stream/README.md +138 -0
  80. package/test/cypress/node_modules/commander/README.md +737 -0
  81. package/test/cypress/node_modules/common-tags/README.md +687 -0
  82. package/test/cypress/node_modules/core-util-is/README.md +3 -0
  83. package/test/cypress/node_modules/cross-spawn/README.md +96 -0
  84. package/test/cypress/node_modules/cypress/README.md +25 -0
  85. package/test/cypress/node_modules/cypress/mount-utils/README.md +14 -0
  86. package/test/cypress/node_modules/cypress/react/README.md +414 -0
  87. package/test/cypress/node_modules/cypress/vue/README.md +678 -0
  88. package/test/cypress/node_modules/cypress/vue2/README.md +693 -0
  89. package/test/cypress/node_modules/dashdash/README.md +574 -0
  90. package/test/cypress/node_modules/dayjs/README.md +128 -0
  91. package/test/cypress/node_modules/debug/README.md +455 -0
  92. package/test/cypress/node_modules/delayed-stream/README.md +141 -0
  93. package/test/cypress/node_modules/ecc-jsbn/README.md +8 -0
  94. package/test/cypress/node_modules/emoji-regex/README.md +73 -0
  95. package/test/cypress/node_modules/end-of-stream/README.md +54 -0
  96. package/test/cypress/node_modules/enquirer/README.md +1752 -0
  97. package/test/cypress/node_modules/escape-string-regexp/README.md +27 -0
  98. package/test/cypress/node_modules/eventemitter2/README.md +809 -0
  99. package/test/cypress/node_modules/execa/README.md +656 -0
  100. package/test/cypress/node_modules/executable/README.md +64 -0
  101. package/test/cypress/node_modules/extend/README.md +81 -0
  102. package/test/cypress/node_modules/extract-zip/README.md +57 -0
  103. package/test/cypress/node_modules/extract-zip/node_modules/debug/README.md +455 -0
  104. package/test/cypress/node_modules/extsprintf/README.md +46 -0
  105. package/test/cypress/node_modules/fd-slicer/README.md +199 -0
  106. package/test/cypress/node_modules/figures/README.md +139 -0
  107. package/test/cypress/node_modules/forever-agent/README.md +4 -0
  108. package/test/cypress/node_modules/form-data/README.md +234 -0
  109. package/test/cypress/node_modules/fs-extra/README.md +264 -0
  110. package/test/cypress/node_modules/fs.realpath/README.md +33 -0
  111. package/test/cypress/node_modules/get-stream/README.md +124 -0
  112. package/test/cypress/node_modules/getos/README.md +79 -0
  113. package/test/cypress/node_modules/getpass/README.md +32 -0
  114. package/test/cypress/node_modules/glob/README.md +375 -0
  115. package/test/cypress/node_modules/global-dirs/README.md +72 -0
  116. package/test/cypress/node_modules/graceful-fs/README.md +133 -0
  117. package/test/cypress/node_modules/has-flag/README.md +89 -0
  118. package/test/cypress/node_modules/http-signature/README.md +80 -0
  119. package/test/cypress/node_modules/human-signals/README.md +155 -0
  120. package/test/cypress/node_modules/ieee754/README.md +51 -0
  121. package/test/cypress/node_modules/indent-string/README.md +70 -0
  122. package/test/cypress/node_modules/inflight/README.md +37 -0
  123. package/test/cypress/node_modules/inherits/README.md +42 -0
  124. package/test/cypress/node_modules/ini/README.md +102 -0
  125. package/test/cypress/node_modules/is-ci/README.md +50 -0
  126. package/test/cypress/node_modules/is-fullwidth-code-point/README.md +39 -0
  127. package/test/cypress/node_modules/is-installed-globally/README.md +31 -0
  128. package/test/cypress/node_modules/is-path-inside/README.md +63 -0
  129. package/test/cypress/node_modules/is-stream/README.md +57 -0
  130. package/test/cypress/node_modules/is-typedarray/README.md +16 -0
  131. package/test/cypress/node_modules/isexe/README.md +51 -0
  132. package/test/cypress/node_modules/isstream/README.md +66 -0
  133. package/test/cypress/node_modules/jsbn/README.md +175 -0
  134. package/test/cypress/node_modules/json-schema/README.md +3 -0
  135. package/test/cypress/node_modules/json-stringify-safe/README.md +52 -0
  136. package/test/cypress/node_modules/jsonfile/README.md +205 -0
  137. package/test/cypress/node_modules/jsonfile/node_modules/universalify/README.md +76 -0
  138. package/test/cypress/node_modules/jsprim/README.md +287 -0
  139. package/test/cypress/node_modules/lazy-ass/README.md +269 -0
  140. package/test/cypress/node_modules/listr2/README.md +17 -0
  141. package/test/cypress/node_modules/lodash/README.md +39 -0
  142. package/test/cypress/node_modules/lodash.once/README.md +18 -0
  143. package/test/cypress/node_modules/log-symbols/README.md +51 -0
  144. package/test/cypress/node_modules/log-update/README.md +97 -0
  145. package/test/cypress/node_modules/log-update/node_modules/slice-ansi/README.md +66 -0
  146. package/test/cypress/node_modules/log-update/node_modules/wrap-ansi/README.md +97 -0
  147. package/test/cypress/node_modules/lru-cache/README.md +166 -0
  148. package/test/cypress/node_modules/merge-stream/README.md +78 -0
  149. package/test/cypress/node_modules/mime-db/README.md +102 -0
  150. package/test/cypress/node_modules/mime-types/README.md +123 -0
  151. package/test/cypress/node_modules/mimic-fn/README.md +69 -0
  152. package/test/cypress/node_modules/minimatch/README.md +209 -0
  153. package/test/cypress/node_modules/ms/README.md +60 -0
  154. package/test/cypress/node_modules/npm-run-path/README.md +115 -0
  155. package/test/cypress/node_modules/once/README.md +79 -0
  156. package/test/cypress/node_modules/onetime/README.md +94 -0
  157. package/test/cypress/node_modules/ospath/README.md +53 -0
  158. package/test/cypress/node_modules/p-map/README.md +89 -0
  159. package/test/cypress/node_modules/path-is-absolute/README.md +59 -0
  160. package/test/cypress/node_modules/path-key/README.md +61 -0
  161. package/test/cypress/node_modules/pend/README.md +41 -0
  162. package/test/cypress/node_modules/performance-now/README.md +30 -0
  163. package/test/cypress/node_modules/pify/README.md +119 -0
  164. package/test/cypress/node_modules/pretty-bytes/README.md +131 -0
  165. package/test/cypress/node_modules/proxy-from-env/README.md +131 -0
  166. package/test/cypress/node_modules/psl/README.md +215 -0
  167. package/test/cypress/node_modules/pump/README.md +65 -0
  168. package/test/cypress/node_modules/punycode/README.md +122 -0
  169. package/test/cypress/node_modules/qs/README.md +475 -0
  170. package/test/cypress/node_modules/request-progress/README.md +78 -0
  171. package/test/cypress/node_modules/restore-cursor/README.md +26 -0
  172. package/test/cypress/node_modules/rimraf/README.md +101 -0
  173. package/test/cypress/node_modules/rxjs/README.md +147 -0
  174. package/test/cypress/node_modules/rxjs/_esm2015/README.md +147 -0
  175. package/test/cypress/node_modules/rxjs/_esm5/README.md +147 -0
  176. package/test/cypress/node_modules/rxjs/src/README.md +147 -0
  177. package/test/cypress/node_modules/safe-buffer/README.md +584 -0
  178. package/test/cypress/node_modules/safer-buffer/README.md +156 -0
  179. package/test/cypress/node_modules/semver/README.md +566 -0
  180. package/test/cypress/node_modules/shebang-command/README.md +34 -0
  181. package/test/cypress/node_modules/shebang-regex/README.md +33 -0
  182. package/test/cypress/node_modules/signal-exit/README.md +39 -0
  183. package/test/cypress/node_modules/slice-ansi/README.md +72 -0
  184. package/test/cypress/node_modules/sshpk/README.md +804 -0
  185. package/test/cypress/node_modules/string-width/README.md +50 -0
  186. package/test/cypress/node_modules/strip-ansi/README.md +46 -0
  187. package/test/cypress/node_modules/strip-final-newline/README.md +30 -0
  188. package/test/cypress/node_modules/supports-color/README.md +77 -0
  189. package/test/cypress/node_modules/throttleit/README.md +32 -0
  190. package/test/cypress/node_modules/tmp/README.md +365 -0
  191. package/test/cypress/node_modules/tough-cookie/README.md +527 -0
  192. package/test/cypress/node_modules/tslib/README.md +142 -0
  193. package/test/cypress/node_modules/tunnel-agent/README.md +4 -0
  194. package/test/cypress/node_modules/tweetnacl/README.md +459 -0
  195. package/test/cypress/node_modules/type-fest/README.md +760 -0
  196. package/test/cypress/node_modules/universalify/README.md +76 -0
  197. package/test/cypress/node_modules/untildify/README.md +30 -0
  198. package/test/cypress/node_modules/uuid/README.md +505 -0
  199. package/test/cypress/node_modules/verror/README.md +528 -0
  200. package/test/cypress/node_modules/verror/node_modules/extsprintf/README.md +46 -0
  201. package/test/cypress/node_modules/which/README.md +54 -0
  202. package/test/cypress/node_modules/wrap-ansi/README.md +91 -0
  203. package/test/cypress/node_modules/wrappy/README.md +36 -0
  204. package/test/cypress/node_modules/yallist/README.md +204 -0
  205. package/test/cypress/node_modules/yauzl/README.md +658 -0
@@ -0,0 +1,952 @@
1
+ # check-more-types
2
+
3
+ > Large collection of predicates, inspired by [check-types.js](https://github.com/philbooth/check-types.js)
4
+
5
+ [![NPM][check-more-types-icon] ][check-more-types-url]
6
+
7
+ [![manpm](https://img.shields.io/badge/manpm-%E2%9C%93-3399ff.svg)](https://github.com/bahmutov/manpm)
8
+ [![Build status][check-more-types-ci-image] ][check-more-types-ci-url]
9
+ [![dependencies][check-more-types-dependencies-image] ][check-more-types-dependencies-url]
10
+ [![devdependencies][check-more-types-devdependencies-image] ][check-more-types-devdependencies-url]
11
+
12
+ [![semantic-release][semantic-image] ][semantic-url]
13
+ [![Coverage Status][check-more-types-coverage-image] ][check-more-types-coverage-url]
14
+ [![Codacy Badge][check-more-types-codacy-image] ][check-more-types-codacy-url]
15
+ [![Code Climate][check-more-types-code-climate-image] ][check-more-types-code-climate-url]
16
+ ![issue](http://issuestats.com/github/kensho/check-more-types/badge/issue)
17
+
18
+ [check-more-types-icon]: https://nodei.co/npm/check-more-types.png?downloads=true
19
+ [check-more-types-url]: https://npmjs.org/package/check-more-types
20
+ [check-more-types-ci-image]: https://travis-ci.org/kensho/check-more-types.png?branch=master
21
+ [check-more-types-ci-url]: https://travis-ci.org/kensho/check-more-types
22
+ [check-more-types-coverage-image]: https://coveralls.io/repos/kensho/check-more-types/badge.png
23
+ [check-more-types-coverage-url]: https://coveralls.io/r/kensho/check-more-types
24
+ [check-more-types-dependencies-image]: https://david-dm.org/kensho/check-more-types.png
25
+ [check-more-types-dependencies-url]: https://david-dm.org/kensho/check-more-types
26
+ [check-more-types-devdependencies-image]: https://david-dm.org/kensho/check-more-types/dev-status.png
27
+ [check-more-types-devdependencies-url]: https://david-dm.org/kensho/check-more-types#info=devDependencies
28
+ [check-more-types-codacy-image]: https://www.codacy.com/project/badge/25cb5d1410c7497cb057d887d1f3ea23
29
+ [check-more-types-codacy-url]: https://www.codacy.com/public/kensho/check-more-types.git
30
+ [check-more-types-code-climate-image]: https://codeclimate.com/github/kensho/check-more-types/badges/gpa.svg
31
+ [check-more-types-code-climate-url]: https://codeclimate.com/github/kensho/check-more-types
32
+ [semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
33
+ [semantic-url]: https://github.com/semantic-release/semantic-release
34
+
35
+
36
+
37
+ See [Readable conditions](http://glebbahmutov.com/blog/readable-conditions-using-check-types/)
38
+ for advice and examples.
39
+
40
+ ## Install
41
+
42
+ **node:** `npm install check-more-types --save`
43
+
44
+ var check = require('check-more-types');
45
+ console.assert(check.bit(1), 'check.bit works');
46
+
47
+ **browser** `bower install check-more-types --save`
48
+
49
+ <script src="check-more-types.js"></script>
50
+
51
+
52
+ * **API**
53
+ * [check.email](#checkemail)
54
+ * [check.extension (alias `check.ext`)](#checkextension-alias-checkext)
55
+ * [check.odd and check.even](#checkodd-and-checkeven)
56
+ * [check.port](#checkport)
57
+ * [check.systemPort](#checksystemport)
58
+ * [check.userPort](#checkuserport)
59
+ * [check.error](#checkerror)
60
+ * [check.https (alias `secure`)](#checkhttps-alias-secure)
61
+ * [check.http](#checkhttp)
62
+ * [check.webUrl (alias `url`)](#checkweburl-alias-url)
63
+ * [check.contains](#checkcontains)
64
+ * [check.defined](#checkdefined)
65
+ * [check.semver](#checksemver)
66
+ * [check.positiveNumber (alias `check.positive`)](#checkpositivenumber-alias-checkpositive)
67
+ * [check.negativeNumber (alias `check.negative`)](#checknegativenumber-alias-checknegative)
68
+ * [check.type](#checktype)
69
+ * [check.bit](#checkbit)
70
+ * [check.primitive](#checkprimitive)
71
+ * [check.zero](#checkzero)
72
+ * [check.git](#checkgit)
73
+ * [check.commitId](#checkcommitid)
74
+ * [check.shortCommitId](#checkshortcommitid)
75
+ * [check.index](#checkindex)
76
+ * [check.oneOf](#checkoneof)
77
+ * [check.same](#checksame)
78
+ * [check.length](#checklength)
79
+ * [check.sameLength](#checksamelength)
80
+ * [check.allSame](#checkallsame)
81
+ * [check.unit](#checkunit)
82
+ * [check.hexRgb](#checkhexrgb)
83
+ * [check.bool](#checkbool)
84
+ * [check.emptyString](#checkemptystring)
85
+ * [check.empty](#checkempty)
86
+ * [check.unempty](#checkunempty)
87
+ * [check.unemptyArray](#checkunemptyarray)
88
+ * [check.arrayOfStrings (alias `strings`)](#checkarrayofstrings-alias-strings)
89
+ * [check.numbers](#checknumbers)
90
+ * [check.arrayOf](#checkarrayof)
91
+ * [check.badItems](#checkbaditems)
92
+ * [check.arrayOfArraysOfStrings](#checkarrayofarraysofstrings)
93
+ * [check.lowerCase](#checklowercase)
94
+ * [check.has(obj, property)](#checkhasobj-property)
95
+ * [check.all](#checkall)
96
+ * [check.schema](#checkschema)
97
+ * [check.schema bind](#checkschema-bind)
98
+ * [schema composition](#schema-composition)
99
+ * [check.raises(fn, validator)](#checkraisesfn-validator)
100
+ * [Modifiers](#modifiers)
101
+ * [check.maybe](#checkmaybe)
102
+ * [check.not](#checknot)
103
+ * [check.verify](#checkverify)
104
+ * [Adding your own predicates](#adding-your-own-predicates)
105
+ * [check.mixin(predicate, name)](#checkmixinpredicate-name)
106
+ * [check.mixin does not override](#checkmixin-does-not-override)
107
+ * [Defending a function](#defending-a-function)
108
+ * [check.defend(fn, predicates)](#checkdefendfn-predicates)
109
+ * [protects optional arguments](#protects-optional-arguments)
110
+ * [check.defend with messages](#checkdefend-with-messages)
111
+ * [check.defend in module pattern](#checkdefend-in-module-pattern)
112
+ * [Safe callback execution](#safe-callback-execution)
113
+ * [check.then](#checkthen)
114
+ * [check.found](#checkfound)
115
+ * [check.regexp](#checkregexp)
116
+ * [check.promise](#checkpromise)
117
+ * [check.validDate](#checkvaliddate)
118
+ * [check.equal](#checkequal)
119
+ * [check.or](#checkor)
120
+ * [check.and](#checkand)
121
+
122
+
123
+ #### check.number
124
+
125
+ `check.number` is part of the `check-types` library, but as a note, it does not pass
126
+ `null`, `undefined` or `NaN` values
127
+
128
+ ```js
129
+ check.number(null); // false
130
+ check.not.number(undefined); // true
131
+ check.number(NaN); // false
132
+ ```
133
+
134
+ #### check.email
135
+
136
+ Really simple regex email check. Should not be relied to be robust.
137
+
138
+ ```js
139
+ check.email('me@foo.bar') // true
140
+ check.email('me.foo.bar') // false
141
+ ```
142
+
143
+ #### check.extension (alias `check.ext`)
144
+
145
+ Confirms that given file name has expected extension
146
+
147
+ ```js
148
+ check.extension('txt', 'foo/bar.txt') // true
149
+ ```
150
+
151
+ It is curried, so you can create convenient methods
152
+
153
+ ```js
154
+ const isJs = check.extension('js')
155
+ isJs('script.js') // true
156
+ ```
157
+
158
+ There are a couple of convenient shortcuts, like `check.isJs`, `check.isJson`, `check.isJpg`
159
+
160
+ #### check.odd and check.even
161
+
162
+ Check if a number odd or even
163
+
164
+ ```js
165
+ check.odd(2) // false
166
+ check.odd(3) // true
167
+ check.even(2) // true
168
+ ```
169
+
170
+ #### check.port
171
+
172
+ Returns true if passed argument is positive number less or equal to largest
173
+ allowed port number 65535
174
+
175
+ #### check.systemPort
176
+
177
+ Returns true if passed argument is number between 0 and 1024
178
+
179
+ #### check.userPort
180
+
181
+ Returns true if passed argument is a port number and larger than 1024
182
+
183
+ #### check.error
184
+
185
+ Returns true if given argument is an instance of type `Error`
186
+
187
+ #### check.https (alias `secure`)
188
+
189
+ Returns true if the provided url starts with `https://`. Alias `secure`.
190
+
191
+ #### check.http
192
+
193
+ Returns true if the provided url starts with `http://`
194
+
195
+ #### check.webUrl (alias `url`)
196
+
197
+ Returns true if the given string is http or https url.
198
+
199
+ #### check.contains
200
+
201
+ Returns true if given array contains an item, or given string contains substring.
202
+
203
+ ```js
204
+ check.contains(['foo', 42], 'foo'); // true
205
+ check.contains('apple', 'pp'); // true
206
+ ```
207
+
208
+ #### check.defined
209
+
210
+ check.defined(0); // true
211
+ check.defined(1); // true
212
+ check.defined(true); // true
213
+ check.defined(false); // true
214
+ check.defined(null); // true
215
+ check.defined(''); // true
216
+ check.defined(); // false
217
+ check.defined(root.doesNotExist); // false
218
+ check.defined({}.doesNotExist); // false
219
+
220
+ ---
221
+
222
+ #### check.semver
223
+
224
+ check.semver('1.0.2'); // true
225
+ check.semver('1.0.2-alpha'); // false
226
+
227
+ ---
228
+
229
+ #### check.positiveNumber (alias `check.positive`)
230
+
231
+ ```js
232
+ check.positive(100); // true
233
+ check.not.positive(-1); // true
234
+ ```
235
+
236
+ ---
237
+
238
+ #### check.negativeNumber (alias `check.negative`)
239
+
240
+ ```js
241
+ check.negative(-10); // true
242
+ check.not.negativeNumber(1); // true
243
+ ```
244
+
245
+ ---
246
+
247
+ #### check.type
248
+
249
+ check.type('string', 'foo'); // true
250
+ check.type('number', 42); // true
251
+
252
+ `check.type` is curried.
253
+
254
+ ---
255
+
256
+ #### check.bit
257
+
258
+ check.bit(0); // true
259
+ check.bit(1); // true
260
+ check.bit('1'); // false
261
+ check.bit(2); // false
262
+ check.bit(true); // false
263
+
264
+ ---
265
+
266
+ #### check.primitive
267
+
268
+ Returns true for primitive JavaScript types
269
+
270
+ check.primitive(42); // true
271
+ check.primitive(true); // true
272
+ check.primitive('foo'); // true
273
+ check.primitive([]); // false
274
+
275
+ Also returns true for `Symbol` ES6 syntax.
276
+
277
+ ---
278
+
279
+ #### check.zero
280
+
281
+ check.zero(0); // true
282
+ check.zero(); // false
283
+ check.zero(null); // false
284
+
285
+ ---
286
+
287
+ #### check.git
288
+
289
+ check.git('url string');
290
+
291
+ ---
292
+
293
+ #### check.commitId
294
+
295
+ ---
296
+
297
+ #### check.shortCommitId
298
+
299
+ ---
300
+
301
+ #### check.index
302
+
303
+ ---
304
+
305
+ #### check.oneOf
306
+
307
+ var colors = ['red', 'green', 'blue'];
308
+ var color = 'green';
309
+ check.oneOf(colors, color); // true
310
+ check.oneOf(colors, 'brown'); // false
311
+
312
+ Function is curried
313
+
314
+ ---
315
+
316
+ #### check.same
317
+
318
+ var foo = {}
319
+ var bar = {}
320
+ check.same(foo, foo); // true
321
+ check.same(foo, bar); // false
322
+ // primitives are compared by value
323
+ check.same(0, 0); // true
324
+ check.same('foo', 'foo'); // true
325
+
326
+ `check.same` should produce same result as `===`.
327
+
328
+ ---
329
+
330
+ #### check.length
331
+
332
+ Confirms length of a string or an Array. The function is curried and
333
+ can guess the argument order
334
+
335
+ ```js
336
+ check.length([1, 2], 2); // true
337
+ check.length('foo', 3); // true
338
+ // argument order
339
+ check.length(3, 'foo'); // true
340
+ // curried call
341
+ check.length('foo')(3); // true
342
+ check.length(3)('foo'); // true
343
+ ```
344
+
345
+ ---
346
+
347
+ #### check.sameLength
348
+
349
+ check.sameLength([1, 2], ['a', 'b']); // true
350
+ check.sameLength('ab', 'cd'); // true
351
+ // different types
352
+ check.sameLength([1, 2], 'ab'); // false
353
+
354
+ ---
355
+
356
+ #### check.allSame
357
+
358
+ var foo = {}
359
+ var bar = {}
360
+ check.allSame([foo, foo, foo]); // true
361
+ check.allSame([foo, foo, bar]); // false
362
+ // primitives are compared by value
363
+ check.allSame([0, 0]); // true
364
+ check.allSame(['foo', 'foo', 'foo']); // true
365
+ check.allSame([false, 0]); // false
366
+
367
+ ---
368
+
369
+ #### check.unit
370
+
371
+ check.unit(0); // true
372
+ check.unit(1); // true
373
+ check.unit(0.1); // true
374
+ check.unit(1.2); // false
375
+ check.unit(-0.1); // false
376
+
377
+ ---
378
+
379
+ #### check.hexRgb
380
+
381
+ check.hexRgb('#FF00FF'); // true
382
+ check.hexRgb('#000'); // true
383
+ check.hexRgb('#aaffed'); // true
384
+ check.hexRgb('#00aaffed'); // false
385
+ check.hexRgb('aaffed'); // false
386
+
387
+ ---
388
+
389
+ #### check.bool
390
+
391
+ check.bool(true); // true
392
+ check.bool(false); // true
393
+ check.bool(0); // false
394
+ check.bool(1); // false
395
+ check.bool('1'); // false
396
+ check.bool(2); // false
397
+
398
+ ---
399
+
400
+ #### check.emptyString
401
+
402
+ check.emptyString(''); // true
403
+ check.emptyString(' '); // false
404
+ check.emptyString(0); // false
405
+ check.emptyString([]); // false
406
+
407
+ ---
408
+
409
+ #### check.empty
410
+
411
+ check.empty([]); // true
412
+ check.empty(''); // true
413
+ check.empty({}); // true
414
+ check.empty(0); // false
415
+ check.empty(['foo']); // false
416
+
417
+ ---
418
+
419
+ #### check.unempty
420
+
421
+ check.unempty([]); // false
422
+ check.unempty(''); // false
423
+ check.unempty({}); // false
424
+ check.unempty(0); // true
425
+ check.unempty(['foo']); // true
426
+ check.unempty('foo'); // true
427
+
428
+ ---
429
+
430
+ #### check.unemptyArray
431
+
432
+ check.unemptyArray(null); // false
433
+ check.unemptyArray(1); // false
434
+ check.unemptyArray({}); // false
435
+ check.unemptyArray([]); // false
436
+ check.unemptyArray(root.doesNotExist); // false
437
+ check.unemptyArray([1]); // true
438
+ check.unemptyArray(['foo', 'bar']); // true
439
+
440
+ ---
441
+
442
+ #### check.arrayOfStrings (alias `strings`)
443
+
444
+ // second argument is checkLowerCase
445
+ check.arrayOfStrings(['foo', 'Foo']); // true
446
+ check.arrayOfStrings(['foo', 'Foo'], true); // false
447
+ check.arrayOfStrings(['foo', 'bar'], true); // true
448
+ check.arrayOfStrings(['FOO', 'BAR'], true); // false
449
+
450
+ ---
451
+
452
+ #### check.numbers
453
+
454
+ Returns true if all items in an array are numbers
455
+
456
+ #### check.arrayOf
457
+
458
+ ```js
459
+ check.arrayOf(check.unemptyString, ['foo', '']); // false
460
+ check.arrayOf(check.unemptyString, ['foo', 'bar']); // true
461
+ // can be partially applied and combined with check.schema
462
+ var person = {
463
+ first: check.unemptyString,
464
+ last: check.unemptyString
465
+ };
466
+ var isPerson = check.schema.bind(null, person);
467
+ var arePeople = check.arrayOf.bind(null, isPerson);
468
+ var people = [{
469
+ first: 'foo',
470
+ last: 'bar'
471
+ }];
472
+ arePeople(people); // true
473
+ ```
474
+ ---
475
+
476
+ Why would you need `check.arrayOf(predicate, x)` and not simply use `x.every(predicate)`?
477
+ Because `x` might not be an Array.
478
+
479
+ #### check.badItems
480
+
481
+ Finds items that do not pass predicate
482
+
483
+ ```js
484
+ check.badItems(check.unemptyString, ['foo', '', 'bar']); // ['']
485
+ ```
486
+
487
+ #### check.arrayOfArraysOfStrings
488
+
489
+ // second argument is checkLowerCase
490
+ check.arrayOfArraysOfStrings([['foo'], ['bar'}}); // true
491
+ check.arrayOfArraysOfStrings([['foo'], ['bar'}}, true); // true
492
+ check.arrayOfArraysOfStrings([['foo'], ['BAR'}}, true); // false
493
+
494
+ ---
495
+
496
+ #### check.lowerCase
497
+
498
+ check.lowerCase('foo bar'); // true
499
+ check.lowerCase('*foo ^bar'); // true
500
+ check.lowerCase('fooBar'); // false
501
+ // non-strings return false
502
+ check.lowerCase(10); // false
503
+
504
+ ---
505
+
506
+ #### check.has(obj, property)
507
+
508
+ var obj = {
509
+ foo: 'foo',
510
+ bar: 0
511
+ }
512
+ check.has(obj, 'foo'); // true
513
+ check.has(obj, 'bar'); // true
514
+ check.has(obj, 'baz'); // false
515
+ // non-object returns false
516
+ check.has(5, 'foo'); // false
517
+ check.has('foo', 'length'); // true
518
+
519
+ ---
520
+
521
+ #### check.all
522
+
523
+ var obj = {
524
+ foo: 'foo',
525
+ bar: 'bar',
526
+ baz: 'baz'
527
+ }
528
+ var predicates = {
529
+ foo: check.unemptyString,
530
+ bar: function(value) {
531
+ return value === 'bar'
532
+ }
533
+ }
534
+ check.all(obj, predicates); // true
535
+
536
+ ---
537
+
538
+ #### check.schema
539
+
540
+ var obj = {
541
+ foo: 'foo',
542
+ bar: 'bar',
543
+ baz: 'baz'
544
+ }
545
+ var schema = {
546
+ foo: check.unemptyString,
547
+ bar: function(value) {
548
+ return value === 'bar'
549
+ }
550
+ }
551
+ check.schema(schema, obj); // true
552
+ check.schema(schema, {}); // false
553
+
554
+ `check.spec` is equivalent to `check.all` but with arguments reversed.
555
+ This makes it very convenient to create new validator functions using partial
556
+ argument application
557
+
558
+ The method is curried, thus you can easily create predicate function
559
+
560
+ ```js
561
+ var hasName = check.schema({ name: check.unemptyString });
562
+ hasName({ name: 'joe' }); // true
563
+ ```
564
+
565
+ #### check.schema bind
566
+
567
+ var personSchema = {
568
+ name: check.unemptyString,
569
+ age: check.positiveNumber
570
+ }
571
+ var isValidPerson = check.schema.bind(null, personSchema)
572
+ var h1 = {
573
+ name: 'joe',
574
+ age: 10
575
+ }
576
+ var h2 = {
577
+ name: 'ann'
578
+ // missing age property
579
+ }
580
+ isValidPerson(h1); // true
581
+ isValidPerson(h2); // false
582
+
583
+ If you want you can manually bind `check.schema` to first argument
584
+
585
+ var personSchema = {
586
+ name: check.unemptyString,
587
+ age: check.positiveNumber
588
+ };
589
+ var isValidPerson = check.schema.bind(null, personSchema);
590
+ var h1 = {
591
+ name: 'joe',
592
+ age: 10
593
+ };
594
+ var h2 = {
595
+ name: 'ann'
596
+ // missing age property
597
+ };
598
+ isValidPerson(h1); // true
599
+ isValidPerson(h2); // false
600
+
601
+ You can use `Function.prototype.bind` or any partial application method, for example
602
+ `_.partial(check.schema, personSchema);`.
603
+ Because bound schema parameter generates a valid function, you can nest checks using
604
+ schema composition. For example let us combine the reuse `isValidPerson` as part of
605
+ another check
606
+
607
+ #### schema composition
608
+
609
+ var teamSchema = {
610
+ manager: isValidPerson,
611
+ members: check.unemptyArray
612
+ }
613
+ var team = {
614
+ manager: {
615
+ name: 'jim',
616
+ age: 20
617
+ },
618
+ members: ['joe', 'ann']
619
+ }
620
+ check.schema(teamSchema, team); // true
621
+
622
+ ---
623
+
624
+ #### check.raises(fn, validator)
625
+
626
+ function foo() {
627
+ throw new Error('foo')
628
+ }
629
+
630
+ function bar() {}
631
+
632
+ function isValidError(err) {
633
+ return err.message === 'foo'
634
+ }
635
+
636
+ function isInvalid(err) {
637
+ check.instance(err, Error); // true
638
+ return false
639
+ }
640
+ check.raises(foo); // true
641
+ check.raises(bar); // false
642
+ check.raises(foo, isValidError); // true
643
+ check.raises(foo, isInvalid); // false
644
+
645
+ ### Modifiers
646
+
647
+ Every predicate function is also added to `check.maybe` object.
648
+ The `maybe` predicate passes if the argument is null or undefined,
649
+ or the predicate returns true.
650
+
651
+ #### check.maybe
652
+
653
+ check.maybe.bool(); // true
654
+ check.maybe.bool('true'); // false
655
+ var empty
656
+ check.maybe.lowerCase(empty); // true
657
+ check.maybe.unemptyArray(); // true
658
+ check.maybe.unemptyArray([]); // false
659
+ check.maybe.unemptyArray(['foo', 'bar']); // true
660
+
661
+ Every function has a negated predicate in `check.not` object
662
+
663
+ #### check.not
664
+
665
+ check.not.bool(4); // true
666
+ check.not.bool('true'); // true
667
+ check.not.bool(true); // false
668
+
669
+ Every predicate can also throw an exception if it fails
670
+
671
+ #### check.verify
672
+
673
+ check.verify.arrayOfStrings(['foo', 'bar'])
674
+ check.verify.bit(1)
675
+
676
+ function nonStrings() {
677
+ check.verify.arrayOfStrings(['Foo', 1])
678
+ }
679
+ check.raises(nonStrings); // true
680
+ function nonLowerCase() {
681
+ check.verify.lowerCase('Foo')
682
+ }
683
+ check.raises(nonLowerCase); // true
684
+
685
+ ---
686
+
687
+ ### Adding your own predicates
688
+
689
+ You can add new predicates to `check`, `check.maybe`, etc. by using `check.mixin(predicate)`
690
+ method. If you do not pass a name, it will try using function's name.
691
+
692
+ #### check.mixin(predicate, name)
693
+
694
+ function isBar(a) {
695
+ return a === 'bar'
696
+ }
697
+ check.mixin(isBar, 'bar')
698
+ check.bar('bar'); // true
699
+ check.bar('anything else'); // false
700
+ // supports modifiers
701
+ check.maybe.bar(); // true
702
+ check.maybe.bar('bar'); // true
703
+ check.not.bar('foo'); // true
704
+ check.not.bar('bar'); // false
705
+
706
+ Mixin will not override existing functions
707
+
708
+ #### check.mixin does not override
709
+
710
+ function isFoo(a) {
711
+ return a === 'foo'
712
+ }
713
+
714
+ function isBar(a) {
715
+ return a === 'bar'
716
+ }
717
+ check.mixin(isFoo, 'isFoo')
718
+ check.isFoo; // isFoo
719
+ check.mixin(isBar, 'isFoo')
720
+ check.isFoo; // isFoo
721
+
722
+ ### Defending a function
723
+
724
+ Using *check-more-types* you can separate the inner function logic from checking input
725
+ arguments. Instead of this
726
+
727
+ ```js
728
+ function add(a, b) {
729
+ la(check.number(a), 'first argument should be a number', a);
730
+ la(check.number(a), 'second argument should be a number', b);
731
+ return a + b;
732
+ }
733
+ ```
734
+
735
+ you can use `check.defend` function
736
+
737
+ #### check.defend(fn, predicates)
738
+
739
+ function add(a, b) {
740
+ return a + b
741
+ }
742
+ var safeAdd = check.defend(add, check.number, check.number)
743
+ add('foo', 2); // 'foo2'
744
+ // calling safeAdd('foo', 2) raises an exception
745
+ check.raises(safeAdd.bind(null, 'foo', 2)); // true
746
+
747
+ ---
748
+
749
+ #### protects optional arguments
750
+
751
+ function add(a, b) {
752
+ if (typeof b === 'undefined') {
753
+ return 'foo'
754
+ }
755
+ return a + b
756
+ }
757
+ add(2); // 'foo'
758
+ var safeAdd = check.defend(add, check.number, check.maybe.number)
759
+ safeAdd(2, 3); // 5
760
+ safeAdd(2); // 'foo'
761
+
762
+ ---
763
+
764
+ You can add extra message after a predicate
765
+
766
+ #### check.defend with messages
767
+
768
+ function add(a, b) {
769
+ return a + b
770
+ }
771
+ var safeAdd = check.defend(add, check.number, 'a should be a number', check.string, 'b should be a string')
772
+ safeAdd(2, 'foo'); // '2foo'
773
+ function addNumbers() {
774
+ return safeAdd(2, 3)
775
+ }
776
+
777
+ function checkException(err) {
778
+ err.message; // 'Argument 2: 3 does not pass predicate: b should be a string'
779
+ return true
780
+ }
781
+ check.raises(addNumbers, checkException); // true
782
+
783
+ ---
784
+
785
+ This works great when combined with JavaScript module pattern as in this example
786
+
787
+ #### check.defend in module pattern
788
+
789
+ var add = (function() {
790
+ // inner private function without any argument checks
791
+ function add(a, b) {
792
+ return a + b
793
+ }
794
+ // return defended function
795
+ return check.defend(add, check.number, check.number)
796
+ }())
797
+ add(2, 3); // 5
798
+ // trying to call with non-numbers raises an exception
799
+ function callAddWithNonNumbers() {
800
+ return add('foo', 'bar')
801
+ }
802
+ check.raises(callAddWithNonNumbers); // true
803
+
804
+ ---
805
+
806
+ ### Safe callback execution
807
+
808
+ Sometimes we want to execute a function depending on the condition, but without throwing an
809
+ exception. For these cases, there is `check.then`
810
+
811
+ #### check.then
812
+
813
+ function isSum10(a, b) {
814
+ return a + b === 10
815
+ }
816
+
817
+ function sum(a, b) {
818
+ return a + b
819
+ }
820
+ var onlyAddTo10 = check.then(isSum10, sum)
821
+ // isSum10 returns true for these arguments
822
+ // then sum is executed
823
+ onlyAddTo10(3, 7); // 10
824
+ onlyAddTo10(1, 2); // undefined
825
+ // sum is never called because isSum10 condition is false
826
+
827
+ ----
828
+
829
+ #### check.found
830
+
831
+ Great for quickly checking string or array search results
832
+
833
+ ```js
834
+ check.found('foo'.indexOf('f')); // true
835
+ check.found('foo bar'.indexOf('bar')); // true
836
+ ```
837
+
838
+ #### check.regexp
839
+
840
+ Returns true if the passed value is a regular expression.
841
+
842
+ #### check.promise
843
+
844
+ Returns true if given object has promise methods (`.then`, etc)
845
+
846
+ #### check.validDate
847
+
848
+ Returns true if the given instance is a Date and is valid.
849
+
850
+ #### check.equal
851
+
852
+ Curried shallow strict comparison
853
+
854
+ ```js
855
+ var foo = 'foo';
856
+ check.equal(foo, 'foo'); // true
857
+ var isFoo = check.equal('foo');
858
+ isFoo('foo'); // true
859
+ isFoo('bar'); // false
860
+ ```
861
+
862
+ #### check.or
863
+
864
+ Combines multiple predicates into single one using OR logic
865
+
866
+ ```js
867
+ var predicate = check.or(check.bool, check.unemptyString);
868
+ predicate(true); // true
869
+ predicate('foo'); // true
870
+ predicate(42); // false
871
+ ```
872
+
873
+ It treats non-functions as boolean values
874
+
875
+ ```js
876
+ var predicate = check.or(check.unemptyString, 42);
877
+ // will always return true
878
+ predicate('foo'); // true, because it is unempty string
879
+ predicate(false); // true, because 42 is truthy
880
+ ```
881
+
882
+ Note: if there are any exceptions inside the individual predicate functions, they are
883
+ treated as `false` values.
884
+
885
+ #### check.and
886
+
887
+ Combines multiple predicates using AND. If the predicate is not a function,
888
+ evaluates it as a boolean value.
889
+
890
+ ```js
891
+ function isFoo(x) { return x === 'foo'; }
892
+ check.and(check.unemptyString, isFoo); // only true for "foo"
893
+ ```
894
+
895
+ Both `check.or` and `check.and` are very useful inside `check.schema` to create
896
+ more powerful predicates on the fly.
897
+
898
+ ```js
899
+ var isFirstLastNames = check.schema.bind(null, {
900
+ first: check.unemptyString,
901
+ last: check.unemptyString
902
+ });
903
+ var isValidPerson = check.schema.bind(null, {
904
+ name: check.or(check.unemptyString, isFirstLastNames)
905
+ });
906
+ isValidPerson({ name: 'foo' }); // true
907
+ isValidPerson({ name: {
908
+ first: 'foo',
909
+ last: 'bar'
910
+ }}); // true
911
+ ```
912
+
913
+ ### Small print
914
+
915
+ Author: Kensho &copy; 2014
916
+
917
+ * [@kensho](https://twitter.com/kensho)
918
+ * [kensho.com](http://kensho.com)
919
+
920
+ Support: if you find any problems with this library,
921
+ [open issue](https://github.com/kensho/check-more-types/issues) on Github
922
+
923
+
924
+
925
+ This documentation was generated using [grunt-xplain](https://github.com/bahmutov/grunt-xplain)
926
+ and [grunt-readme](https://github.com/jonschlinkert/grunt-readme).
927
+
928
+ ## MIT License
929
+
930
+ The MIT License (MIT)
931
+
932
+ Copyright (c) 2014 Kensho
933
+
934
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
935
+ this software and associated documentation files (the "Software"), to deal in
936
+ the Software without restriction, including without limitation the rights to
937
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
938
+ the Software, and to permit persons to whom the Software is furnished to do so,
939
+ subject to the following conditions:
940
+
941
+ The above copyright notice and this permission notice shall be included in all
942
+ copies or substantial portions of the Software.
943
+
944
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
945
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
946
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
947
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
948
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
949
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
950
+
951
+
952
+