govuk_publishing_components 16.29.0 → 17.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +46 -23
- data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +8 -2
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +101 -21
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +9 -2
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +4 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +36 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +14 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +23 -23
- data/app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss +8 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_lead-paragraph.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +8 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +10 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +11 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +14 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +8 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss +7 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +20 -16
- data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +5 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-list.scss +5 -5
- data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +8 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss +1 -1
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +33 -25
- data/app/views/govuk_publishing_components/components/_error_summary.html.erb +4 -2
- data/app/views/govuk_publishing_components/components/_notice.html.erb +4 -1
- data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +2 -0
- data/app/views/govuk_publishing_components/components/docs/error_summary.yml +6 -0
- data/app/views/govuk_publishing_components/components/docs/notice.yml +6 -0
- data/app/views/govuk_publishing_components/components/docs/success_alert.yml +1 -1
- data/lib/govuk_publishing_components/presenters/cookie_banner_helper.rb +0 -4
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js +1 -1
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js.map +1 -1
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js +1 -1
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js.map +1 -1
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js +1 -1
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js.map +1 -1
- data/node_modules/accessible-autocomplete/package.json +3 -3
- data/node_modules/accessible-autocomplete/src/autocomplete.js +4 -2
- data/node_modules/accessible-autocomplete/src/wrapper.js +5 -1
- data/node_modules/d/CHANGELOG.md +9 -0
- data/node_modules/d/CHANGES +4 -0
- data/node_modules/d/LICENSE +12 -16
- data/node_modules/d/README.md +49 -19
- data/node_modules/d/auto-bind.js +11 -10
- data/node_modules/d/index.js +23 -24
- data/node_modules/d/lazy.js +21 -23
- data/node_modules/d/package.json +63 -16
- data/node_modules/d/test/auto-bind.js +6 -7
- data/node_modules/d/test/index.js +78 -51
- data/node_modules/d/test/lazy.js +65 -50
- data/node_modules/es6-weak-map/CHANGELOG.md +5 -0
- data/node_modules/es6-weak-map/LICENSE +12 -16
- data/node_modules/es6-weak-map/README.md +34 -19
- data/node_modules/es6-weak-map/implement.js +9 -5
- data/node_modules/es6-weak-map/index.js +2 -2
- data/node_modules/es6-weak-map/is-implemented.js +10 -9
- data/node_modules/es6-weak-map/is-native-implemented.js +3 -3
- data/node_modules/es6-weak-map/is-weak-map.js +8 -8
- data/node_modules/es6-weak-map/package.json +30 -19
- data/node_modules/es6-weak-map/polyfill.js +31 -32
- data/node_modules/es6-weak-map/test/implement.js +4 -2
- data/node_modules/es6-weak-map/test/index.js +4 -3
- data/node_modules/es6-weak-map/test/is-implemented.js +9 -8
- data/node_modules/es6-weak-map/test/is-native-implemented.js +4 -2
- data/node_modules/es6-weak-map/test/is-weak-map.js +4 -4
- data/node_modules/es6-weak-map/test/polyfill.js +13 -13
- data/node_modules/es6-weak-map/test/valid-weak-map.js +22 -9
- data/node_modules/es6-weak-map/valid-weak-map.js +5 -5
- data/node_modules/resolve/lib/async.js +1 -1
- data/node_modules/resolve/lib/node-modules-paths.js +1 -1
- data/node_modules/resolve/lib/sync.js +0 -2
- data/node_modules/resolve/package.json +13 -13
- data/node_modules/resolve/test/node-modules-paths.js +0 -22
- data/node_modules/resolve/test/resolver.js +11 -0
- data/node_modules/resolve/test/resolver_sync.js +11 -0
- data/node_modules/standard/node_modules/ms/index.js +2 -2
- data/node_modules/standard/node_modules/ms/package.json +205 -16
- data/node_modules/standard/node_modules/ms/readme.md +1 -1
- data/node_modules/type/CHANGELOG.md +62 -0
- data/node_modules/type/README.md +743 -0
- data/node_modules/type/array-length/coerce.js +10 -0
- data/node_modules/type/array-length/ensure.js +10 -0
- data/node_modules/type/array-like/ensure.js +9 -0
- data/node_modules/type/array-like/is.js +21 -0
- data/node_modules/type/array/ensure.js +9 -0
- data/node_modules/type/array/is.js +27 -0
- data/node_modules/type/date/ensure.js +9 -0
- data/node_modules/type/date/is.js +26 -0
- data/node_modules/type/error/ensure.js +9 -0
- data/node_modules/type/error/is.js +24 -0
- data/node_modules/type/finite/coerce.js +8 -0
- data/node_modules/type/finite/ensure.js +10 -0
- data/node_modules/type/function/ensure.js +9 -0
- data/node_modules/type/function/is.js +19 -0
- data/node_modules/type/integer/coerce.js +11 -0
- data/node_modules/type/integer/ensure.js +10 -0
- data/node_modules/type/iterable/ensure.js +9 -0
- data/node_modules/type/iterable/is.js +20 -0
- data/node_modules/type/lib/is-to-string-tag-supported.js +3 -0
- data/node_modules/type/lib/resolve-exception.js +21 -0
- data/node_modules/type/lib/safe-to-string.js +10 -0
- data/node_modules/type/lib/to-short-string.js +29 -0
- data/node_modules/type/natural-number/coerce.js +10 -0
- data/node_modules/type/natural-number/ensure.js +10 -0
- data/node_modules/type/number/coerce.js +14 -0
- data/node_modules/type/number/ensure.js +10 -0
- data/node_modules/type/object/ensure.js +9 -0
- data/node_modules/type/object/is.js +11 -0
- data/node_modules/type/package.json +159 -0
- data/node_modules/type/plain-function/ensure.js +9 -0
- data/node_modules/type/plain-function/is.js +11 -0
- data/node_modules/type/plain-object/ensure.js +9 -0
- data/node_modules/type/plain-object/is.js +28 -0
- data/node_modules/type/promise/ensure.js +9 -0
- data/node_modules/type/promise/is.js +27 -0
- data/node_modules/type/prototype/is.js +13 -0
- data/node_modules/type/reg-exp/ensure.js +9 -0
- data/node_modules/type/reg-exp/is.js +37 -0
- data/node_modules/type/safe-integer/coerce.js +13 -0
- data/node_modules/type/safe-integer/ensure.js +10 -0
- data/node_modules/type/string/coerce.js +23 -0
- data/node_modules/type/string/ensure.js +10 -0
- data/node_modules/type/test/_lib/arrow-function-if-supported.js +4 -0
- data/node_modules/type/test/_lib/class-if-supported.js +4 -0
- data/node_modules/type/test/array-length/coerce.js +47 -0
- data/node_modules/type/test/array-length/ensure.js +19 -0
- data/node_modules/type/test/array-like/ensure.js +24 -0
- data/node_modules/type/test/array-like/is.js +47 -0
- data/node_modules/type/test/array/ensure.js +20 -0
- data/node_modules/type/test/array/is.js +41 -0
- data/node_modules/type/test/date/ensure.js +20 -0
- data/node_modules/type/test/date/is.js +46 -0
- data/node_modules/type/test/error/ensure.js +20 -0
- data/node_modules/type/test/error/is.js +42 -0
- data/node_modules/type/test/finite/coerce.js +40 -0
- data/node_modules/type/test/finite/ensure.js +17 -0
- data/node_modules/type/test/function/ensure.js +20 -0
- data/node_modules/type/test/function/is.js +46 -0
- data/node_modules/type/test/integer/coerce.js +49 -0
- data/node_modules/type/test/integer/ensure.js +17 -0
- data/node_modules/type/test/iterable/ensure.js +24 -0
- data/node_modules/type/test/iterable/is.js +50 -0
- data/node_modules/type/test/lib/is-to-string-tag-supported.js +10 -0
- data/node_modules/type/test/lib/resolve-exception.js +39 -0
- data/node_modules/type/test/lib/safe-to-string.js +32 -0
- data/node_modules/type/test/lib/to-short-string.js +41 -0
- data/node_modules/type/test/natural-number/coerce.js +47 -0
- data/node_modules/type/test/natural-number/ensure.js +19 -0
- data/node_modules/type/test/number/coerce.js +40 -0
- data/node_modules/type/test/number/ensure.js +17 -0
- data/node_modules/type/test/object/ensure.js +20 -0
- data/node_modules/type/test/object/is.js +30 -0
- data/node_modules/type/test/plain-function/ensure.js +20 -0
- data/node_modules/type/test/plain-function/is.js +56 -0
- data/node_modules/type/test/plain-object/ensure.js +20 -0
- data/node_modules/type/test/plain-object/is.js +47 -0
- data/node_modules/type/test/promise/ensure.js +20 -0
- data/node_modules/type/test/promise/is.js +39 -0
- data/node_modules/type/test/prototype/is.js +39 -0
- data/node_modules/type/test/reg-exp/ensure.js +20 -0
- data/node_modules/type/test/reg-exp/is.js +47 -0
- data/node_modules/type/test/safe-integer/coerce.js +49 -0
- data/node_modules/type/test/safe-integer/ensure.js +19 -0
- data/node_modules/type/test/string/coerce.js +36 -0
- data/node_modules/type/test/string/ensure.js +17 -0
- data/node_modules/type/test/thenable/ensure.js +20 -0
- data/node_modules/type/test/thenable/is.js +44 -0
- data/node_modules/type/test/time-value/coerce.js +47 -0
- data/node_modules/type/test/time-value/ensure.js +17 -0
- data/node_modules/type/test/value/ensure.js +20 -0
- data/node_modules/type/test/value/is.js +29 -0
- data/node_modules/type/thenable/ensure.js +9 -0
- data/node_modules/type/thenable/is.js +9 -0
- data/node_modules/type/time-value/coerce.js +12 -0
- data/node_modules/type/time-value/ensure.js +10 -0
- data/node_modules/type/value/ensure.js +9 -0
- data/node_modules/type/value/is.js +6 -0
- metadata +118 -21
- data/app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-navigation.scss +0 -94
- data/node_modules/resolve/reaf +0 -0
- data/node_modules/resolve/test/shadowed_core.js +0 -38
- data/node_modules/resolve/test/shadowed_core/node_modules/util/index.js +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
# ms
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
|
4
|
-
[![
|
4
|
+
[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit)
|
5
5
|
|
6
6
|
Use this package to easily convert various time formats to milliseconds.
|
7
7
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
|
+
|
5
|
+
## [1.0.1](https://github.com/medikoo/type/compare/v1.0.0...v1.0.1) (2019-04-08)
|
6
|
+
|
7
|
+
# 1.0.0 (2019-04-05)
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
- ensure 'is' functions can't crash ([59ceb78](https://github.com/medikoo/type/commit/59ceb78))
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
- array-length/coerce ([af8ddec](https://github.com/medikoo/type/commit/af8ddec))
|
16
|
+
- array-length/ensure ([d313eb6](https://github.com/medikoo/type/commit/d313eb6))
|
17
|
+
- array-like/ensure ([45f1ddd](https://github.com/medikoo/type/commit/45f1ddd))
|
18
|
+
- array-like/is ([9a026a5](https://github.com/medikoo/type/commit/9a026a5))
|
19
|
+
- array/ensure ([9db1515](https://github.com/medikoo/type/commit/9db1515))
|
20
|
+
- array/is ([9672839](https://github.com/medikoo/type/commit/9672839))
|
21
|
+
- date/ensure ([44e25a0](https://github.com/medikoo/type/commit/44e25a0))
|
22
|
+
- date/is ([0316558](https://github.com/medikoo/type/commit/0316558))
|
23
|
+
- ensure to not crash ([3998348](https://github.com/medikoo/type/commit/3998348))
|
24
|
+
- ensure/number ([134b5cb](https://github.com/medikoo/type/commit/134b5cb))
|
25
|
+
- error/ensure ([d5c8a30](https://github.com/medikoo/type/commit/d5c8a30))
|
26
|
+
- error/is-error ([4d6b899](https://github.com/medikoo/type/commit/4d6b899))
|
27
|
+
- finite/coerce ([accaad1](https://github.com/medikoo/type/commit/accaad1))
|
28
|
+
- finite/ensure ([51e4174](https://github.com/medikoo/type/commit/51e4174))
|
29
|
+
- function/ensure ([b624c9a](https://github.com/medikoo/type/commit/b624c9a))
|
30
|
+
- function/is ([dab8026](https://github.com/medikoo/type/commit/dab8026))
|
31
|
+
- integer/coerce ([89dea2e](https://github.com/medikoo/type/commit/89dea2e))
|
32
|
+
- integer/ensure ([44a7071](https://github.com/medikoo/type/commit/44a7071))
|
33
|
+
- iterable/ensure ([3d48841](https://github.com/medikoo/type/commit/3d48841))
|
34
|
+
- iterable/is ([cf09513](https://github.com/medikoo/type/commit/cf09513))
|
35
|
+
- lib/is-to-string-tag-supported ([c8c001d](https://github.com/medikoo/type/commit/c8c001d))
|
36
|
+
- natural-number/coerce ([d08fdd9](https://github.com/medikoo/type/commit/d08fdd9))
|
37
|
+
- natural-number/ensure ([6c24d12](https://github.com/medikoo/type/commit/6c24d12))
|
38
|
+
- number/coerce ([86ccf08](https://github.com/medikoo/type/commit/86ccf08))
|
39
|
+
- object/ensure ([a9e8eed](https://github.com/medikoo/type/commit/a9e8eed))
|
40
|
+
- object/is ([d2d7251](https://github.com/medikoo/type/commit/d2d7251))
|
41
|
+
- plain-function/ensure ([5186518](https://github.com/medikoo/type/commit/5186518))
|
42
|
+
- plain-function/is ([51bc791](https://github.com/medikoo/type/commit/51bc791))
|
43
|
+
- plain-object/ensure ([91cf5e5](https://github.com/medikoo/type/commit/91cf5e5))
|
44
|
+
- plain-object/is ([4dcf393](https://github.com/medikoo/type/commit/4dcf393))
|
45
|
+
- promise/ensure ([8d096a4](https://github.com/medikoo/type/commit/8d096a4))
|
46
|
+
- promise/is ([a00de02](https://github.com/medikoo/type/commit/a00de02))
|
47
|
+
- prototype/is ([b23bdcc](https://github.com/medikoo/type/commit/b23bdcc))
|
48
|
+
- reg-exp/ensure ([6f7bbcb](https://github.com/medikoo/type/commit/6f7bbcb))
|
49
|
+
- reg-exp/is ([9728519](https://github.com/medikoo/type/commit/9728519))
|
50
|
+
- safe-integer/coerce ([b8549c4](https://github.com/medikoo/type/commit/b8549c4))
|
51
|
+
- safe-integer/ensure ([a70ef3f](https://github.com/medikoo/type/commit/a70ef3f))
|
52
|
+
- string/coerce ([b25c71f](https://github.com/medikoo/type/commit/b25c71f))
|
53
|
+
- string/ensure ([b62577d](https://github.com/medikoo/type/commit/b62577d))
|
54
|
+
- support 'default' in resolveException ([e08332a](https://github.com/medikoo/type/commit/e08332a))
|
55
|
+
- switch config to ES3 based ([37606d9](https://github.com/medikoo/type/commit/37606d9))
|
56
|
+
- thenable/ensure ([6762c0d](https://github.com/medikoo/type/commit/6762c0d))
|
57
|
+
- thenable/is ([2711d70](https://github.com/medikoo/type/commit/2711d70))
|
58
|
+
- time-value/coerce ([27fd109](https://github.com/medikoo/type/commit/27fd109))
|
59
|
+
- time-value/ensure ([1f6a8ea](https://github.com/medikoo/type/commit/1f6a8ea))
|
60
|
+
- **string/coerce:** restrict toString acceptance ([2a87100](https://github.com/medikoo/type/commit/2a87100))
|
61
|
+
- value/ensure ([dd6d8cb](https://github.com/medikoo/type/commit/dd6d8cb))
|
62
|
+
- value/is ([fdf4763](https://github.com/medikoo/type/commit/fdf4763))
|
@@ -0,0 +1,743 @@
|
|
1
|
+
[![*nix build status][nix-build-image]][nix-build-url]
|
2
|
+
[![Windows build status][win-build-image]][win-build-url]
|
3
|
+
[![Tests coverage][cov-image]][cov-url]
|
4
|
+
[![npm version][npm-image]][npm-url]
|
5
|
+
|
6
|
+
# type
|
7
|
+
|
8
|
+
## Runtime validation and processing of JavaScript types
|
9
|
+
|
10
|
+
- Respects language nature and acknowledges its quirks
|
11
|
+
- Allows coercion in restricted forms (rejects clearly invalid input, normalizes permissible type deviations)
|
12
|
+
- No transpilation implied, written to work in all ECMAScript 3+ engines
|
13
|
+
|
14
|
+
### Example usage
|
15
|
+
|
16
|
+
Bulletproof input arguments normalization and validation:
|
17
|
+
|
18
|
+
```javascript
|
19
|
+
const ensureString = require('type/string/ensure')
|
20
|
+
, ensureDate = require('type/date/ensure')
|
21
|
+
, ensureNaturalNumber = require('type/natural-number/ensure')
|
22
|
+
, isObject = require('type/object/is');
|
23
|
+
|
24
|
+
module.exports = (path, options = { min: 0 }) {
|
25
|
+
path = ensureString(path, { errorMessage: "%v is not a path" });
|
26
|
+
if (!isObject(options)) options = {};
|
27
|
+
const min = ensureNaturalNumber(options.min, { default: 0 })
|
28
|
+
, max = ensureNaturalNumber(options.max, { isOptional: true })
|
29
|
+
, startTime = ensureDate(options.startTime, { isOptional: true });
|
30
|
+
|
31
|
+
// ...logic
|
32
|
+
};
|
33
|
+
```
|
34
|
+
|
35
|
+
### Installation
|
36
|
+
|
37
|
+
```bash
|
38
|
+
npm install type
|
39
|
+
```
|
40
|
+
|
41
|
+
## Utilities
|
42
|
+
|
43
|
+
Serves following kind of utilities:
|
44
|
+
|
45
|
+
##### `*/coerce`
|
46
|
+
|
47
|
+
Restricted coercion into primitive type. Returns coerced value or `null` if value is not coercible per rules.
|
48
|
+
|
49
|
+
##### `*/is`
|
50
|
+
|
51
|
+
Object type/kind confirmation, returns either `true` or `false`.
|
52
|
+
|
53
|
+
##### `*/ensure`
|
54
|
+
|
55
|
+
Value validation. Returns input value (in primitive cases possibly coerced) or if value doesn't meet the constraints throws `TypeError` .
|
56
|
+
|
57
|
+
Each `*/ensure` utility, accepts following options (eventually passed with second argument):
|
58
|
+
|
59
|
+
- `isOptional` - Makes `null` or `undefined` accepted as valid value. In such case instead of `TypeError` being thrown, `null` is returned.
|
60
|
+
- `default` - A value to be returned if `null` or `undefined` is passed as an input value.
|
61
|
+
- `errorMessage` - Custom error message (`%v` can be used as a placeholder for input value)
|
62
|
+
|
63
|
+
---
|
64
|
+
|
65
|
+
### Value
|
66
|
+
|
67
|
+
_Value_, any value that's neither `null` nor `undefined` .
|
68
|
+
|
69
|
+
#### `value/is`
|
70
|
+
|
71
|
+
Confirms whether passed argument is a _value_
|
72
|
+
|
73
|
+
```javascript
|
74
|
+
const isValue = require("type/value/is");
|
75
|
+
|
76
|
+
isValue({}); // true
|
77
|
+
isValue(null); // false
|
78
|
+
```
|
79
|
+
|
80
|
+
#### `value/ensure`
|
81
|
+
|
82
|
+
Ensures if given argument is a _value_. If it's a value it is returned back, if not `TypeError` is thrown
|
83
|
+
|
84
|
+
```javascript
|
85
|
+
const ensureValue = require("type/value/ensure");
|
86
|
+
|
87
|
+
const obj = {};
|
88
|
+
|
89
|
+
ensureValue(obj); // obj
|
90
|
+
ensureValue(null); // Thrown TypeError: Cannot use null
|
91
|
+
```
|
92
|
+
|
93
|
+
---
|
94
|
+
|
95
|
+
### Object
|
96
|
+
|
97
|
+
_Object_, any non-primitive value
|
98
|
+
|
99
|
+
#### `object/is`
|
100
|
+
|
101
|
+
Confirms if passed value is an object
|
102
|
+
|
103
|
+
```javascript
|
104
|
+
const isObject = require("type/object/is");
|
105
|
+
|
106
|
+
isObject({}); // true
|
107
|
+
isObject(true); // false
|
108
|
+
isObject(null); // false
|
109
|
+
```
|
110
|
+
|
111
|
+
#### `object/ensure`
|
112
|
+
|
113
|
+
If given argument is an object, it is returned back. Otherwise `TypeError` is thrown.
|
114
|
+
|
115
|
+
```javascript
|
116
|
+
const ensureObject = require("type/object/ensure");
|
117
|
+
|
118
|
+
const obj = {};
|
119
|
+
|
120
|
+
ensureObject(obj); // obj
|
121
|
+
ensureString(null); // Thrown TypeError: null is not an object
|
122
|
+
```
|
123
|
+
|
124
|
+
---
|
125
|
+
|
126
|
+
### String
|
127
|
+
|
128
|
+
_string_ primitive
|
129
|
+
|
130
|
+
#### `string/coerce`
|
131
|
+
|
132
|
+
Restricted string coercion. Returns string presentation for every value that follows below constraints
|
133
|
+
|
134
|
+
- is implicitly coercible to string
|
135
|
+
- is neither`null` nor `undefined`
|
136
|
+
- its `toString` method is not `Object.prototype.toString`
|
137
|
+
|
138
|
+
For all other values `null` is returned
|
139
|
+
|
140
|
+
```javascript
|
141
|
+
const coerceToString = require("type/string/coerce");
|
142
|
+
|
143
|
+
coerceToString(12); // "12"
|
144
|
+
coerceToString(undefined); // null
|
145
|
+
```
|
146
|
+
|
147
|
+
#### `string/ensure`
|
148
|
+
|
149
|
+
If given argument is a string coercible value (via [`string/coerce`](#stringcoerce)) returns result string.
|
150
|
+
Otherwise `TypeError` is thrown.
|
151
|
+
|
152
|
+
```javascript
|
153
|
+
const ensureString = require("type/string/ensure");
|
154
|
+
|
155
|
+
ensureString(12); // "12"
|
156
|
+
ensureString(null); // Thrown TypeError: null is not a string
|
157
|
+
```
|
158
|
+
|
159
|
+
---
|
160
|
+
|
161
|
+
### Number
|
162
|
+
|
163
|
+
_number_ primitive
|
164
|
+
|
165
|
+
#### `number/coerce`
|
166
|
+
|
167
|
+
Restricted number coercion. Returns number presentation for every value that follows below constraints
|
168
|
+
|
169
|
+
- is implicitly coercible to number
|
170
|
+
- is neither `null` nor `undefined`
|
171
|
+
- is not `NaN` and doesn't coerce to `NaN`
|
172
|
+
|
173
|
+
For all other values `null` is returned
|
174
|
+
|
175
|
+
```javascript
|
176
|
+
const coerceToNumber = require("type/number/coerce");
|
177
|
+
|
178
|
+
coerceToNumber("12"); // 12
|
179
|
+
coerceToNumber({}); // null
|
180
|
+
coerceToNumber(null); // null
|
181
|
+
```
|
182
|
+
|
183
|
+
#### `number/ensure`
|
184
|
+
|
185
|
+
If given argument is a number coercible value (via [`number/coerce`](#numbercoerce)) returns result number.
|
186
|
+
Otherwise `TypeError` is thrown.
|
187
|
+
|
188
|
+
```javascript
|
189
|
+
const ensureNumber = require("type/number/ensure");
|
190
|
+
|
191
|
+
ensureNumber(12); // "12"
|
192
|
+
ensureNumber(null); // Thrown TypeError: null is not a number
|
193
|
+
```
|
194
|
+
|
195
|
+
---
|
196
|
+
|
197
|
+
#### Finite Number
|
198
|
+
|
199
|
+
Finite _number_ primitive
|
200
|
+
|
201
|
+
##### `finite/coerce`
|
202
|
+
|
203
|
+
Follows [`number/coerce`](#numbercoerce) additionally rejecting `Infinity` and `-Infinity` values (`null` is returned if given values coerces to them)
|
204
|
+
|
205
|
+
```javascript
|
206
|
+
const coerceToFinite = require("type/finite/coerce");
|
207
|
+
|
208
|
+
coerceToFinite("12"); // 12
|
209
|
+
coerceToFinite(Infinity); // null
|
210
|
+
coerceToFinite(null); // null
|
211
|
+
```
|
212
|
+
|
213
|
+
##### `finite/ensure`
|
214
|
+
|
215
|
+
If given argument is a finite number coercible value (via [`finite/coerce`](#finitecoerce)) returns result number.
|
216
|
+
Otherwise `TypeError` is thrown.
|
217
|
+
|
218
|
+
```javascript
|
219
|
+
const ensureFinite = require("type/finite/ensure");
|
220
|
+
|
221
|
+
ensureFinite(12); // "12"
|
222
|
+
ensureFinite(null); // Thrown TypeError: null is not a finite number
|
223
|
+
```
|
224
|
+
|
225
|
+
---
|
226
|
+
|
227
|
+
#### Integer Number
|
228
|
+
|
229
|
+
Integer _number_ primitive
|
230
|
+
|
231
|
+
##### `integer/coerce`
|
232
|
+
|
233
|
+
Follows [`finite/coerce`](#finitecoerce) additionally stripping decimal part from the number
|
234
|
+
|
235
|
+
```javascript
|
236
|
+
const coerceToInteger = require("type/integer/coerce");
|
237
|
+
|
238
|
+
coerceToInteger("12.95"); // 12
|
239
|
+
coerceToInteger(Infinity); // null
|
240
|
+
coerceToInteger(null); // null
|
241
|
+
```
|
242
|
+
|
243
|
+
##### `integer/ensure`
|
244
|
+
|
245
|
+
If given argument is an integer coercible value (via [`integer/coerce`](#integercoerce)) returns result number.
|
246
|
+
Otherwise `TypeError` is thrown.
|
247
|
+
|
248
|
+
```javascript
|
249
|
+
const ensureInteger = require("type/integer/ensure");
|
250
|
+
|
251
|
+
ensureInteger(12.93); // "12"
|
252
|
+
ensureInteger(null); // Thrown TypeError: null is not an integer
|
253
|
+
```
|
254
|
+
|
255
|
+
---
|
256
|
+
|
257
|
+
#### Safe Integer Number
|
258
|
+
|
259
|
+
Safe integer _number_ primitive
|
260
|
+
|
261
|
+
##### `safe-integer/coerce`
|
262
|
+
|
263
|
+
Follows [`integer/coerce`](#integercoerce) but returns `null` in place of values which are beyond `Number.MIN_SAFE_INTEGER` and `Number.MAX_SAFE_INTEGER` range.
|
264
|
+
|
265
|
+
```javascript
|
266
|
+
const coerceToSafeInteger = require("type/safe-integer/coerce");
|
267
|
+
|
268
|
+
coerceToInteger("12.95"); // 12
|
269
|
+
coerceToInteger(9007199254740992); // null
|
270
|
+
coerceToInteger(null); // null
|
271
|
+
```
|
272
|
+
|
273
|
+
##### `safe-integer/ensure`
|
274
|
+
|
275
|
+
If given argument is a safe integer coercible value (via [`safe-integer/coerce`](#safe-integercoerce)) returns result number.
|
276
|
+
Otherwise `TypeError` is thrown.
|
277
|
+
|
278
|
+
```javascript
|
279
|
+
const ensureSafeInteger = require("type/safe-integer/ensure");
|
280
|
+
|
281
|
+
ensureSafeInteger(12.93); // "12"
|
282
|
+
ensureSafeInteger(9007199254740992); // Thrown TypeError: null is not a safe integer
|
283
|
+
```
|
284
|
+
|
285
|
+
---
|
286
|
+
|
287
|
+
#### Natural Number
|
288
|
+
|
289
|
+
Natural _number_ primitive
|
290
|
+
|
291
|
+
##### `natural-number/coerce`
|
292
|
+
|
293
|
+
Follows [`integer/coerce`](#integercoerce) but returns `null` for values below `0`
|
294
|
+
|
295
|
+
```javascript
|
296
|
+
const coerceToNaturalNumber = require("type/natural-number/coerce");
|
297
|
+
|
298
|
+
coerceToNaturalNumber("12.95"); // 12
|
299
|
+
coerceToNaturalNumber(-120); // null
|
300
|
+
coerceToNaturalNumber(null); // null
|
301
|
+
```
|
302
|
+
|
303
|
+
##### `natural-number/ensure`
|
304
|
+
|
305
|
+
If given argument is a natural number coercible value (via [`natural-number/coerce`](#natural-numbercoerce)) returns result number.
|
306
|
+
Otherwise `TypeError` is thrown.
|
307
|
+
|
308
|
+
```javascript
|
309
|
+
const ensureNaturalNumber = require("type/natural-number/ensure");
|
310
|
+
|
311
|
+
ensureNaturalNumber(12.93); // "12"
|
312
|
+
ensureNaturalNumber(-230); // Thrown TypeError: null is not a natural number
|
313
|
+
```
|
314
|
+
|
315
|
+
---
|
316
|
+
|
317
|
+
### Plain Object
|
318
|
+
|
319
|
+
A _plain object_
|
320
|
+
|
321
|
+
- Inherits directly from `Object.prototype` or `null`
|
322
|
+
- Is not a constructor's `prototype` property
|
323
|
+
|
324
|
+
#### `plain-object/is`
|
325
|
+
|
326
|
+
Confirms if given object is a _plain object_
|
327
|
+
|
328
|
+
```javascript
|
329
|
+
const isPlainObject = require("type/plain-object/is");
|
330
|
+
|
331
|
+
isPlainObject({}); // true
|
332
|
+
isPlainObject(Object.create(null)); // true
|
333
|
+
isPlainObject([]); // false
|
334
|
+
```
|
335
|
+
|
336
|
+
#### `plain-object/ensure`
|
337
|
+
|
338
|
+
If given argument is a plain object it is returned back. Otherwise `TypeError` is thrown.
|
339
|
+
|
340
|
+
```javascript
|
341
|
+
const ensurePlainObject = require("type/plain-object/ensure");
|
342
|
+
|
343
|
+
ensurePlainObject({}); // {}
|
344
|
+
ensureArray("foo"); // Thrown TypeError: foo is not a plain object
|
345
|
+
```
|
346
|
+
|
347
|
+
---
|
348
|
+
|
349
|
+
### Array
|
350
|
+
|
351
|
+
_Array_ instance
|
352
|
+
|
353
|
+
#### `array/is`
|
354
|
+
|
355
|
+
Confirms if given object is a native array
|
356
|
+
|
357
|
+
```javascript
|
358
|
+
const isArray = require("type/array/is");
|
359
|
+
|
360
|
+
isArray([]); // true
|
361
|
+
isArray({}); // false
|
362
|
+
isArray("foo"); // false
|
363
|
+
```
|
364
|
+
|
365
|
+
#### `array/ensure`
|
366
|
+
|
367
|
+
If given argument is an array, it is returned back. Otherwise `TypeError` is thrown.
|
368
|
+
|
369
|
+
```javascript
|
370
|
+
const ensureArray = require("type/array/ensure");
|
371
|
+
|
372
|
+
ensureArray(["foo"]); // ["foo"]
|
373
|
+
ensureArray("foo"); // Thrown TypeError: foo is not an array
|
374
|
+
```
|
375
|
+
|
376
|
+
---
|
377
|
+
|
378
|
+
#### Array Like
|
379
|
+
|
380
|
+
_Array-like_ value (any value with `length` property)
|
381
|
+
|
382
|
+
#### `array-like/is`
|
383
|
+
|
384
|
+
Restricted _array-like_ confirmation. Returns true for every value that meets following contraints
|
385
|
+
|
386
|
+
- is an _object_ (or with `allowString` option, a _string_)
|
387
|
+
- is not a _function_
|
388
|
+
- Exposes `length` that meets [`array-length`](#array-lengthcoerce) constraints
|
389
|
+
|
390
|
+
```javascript
|
391
|
+
const isArrayLike = require("type/array-like/is");
|
392
|
+
|
393
|
+
isArrayLike([]); // true
|
394
|
+
isArrayLike({}); // false
|
395
|
+
isArrayLike({ length: 0 }); // true
|
396
|
+
isArrayLike("foo"); // false
|
397
|
+
isArrayLike("foo", { allowString: true }); // true
|
398
|
+
```
|
399
|
+
|
400
|
+
#### `array-like/ensure`
|
401
|
+
|
402
|
+
If given argument is an _array-like_, it is returned back. Otherwise `TypeError` is thrown.
|
403
|
+
|
404
|
+
```javascript
|
405
|
+
const ensureArrayLike = require("type/array-like/ensure");
|
406
|
+
|
407
|
+
ensureArrayLike({ length: 0 }); // { length: 0 }
|
408
|
+
ensureArrayLike("foo", { allowString: true }); // "foo"
|
409
|
+
ensureArrayLike({}); // Thrown TypeError: null is not an iterable
|
410
|
+
```
|
411
|
+
|
412
|
+
---
|
413
|
+
|
414
|
+
#### Array length
|
415
|
+
|
416
|
+
_number_ primitive that conforms as valid _array length_
|
417
|
+
|
418
|
+
##### `array-length/coerce`
|
419
|
+
|
420
|
+
Follows [`safe-integer/coerce`](#safe-integercoerce) but returns `null` in place of values which are below `0`
|
421
|
+
|
422
|
+
```javascript
|
423
|
+
const coerceToArrayLength = require("type/safe-integer/coerce");
|
424
|
+
|
425
|
+
coerceToArrayLength("12.95"); // 12
|
426
|
+
coerceToArrayLength(9007199254740992); // null
|
427
|
+
coerceToArrayLength(null); // null
|
428
|
+
```
|
429
|
+
|
430
|
+
##### `array-length/ensure`
|
431
|
+
|
432
|
+
If given argument is an _array length_ coercible value (via [`array-length/coerce`](#array-lengthcoerce)) returns result number.
|
433
|
+
Otherwise `TypeError` is thrown.
|
434
|
+
|
435
|
+
```javascript
|
436
|
+
const ensureArrayLength = require("type/array-length/ensure");
|
437
|
+
|
438
|
+
ensureArrayLength(12.93); // "12"
|
439
|
+
ensureArrayLength(9007199254740992); // Thrown TypeError: null is not a valid array length
|
440
|
+
```
|
441
|
+
|
442
|
+
---
|
443
|
+
|
444
|
+
### Iterable
|
445
|
+
|
446
|
+
Value which implements _iterable_ protocol
|
447
|
+
|
448
|
+
#### `iterable/is`
|
449
|
+
|
450
|
+
Confirms if given object is an _iterable_ and is not a _string_ (unless `allowString` option is passed)
|
451
|
+
|
452
|
+
```javascript
|
453
|
+
const isIterable = require("type/iterable/is");
|
454
|
+
|
455
|
+
isIterable([]); // true
|
456
|
+
isIterable({}); // false
|
457
|
+
isIterable("foo"); // false
|
458
|
+
isIterable("foo", { allowString: true }); // true
|
459
|
+
```
|
460
|
+
|
461
|
+
#### `iterable/ensure`
|
462
|
+
|
463
|
+
If given argument is an _iterable_, it is returned back. Otherwise `TypeError` is thrown.
|
464
|
+
|
465
|
+
```javascript
|
466
|
+
const ensureIterable = require("type/iterable/ensure");
|
467
|
+
|
468
|
+
ensureIterable([]); // []
|
469
|
+
ensureIterable("foo", { allowString: true }); // "foo"
|
470
|
+
ensureIterable({}); // Thrown TypeError: null is not a iterable
|
471
|
+
```
|
472
|
+
|
473
|
+
---
|
474
|
+
|
475
|
+
### Date
|
476
|
+
|
477
|
+
_Date_ instance
|
478
|
+
|
479
|
+
#### `date/is`
|
480
|
+
|
481
|
+
Confirms if given object is a native date, and is not an _Invalid Date_
|
482
|
+
|
483
|
+
```javascript
|
484
|
+
const isDate = require("type/date/is");
|
485
|
+
|
486
|
+
isDate(new Date()); // true
|
487
|
+
isDate(new Date("Invalid date")); // false
|
488
|
+
isDate(Date.now()); // false
|
489
|
+
isDate("foo"); // false
|
490
|
+
```
|
491
|
+
|
492
|
+
#### `date/ensure`
|
493
|
+
|
494
|
+
If given argument is a date object, it is returned back. Otherwise `TypeError` is thrown.
|
495
|
+
|
496
|
+
```javascript
|
497
|
+
const ensureDate = require("type/date/ensure");
|
498
|
+
|
499
|
+
const date = new Date();
|
500
|
+
ensureDate(date); // date
|
501
|
+
ensureDate(123123); // Thrown TypeError: 123123 is not a date object
|
502
|
+
```
|
503
|
+
|
504
|
+
---
|
505
|
+
|
506
|
+
### Time value
|
507
|
+
|
508
|
+
_number_ primitive which is a valid _time value_ (as used internally in _Date_ instances)
|
509
|
+
|
510
|
+
#### `time-value/coerce`
|
511
|
+
|
512
|
+
Follows [`integer/coerce`](#integercoerce) but returns `null` in place of values which go beyond 100 000 0000 days from unix epoch
|
513
|
+
|
514
|
+
```javascript
|
515
|
+
const coerceToTimeValue = require("type/time-value/coerce");
|
516
|
+
|
517
|
+
coerceToTimeValue(12312312); // true
|
518
|
+
coerceToTimeValue(Number.MAX_SAFE_INTEGER); // false
|
519
|
+
coerceToTimeValue("foo"); // false
|
520
|
+
```
|
521
|
+
|
522
|
+
##### `time-value/ensure`
|
523
|
+
|
524
|
+
If given argument is a _time value_ coercible value (via [`time-value/coerce`](#time-valuecoerce)) returns result number.
|
525
|
+
Otherwise `TypeError` is thrown.
|
526
|
+
|
527
|
+
```javascript
|
528
|
+
const ensureTimeValue = require("type/time-value/ensure");
|
529
|
+
|
530
|
+
ensureTimeValue(12.93); // "12"
|
531
|
+
ensureTimeValue(Number.MAX_SAFE_INTEGER); // Thrown TypeError: null is not a natural number
|
532
|
+
```
|
533
|
+
|
534
|
+
---
|
535
|
+
|
536
|
+
### Function
|
537
|
+
|
538
|
+
_Function_ instance
|
539
|
+
|
540
|
+
#### `function/is`
|
541
|
+
|
542
|
+
Confirms if given object is a native function
|
543
|
+
|
544
|
+
```javascript
|
545
|
+
const isFunction = require("type/function/is");
|
546
|
+
|
547
|
+
isFunction(function () {}); // true
|
548
|
+
isFunction(() => {}); // true
|
549
|
+
isFunction(class {}); // true
|
550
|
+
isFunction("foo"); // false
|
551
|
+
```
|
552
|
+
|
553
|
+
#### `function/ensure`
|
554
|
+
|
555
|
+
If given argument is a function object, it is returned back. Otherwise `TypeError` is thrown.
|
556
|
+
|
557
|
+
```javascript
|
558
|
+
const ensureFunction = require("type/function/ensure");
|
559
|
+
|
560
|
+
const fn = function () {};
|
561
|
+
ensureFunction(fn); // fn
|
562
|
+
ensureFunction(/foo/); // Thrown TypeError: /foo/ is not a function
|
563
|
+
```
|
564
|
+
|
565
|
+
---
|
566
|
+
|
567
|
+
#### Plain Function
|
568
|
+
|
569
|
+
A _Function_ instance that is not a _Class_
|
570
|
+
|
571
|
+
##### `plain-function/is`
|
572
|
+
|
573
|
+
Confirms if given object is a _plain function_
|
574
|
+
|
575
|
+
```javascript
|
576
|
+
const isPlainFunction = require("type/plain-function/is");
|
577
|
+
|
578
|
+
isPlainFunction(function () {}); // true
|
579
|
+
isPlainFunction(() => {}); // true
|
580
|
+
isPlainFunction(class {}); // false
|
581
|
+
isPlainFunction("foo"); // false
|
582
|
+
```
|
583
|
+
|
584
|
+
##### `plain-function/ensure`
|
585
|
+
|
586
|
+
If given argument is a _plain function_ object, it is returned back. Otherwise `TypeError` is thrown.
|
587
|
+
|
588
|
+
```javascript
|
589
|
+
const ensurePlainFunction = require("type/function/ensure");
|
590
|
+
|
591
|
+
const fn = function () {};
|
592
|
+
ensurePlainFunction(fn); // fn
|
593
|
+
ensurePlainFunction(class {}); // Thrown TypeError: class is not a plain function
|
594
|
+
```
|
595
|
+
|
596
|
+
---
|
597
|
+
|
598
|
+
### RegExp
|
599
|
+
|
600
|
+
_RegExp_ instance
|
601
|
+
|
602
|
+
#### `reg-exp/is`
|
603
|
+
|
604
|
+
Confirms if given object is a native regular expression object
|
605
|
+
|
606
|
+
```javascript
|
607
|
+
const isRegExp = require("type/reg-exp/is");
|
608
|
+
|
609
|
+
isRegExp(/foo/);
|
610
|
+
isRegExp({}); // false
|
611
|
+
isRegExp("foo"); // false
|
612
|
+
```
|
613
|
+
|
614
|
+
#### `reg-exp/ensure`
|
615
|
+
|
616
|
+
If given argument is a regular expression object, it is returned back. Otherwise `TypeError` is thrown.
|
617
|
+
|
618
|
+
```javascript
|
619
|
+
const ensureRegExp = require("type/reg-exp/ensure");
|
620
|
+
|
621
|
+
ensureRegExp(/foo/); // /foo/
|
622
|
+
ensureRegExp("foo"); // Thrown TypeError: null is not a regular expression object
|
623
|
+
```
|
624
|
+
|
625
|
+
---
|
626
|
+
|
627
|
+
### Promise
|
628
|
+
|
629
|
+
_Promise_ instance
|
630
|
+
|
631
|
+
#### `promise/is`
|
632
|
+
|
633
|
+
Confirms if given object is a native _promise_
|
634
|
+
|
635
|
+
```javascript
|
636
|
+
const isPromise = require("type/promise/is");
|
637
|
+
|
638
|
+
isPromise(Promise.resolve()); // true
|
639
|
+
isPromise({ then: () => {} }); // false
|
640
|
+
isPromise({}); // false
|
641
|
+
```
|
642
|
+
|
643
|
+
##### `promise/ensure`
|
644
|
+
|
645
|
+
If given argument is a promise, it is returned back. Otherwise `TypeError` is thrown.
|
646
|
+
|
647
|
+
```javascript
|
648
|
+
const ensurePromise = require("type/promise/ensure");
|
649
|
+
|
650
|
+
const promise = Promise.resolve();
|
651
|
+
ensurePromise(promise); // promise
|
652
|
+
eensurePromise({}); // Thrown TypeError: [object Object] is not a promise
|
653
|
+
```
|
654
|
+
|
655
|
+
---
|
656
|
+
|
657
|
+
#### Thenable
|
658
|
+
|
659
|
+
_Thenable_ object (an object with `then` method)
|
660
|
+
|
661
|
+
##### `thenable/is`
|
662
|
+
|
663
|
+
Confirms if given object is a _thenable_
|
664
|
+
|
665
|
+
```javascript
|
666
|
+
const isThenable = require("type/thenable/is");
|
667
|
+
|
668
|
+
isThenable(Promise.resolve()); // true
|
669
|
+
isThenable({ then: () => {} }); // true
|
670
|
+
isThenable({}); // false
|
671
|
+
```
|
672
|
+
|
673
|
+
##### `thenable/ensure`
|
674
|
+
|
675
|
+
If given argument is a _thenable_ object, it is returned back. Otherwise `TypeError` is thrown.
|
676
|
+
|
677
|
+
```javascript
|
678
|
+
const ensureThenable = require("type/thenable/ensure");
|
679
|
+
|
680
|
+
const promise = Promise.resolve();
|
681
|
+
ensureThenable(promise); // promise
|
682
|
+
ensureThenable({}); // Thrown TypeError: [object Object] is not a thenable object
|
683
|
+
```
|
684
|
+
|
685
|
+
---
|
686
|
+
|
687
|
+
### Error
|
688
|
+
|
689
|
+
_Error_ instance
|
690
|
+
|
691
|
+
#### `error/is`
|
692
|
+
|
693
|
+
Confirms if given object is a native error object
|
694
|
+
|
695
|
+
```javascript
|
696
|
+
const isError = require("type/error/is");
|
697
|
+
|
698
|
+
isError(new Error()); // true
|
699
|
+
isError({ mesage: "Fake error" }); // false
|
700
|
+
```
|
701
|
+
|
702
|
+
#### `error/ensure`
|
703
|
+
|
704
|
+
If given argument is an error object, it is returned back. Otherwise `TypeError` is thrown.
|
705
|
+
|
706
|
+
```javascript
|
707
|
+
const ensureError = require("type/error/ensure");
|
708
|
+
|
709
|
+
const someError = new Error("Some error");
|
710
|
+
ensureError(someError); // someError
|
711
|
+
ensureError({ mesage: "Fake error" }); // Thrown TypeError: [object Object] is not an error object
|
712
|
+
```
|
713
|
+
|
714
|
+
---
|
715
|
+
|
716
|
+
### Prototype
|
717
|
+
|
718
|
+
Some constructor's `prototype` property
|
719
|
+
|
720
|
+
#### `prototype/is`
|
721
|
+
|
722
|
+
Confirms if given object serves as a _prototype_ property
|
723
|
+
|
724
|
+
```javascript
|
725
|
+
const isPrototype = require("type/prototype/is");
|
726
|
+
|
727
|
+
isPrototype({}); // false
|
728
|
+
isPrototype(Object.prototype); // true
|
729
|
+
isPrototype(Array.prototype); // true
|
730
|
+
```
|
731
|
+
|
732
|
+
### Tests
|
733
|
+
|
734
|
+
$ npm test
|
735
|
+
|
736
|
+
[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/type/branches/master/shields_badge.svg
|
737
|
+
[nix-build-url]: https://semaphoreci.com/medikoo-org/type
|
738
|
+
[win-build-image]: https://ci.appveyor.com/api/projects/status/8nrtluuwsb5k9l8d?svg=true
|
739
|
+
[win-build-url]: https://ci.appveyor.com/api/project/medikoo/type
|
740
|
+
[cov-image]: https://img.shields.io/codecov/c/github/medikoo/type.svg
|
741
|
+
[cov-url]: https://codecov.io/gh/medikoo/type
|
742
|
+
[npm-image]: https://img.shields.io/npm/v/type.svg
|
743
|
+
[npm-url]: https://www.npmjs.com/package/type
|