Skip to content

v0.0.1 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 45 additions & 130 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,130 +1,45 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db

*.ignore*
temp
169 changes: 167 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,167 @@
# wrapper
Wrap the text with the opening and closing chars.

<a href="https://www.typescriptlang.org/">
<img
src="https://raw.githubusercontent.com/typescript-package/core/refs/heads/main/ts-package-barcode-logo-512.png"
width="20%"
title="@typescript-package/wrapper"
/>
</a>

## typescript-package/wrapper

A lightweight TypeScript library to wrap the text with the opening and closing chars.

<!-- npm badge -->
[![npm version][typescript-package-npm-badge-svg]][typescript-package-npm-badge]
[![GitHub issues][typescript-package-badge-issues]][typescript-package-issues]
[![GitHub license][typescript-package-badge-license]][typescript-package-license]

<br>

## Table of contents

* [Installation](#installation)
* [Api](#api)
* [Git](#git)
* [Commit](#commit)
* [Versioning](#versioning)
* [License](#license)

## Installation

```bash
npm install @typescript-package/wrapper
```

## Api

```typescript
import {
// Object.
Wrap,
Wrapper,
// Type
Wrapped
} from '@typescript-package/wrapper';
```

### `Wrap`

```typescript
import { Wrap } from "@typescript-package/wrapper";

// Initialize.
const htmlTag = new Wrap('<', '>', 'div');

// The `Wrap` object.
console.log(htmlTag); // Output: Wrap {'<div>', #closing: '>', #opening: '<', #text: 'div'}

console.log(htmlTag.valueOf()); // Output: <div>

// Initialize.
const bbCode = new Wrap('[', ']', 'quote');

console.log(bbCode); // Output: Wrap {'[quote]', #closing: ']', #opening: '[', #text: 'quote'}

console.log(bbCode.valueOf()); // Output: [quote]
```

### `Wrapper`

```typescript
import { Wrapper } from "@typescript-package/wrapper";

// Initialize.
const htmlTag = new Wrapper(
'<',
'>',
'div'
);

// The `Wrap` object.
console.log(htmlTag); // Output: Wrapper {'<div>', #closing: '>', #opening: '<', #text: 'div'}

console.log(htmlTag.valueOf()); // Output: <div>

// Initialize.
const bbCode = new Wrapper('[', ']', 'quote');

console.log(bbCode); // Output: Wrapper {'[quote]', #closing: ']', #opening: '[', #text: 'quote'}

// Wrap the valueOf [quote]
console.log(bbCode.wrap()); // Output: [[quote]]

// Wrap the valueOf [quote] with the specified `opening` and `closing` chars.
console.log(bbCode.wrap(`(`, `)`)); // Output: ([quote])

// Wrap the specified text with the `opening` and `closing` chars.
console.log(bbCode.wrapOn(`/italic`)); // Output: [/italic]

// Replace the `opening` and `closing` chars.
console.log(bbCode.rewrap(`(`, `)`)); // Output: (quote)

// Wraps the `text` inside.
console.log(bbCode.wrapText(`(`, `)`)); // Output: [(quote)]

// Returns the primitive value.
console.log(bbCode.valueOf()); // Output: [quote]
```

## GIT

### Commit

* [AngularJS Git Commit Message Conventions][git-commit-angular]
* [Karma Git Commit Msg][git-commit-karma]
* [Conventional Commits][git-commit-conventional]

### Versioning

[Semantic Versioning 2.0.0][git-semver]

**Given a version number MAJOR.MINOR.PATCH, increment the:**

* MAJOR version when you make incompatible API changes,
* MINOR version when you add functionality in a backwards-compatible manner, and
* PATCH version when you make backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

**FAQ**
How should I deal with revisions in the 0.y.z initial development phase?

> 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.

How do I know when to release 1.0.0?

> 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.

## License

MIT © typescript-package ([license][typescript-package-license])

<!-- This package: typescript-package -->
<!-- GitHub: badges -->
[typescript-package-badge-issues]: https://img.shields.io/github/issues/typescript-package/wrapper
[isscript-package-badge-forks]: https://img.shields.io/github/forks/typescript-package/wrapper
[typescript-package-badge-stars]: https://img.shields.io/github/stars/typescript-package/wrapper
[typescript-package-badge-license]: https://img.shields.io/github/license/typescript-package/wrapper
<!-- GitHub: badges links -->
[typescript-package-issues]: https://github.com/typescript-package/wrapper/issues
[typescript-package-forks]: https://github.com/typescript-package/wrapper/network
[typescript-package-license]: https://github.com/typescript-package/wrapper/blob/master/LICENSE
[typescript-package-stars]: https://github.com/typescript-package/wrapper/stargazers
<!-- This package -->

<!-- Package: typescript-package -->
<!-- npm -->
[typescript-package-npm-badge-svg]: https://badge.fury.io/js/@typescript-package%2Fwrapper.svg
[typescript-package-npm-badge]: https://badge.fury.io/js/@typescript-package%2Fwrapper

<!-- GIT -->
[git-semver]: http://semver.org/

<!-- GIT: commit -->
[git-commit-angular]: https://gist.github.com/stephenparish/9941e89d80e2bc58a153
[git-commit-karma]: http://karma-runner.github.io/0.10/dev/git-commit-msg.html
[git-commit-conventional]: https://www.conventionalcommits.org/en/v1.0.0/
8 changes: 8 additions & 0 deletions ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/wrapper",
"lib": {
"entryFile": "src/public-api.ts"
},
"keepLifecycleScripts": true
}
35 changes: 35 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading