Skip to content

Commit c1e3421

Browse files
authored
Merge pull request #1 from typescript-package/develop
v0.0.1
2 parents 646c205 + 71b6235 commit c1e3421

15 files changed

+1045
-132
lines changed

.gitignore

Lines changed: 45 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,45 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
.pnpm-debug.log*
9-
10-
# Diagnostic reports (https://nodejs.org/api/report.html)
11-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12-
13-
# Runtime data
14-
pids
15-
*.pid
16-
*.seed
17-
*.pid.lock
18-
19-
# Directory for instrumented libs generated by jscoverage/JSCover
20-
lib-cov
21-
22-
# Coverage directory used by tools like istanbul
23-
coverage
24-
*.lcov
25-
26-
# nyc test coverage
27-
.nyc_output
28-
29-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30-
.grunt
31-
32-
# Bower dependency directory (https://bower.io/)
33-
bower_components
34-
35-
# node-waf configuration
36-
.lock-wscript
37-
38-
# Compiled binary addons (https://nodejs.org/api/addons.html)
39-
build/Release
40-
41-
# Dependency directories
42-
node_modules/
43-
jspm_packages/
44-
45-
# Snowpack dependency directory (https://snowpack.dev/)
46-
web_modules/
47-
48-
# TypeScript cache
49-
*.tsbuildinfo
50-
51-
# Optional npm cache directory
52-
.npm
53-
54-
# Optional eslint cache
55-
.eslintcache
56-
57-
# Optional stylelint cache
58-
.stylelintcache
59-
60-
# Microbundle cache
61-
.rpt2_cache/
62-
.rts2_cache_cjs/
63-
.rts2_cache_es/
64-
.rts2_cache_umd/
65-
66-
# Optional REPL history
67-
.node_repl_history
68-
69-
# Output of 'npm pack'
70-
*.tgz
71-
72-
# Yarn Integrity file
73-
.yarn-integrity
74-
75-
# dotenv environment variable files
76-
.env
77-
.env.development.local
78-
.env.test.local
79-
.env.production.local
80-
.env.local
81-
82-
# parcel-bundler cache (https://parceljs.org/)
83-
.cache
84-
.parcel-cache
85-
86-
# Next.js build output
87-
.next
88-
out
89-
90-
# Nuxt.js build / generate output
91-
.nuxt
92-
dist
93-
94-
# Gatsby files
95-
.cache/
96-
# Comment in the public line in if your project uses Gatsby and not Next.js
97-
# https://nextjs.org/blog/next-9-1#public-directory-support
98-
# public
99-
100-
# vuepress build output
101-
.vuepress/dist
102-
103-
# vuepress v2.x temp and cache directory
104-
.temp
105-
.cache
106-
107-
# Docusaurus cache and generated files
108-
.docusaurus
109-
110-
# Serverless directories
111-
.serverless/
112-
113-
# FuseBox cache
114-
.fusebox/
115-
116-
# DynamoDB Local files
117-
.dynamodb/
118-
119-
# TernJS port file
120-
.tern-port
121-
122-
# Stores VSCode versions used for testing VSCode extensions
123-
.vscode-test
124-
125-
# yarn v2
126-
.yarn/cache
127-
.yarn/unplugged
128-
.yarn/build-state.yml
129-
.yarn/install-state.gz
130-
.pnp.*
1+
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
testem.log
38+
/typings
39+
40+
# System files
41+
.DS_Store
42+
Thumbs.db
43+
44+
*.ignore*
45+
temp

README.md

Lines changed: 167 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,167 @@
1-
# wrapper
2-
Wrap the text with the opening and closing chars.
1+
2+
<a href="https://www.typescriptlang.org/">
3+
<img
4+
src="https://raw.githubusercontent.com/typescript-package/core/refs/heads/main/ts-package-barcode-logo-512.png"
5+
width="20%"
6+
title="@typescript-package/wrapper"
7+
/>
8+
</a>
9+
10+
## typescript-package/wrapper
11+
12+
A lightweight TypeScript library to wrap the text with the opening and closing chars.
13+
14+
<!-- npm badge -->
15+
[![npm version][typescript-package-npm-badge-svg]][typescript-package-npm-badge]
16+
[![GitHub issues][typescript-package-badge-issues]][typescript-package-issues]
17+
[![GitHub license][typescript-package-badge-license]][typescript-package-license]
18+
19+
<br>
20+
21+
## Table of contents
22+
23+
* [Installation](#installation)
24+
* [Api](#api)
25+
* [Git](#git)
26+
* [Commit](#commit)
27+
* [Versioning](#versioning)
28+
* [License](#license)
29+
30+
## Installation
31+
32+
```bash
33+
npm install @typescript-package/wrapper
34+
```
35+
36+
## Api
37+
38+
```typescript
39+
import {
40+
// Object.
41+
Wrap,
42+
Wrapper,
43+
// Type
44+
Wrapped
45+
} from '@typescript-package/wrapper';
46+
```
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+
110+
## GIT
111+
112+
### Commit
113+
114+
* [AngularJS Git Commit Message Conventions][git-commit-angular]
115+
* [Karma Git Commit Msg][git-commit-karma]
116+
* [Conventional Commits][git-commit-conventional]
117+
118+
### Versioning
119+
120+
[Semantic Versioning 2.0.0][git-semver]
121+
122+
**Given a version number MAJOR.MINOR.PATCH, increment the:**
123+
124+
* MAJOR version when you make incompatible API changes,
125+
* MINOR version when you add functionality in a backwards-compatible manner, and
126+
* PATCH version when you make backwards-compatible bug fixes.
127+
128+
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
129+
130+
**FAQ**
131+
How should I deal with revisions in the 0.y.z initial development phase?
132+
133+
> The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release.
134+
135+
How do I know when to release 1.0.0?
136+
137+
> If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0.
138+
139+
## License
140+
141+
MIT © typescript-package ([license][typescript-package-license])
142+
143+
<!-- This package: typescript-package -->
144+
<!-- GitHub: badges -->
145+
[typescript-package-badge-issues]: https://img.shields.io/github/issues/typescript-package/wrapper
146+
[isscript-package-badge-forks]: https://img.shields.io/github/forks/typescript-package/wrapper
147+
[typescript-package-badge-stars]: https://img.shields.io/github/stars/typescript-package/wrapper
148+
[typescript-package-badge-license]: https://img.shields.io/github/license/typescript-package/wrapper
149+
<!-- GitHub: badges links -->
150+
[typescript-package-issues]: https://github.com/typescript-package/wrapper/issues
151+
[typescript-package-forks]: https://github.com/typescript-package/wrapper/network
152+
[typescript-package-license]: https://github.com/typescript-package/wrapper/blob/master/LICENSE
153+
[typescript-package-stars]: https://github.com/typescript-package/wrapper/stargazers
154+
<!-- This package -->
155+
156+
<!-- Package: typescript-package -->
157+
<!-- npm -->
158+
[typescript-package-npm-badge-svg]: https://badge.fury.io/js/@typescript-package%2Fwrapper.svg
159+
[typescript-package-npm-badge]: https://badge.fury.io/js/@typescript-package%2Fwrapper
160+
161+
<!-- GIT -->
162+
[git-semver]: http://semver.org/
163+
164+
<!-- GIT: commit -->
165+
[git-commit-angular]: https://gist.github.com/stephenparish/9941e89d80e2bc58a153
166+
[git-commit-karma]: http://karma-runner.github.io/0.10/dev/git-commit-msg.html
167+
[git-commit-conventional]: https://www.conventionalcommits.org/en/v1.0.0/

ng-package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "../../dist/wrapper",
4+
"lib": {
5+
"entryFile": "src/public-api.ts"
6+
},
7+
"keepLifecycleScripts": true
8+
}

package-lock.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)