Wrapper
PackagesTwitterGitHub
Draft
Draft
  • Introduction
  • ❤ Benefits
    • Explanation
    • Designing
  • General concepts
  • Getting started
    • Skeleton
    • Installation
      • npm
    • Public API
    • Basic concepts
  • Wrap {}
    • Overview
    • Generic type variables
    • ★ Constructor
    • Accessors
      • get closing()
      • get opening()
      • get text()
      • get [Symbol.toStringTag]()
    • Properties
      • #closing
      • #opening
      • #text
    • Methods
      • ↓ Static
      • static hasClosing()
      • static hasOpening()
      • static isWrap()
      • ↓ Instance
      • getClosing()
      • getOpening()
      • getText()
      • hasClosing()
      • hasOpening()
      • hasText()
      • isWrapped()
      • ★ replaceClosing()
      • ★ replaceOpening()
      • ★ replaceText()
      • toString()
      • valueOf()
    • Example usage
  • Wrapper {}
    • Overview
    • Generic type variables
    • Constructor
    • Accessors
      • get [Symbol.toStringTag]()
    • Methods
      • ↓ Static
      • static define()
      • static isWrapper()
      • static replaceClosing()
      • static replaceOpening()
      • static unwrap()
      • ↓ Instance
      • isClosingIn()
      • isOpeningIn()
      • replaceClosingIn()
      • replaceOpeningIn()
      • removeWrapIn()
      • textReplaceClosing()
      • textReplaceOpening()
      • ⚠ textHasClosing()
      • ⚠ textHasOpening()
      • textUnwrap()
      • textWrap()
      • toArray()
      • toWrap()
      • unwrap()
      • unwrapText()
      • ★ wrap()
      • ★ wrapOn()
      • ★ wrapText()
    • Example usage
  • Type
    • Wrapped
  • Change log
    • Keep a changelog
    • CHANGELOG.md
    • v1.0.0
  • GIT
    • Commit
    • Semantic Versioning
  • License
    • MIT
  • Social
    • Gettr
    • Twitter
    • YouTube
  • Contact
    • ⋯ Chat
    • @ Email
    • ✆ Phone
  • Donate
    • ฿ Cryptocurrency
    • $ Fiat
Powered by GitBook
On this page
  • Wrap.prototype.hasClosing()
  • Parameters
  • Returns
  • Example usage
  • Given closing chars

Was this helpful?

Edit on GitHub
  1. Wrap {}
  2. Methods

hasClosing()

Checks whether the primitive value of a specified object has the closing chars or given closing chars.

PreviousgetText()NexthasOpening()

Last updated 3 years ago

Was this helpful?

Wrap.prototype.hasClosing()

Checks whether the of a specified object has the chars or given chars.

If given closing chars in the constructor are the empty string, the method returns false.

wrap.class.ts
public hasClosing(closing?: string): boolean {
  return (
    this.#closing.length >= 1 &&
    (typeof closing === 'string' ? this.#closing === closing : true)
  );
}

Parameters

closing?: string

Optional closing chars of a type to check whether the contains them at the end.

Returns

The return value is a indicating whether the has the chars or given chars.

Example usage

// Example usage.
import { Wrap } from '@angular-package/wrapper';

// Returns true.
new Wrap(`[`, `]`, 'quote').hasClosing();

// Returns false.
new Wrap(`[`, ``, 'quote').hasClosing();

Given closing chars

// Example usage of given closing chars.
import { Wrap } from '@angular-package/wrapper';

// Returns true.
new Wrap(`[`, `]`, 'quote').hasClosing(']');

// Returns false.
new Wrap(`[`, `]`, 'quote').hasClosing('');

// Returns false.
new Wrap(`[`, ``, 'quote').hasClosing('');

// Returns false.
new Wrap(`[`, ``, 'quote').hasClosing(']');
primitive value
closing
string
primitive value
boolean
primitive value
closing
closing
closing