You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -26,18 +26,19 @@ Return value:
26
26
The **Type** class extends the **String** class. In addition to storing a type name, its properties reveal whether the tested value was an object or a primitive.
27
27
28
28
Syntax:
29
-
> `new Type(typeName, isPrimitive)`
29
+
> `new Type(typeName)`
30
+
> `new Type(typeName, objectType)`
30
31
31
32
Parameters:
32
33
-***typeName*** - (string)
33
-
-***objectType*** - (string) Optional. The object name used by `Object.prototype.toString()`. Pass this argument for object types only.
34
+
-***objectType*** - (string) The object name used by `Object.prototype.toString()`. Include this for object types. Do not include this for primitive types.
34
35
35
36
| Property | Type | Description |
36
37
| --- | --- | --- |
37
-
| .**type**| string | The type name. This is also the instance's primitive value. |
38
-
| .**objectType**| string | The object name used by `Object.prototype.toString()`..|
39
-
| .**primitive**| string |If the `objectType` argument was falsy when constructed, this property was set to the type name. Otherwise, it's undefined. |
40
-
| .**object**| string |If the `objectType` argument was truthy when constructed, this property was set to the type name. Otherwise, it's undefined. |
38
+
| .**type**| string | The type name (`typeName`). This is also the instance's primitive value. |
39
+
| .**objectType**| string | The object name used by `Object.prototype.toString()`. |
40
+
| .**primitive**| string |For primitive types, this property is set to `typeName`. Otherwise, it's undefined. |
41
+
| .**object**| string |For object types, this property is set to `typeName`. Otherwise, it's undefined. |
0 commit comments