@@ -45,6 +45,68 @@ import {
45
45
} from ' @typescript-package/wrapper' ;
46
46
```
47
47
48
+ ### ` Wrap `
49
+
50
+ ``` typescript
51
+ import { Wrap } from " @typescript-package/wrapper" ;
52
+
53
+ // Initialize.
54
+ const htmlTag = new Wrap (' <' , ' >' , ' div' );
55
+
56
+ // The `Wrap` object.
57
+ console .log (htmlTag ); // Output: Wrap {'<div>', #closing: '>', #opening: '<', #text: 'div'}
58
+
59
+ console .log (htmlTag .valueOf ()); // Output: <div>
60
+
61
+ // Initialize.
62
+ const bbCode = new Wrap (' [' , ' ]' , ' quote' );
63
+
64
+ console .log (bbCode ); // Output: Wrap {'[quote]', #closing: ']', #opening: '[', #text: 'quote'}
65
+
66
+ console .log (bbCode .valueOf ()); // Output: [quote]
67
+ ```
68
+
69
+ ### ` Wrapper `
70
+
71
+ ``` typescript
72
+ import { Wrapper } from " @typescript-package/wrapper" ;
73
+
74
+ // Initialize.
75
+ const htmlTag = new Wrapper (
76
+ ' <' ,
77
+ ' >' ,
78
+ ' div'
79
+ );
80
+
81
+ // The `Wrap` object.
82
+ console .log (htmlTag ); // Output: Wrapper {'<div>', #closing: '>', #opening: '<', #text: 'div'}
83
+
84
+ console .log (htmlTag .valueOf ()); // Output: <div>
85
+
86
+ // Initialize.
87
+ const bbCode = new Wrapper (' [' , ' ]' , ' quote' );
88
+
89
+ console .log (bbCode ); // Output: Wrapper {'[quote]', #closing: ']', #opening: '[', #text: 'quote'}
90
+
91
+ // Wrap the valueOf [quote]
92
+ console .log (bbCode .wrap ()); // Output: [[quote]]
93
+
94
+ // Wrap the valueOf [quote] with the specified `opening` and `closing` chars.
95
+ console .log (bbCode .wrap (` ( ` , ` ) ` )); // Output: ([quote])
96
+
97
+ // Wrap the specified text with the `opening` and `closing` chars.
98
+ console .log (bbCode .wrapOn (` /italic ` )); // Output: [/italic]
99
+
100
+ // Replace the `opening` and `closing` chars.
101
+ console .log (bbCode .rewrap (` ( ` , ` ) ` )); // Output: (quote)
102
+
103
+ // Wraps the `text` inside.
104
+ console .log (bbCode .wrapText (` ( ` , ` ) ` )); // Output: [(quote)]
105
+
106
+ // Returns the primitive value.
107
+ console .log (bbCode .valueOf ()); // Output: [quote]
108
+ ```
109
+
48
110
## GIT
49
111
50
112
### Commit
0 commit comments