Skip to content

Commit 71b6235

Browse files
docs(README.md): update.
1 parent e91547e commit 71b6235

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,68 @@ import {
4545
} from '@typescript-package/wrapper';
4646
```
4747

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+
48110
## GIT
49111

50112
### Commit

0 commit comments

Comments
 (0)