{"version":3,"file":"typescript-package-name.mjs","sources":["../../../package/name/src/affix/lib/affix.abstract.ts","../../../package/name/src/affix/lib/prefix.class.ts","../../../package/name/src/affix/lib/suffix.class.ts","../../../package/name/src/lib/common-name.class.ts","../../../package/name/src/lib/name.class.ts","../../../package/name/src/public-api.ts","../../../package/name/src/typescript-package-name.ts"],"sourcesContent":["/**\n * @description\n * @export\n * @abstract\n * @class Affix\n */\nexport abstract class Affix {\n  /**\n   * @description Define affix for the name.\n   * @public\n   * @static\n   * @param {string} value A `string` type value.\n   * @param {RegExp} [filter=Affix.filter] \n   * @returns {string} The return value is a `string` type affix.\n   */\n  public static define(\n    value: string,\n    filter: RegExp = Affix.filter,\n  ): string {\n    return value.replace(filter, '');\n  }\n\n  /**\n   * @description\n   * @public\n   * @static\n   * @type {RegExp}\n   */\n  public static filter = /[^a-zA-Z0-9$_]/g;\n\n  /**\n   * @description Returns privately stored affix.\n   * @public\n   * @readonly\n   * @type {string}\n   */\n  public get get(): string {\n    return this.#affix;\n  }\n\n  /**\n   * @description\n   * @type {RegExp}\n   */\n  #filter = Affix.filter;\n\n  /**\n   * @description Initialize default affix.\n   * @type {string}\n   */\n  #affix = '';\n\n  /**\n   * Creates an instance of child class.\n   * @constructor\n   * @param {?string} [affix] An optional initial `string` type value as affix.\n   * @param {?RegExp} [filter] The filter of `RegExp` for affix.\n   */\n  constructor(affix?: string, filter?: RegExp) {\n    typeof affix === 'string' && this.set(affix);\n    typeof filter === 'string' && (this.#filter = filter);\n  }\n  \n  /**\n   * @description Sets and stores privately affix of a string type for the name.\n   * @public\n   * @param {string} affix A `string` type value.\n   * @returns {this}\n   */\n  public set(affix: string): this {\n    typeof affix === 'string' && (this.#affix = Affix.define(affix, this.#filter));\n    return this;\n  }\n}\n","// Class.\nimport { Affix } from \"./affix.abstract\";\n/**\n * @description\n * @export\n * @class Prefix\n * @extends {Affix}\n */\nexport class Prefix extends Affix {}\n","// Class.\nimport { Affix } from \"./affix.abstract\";\n/**\n * @description\n * @export\n * @class Suffix\n * @extends {Affix}\n */\nexport class Suffix extends Affix {}\n","// Class.\nimport { Prefix } from '../affix/lib/prefix.class';\nimport { Suffix } from '../affix/lib/suffix.class';\n/**\n * @description\n * @export\n * @abstract\n * @class CommonName\n */\nexport abstract class CommonName {\n  /**\n   * @description\n   * @public\n   * @readonly\n   * @type {string}\n   */\n  public get prefix() {\n    return this.#prefix.get;\n  }\n\n  /**\n   * @description\n   * @public\n   * @readonly\n   * @type {string}\n   */\n  public get suffix() {\n    return this.#suffix.get;\n  }\n\n  /**\n   * @description Private namespace for prefix.\n   * @type {Prefix}\n   */\n  #prefix: Prefix = new Prefix();\n  \n  /**\n   * @description Private namespace for suffix.\n   * @type {Suffix}\n   */\n  #suffix: Suffix = new Suffix();\n\n  /**\n   * Creates an instance of child class.\n   * @constructor\n   * @param {{ prefix?: string, suffix?: string }} [param0={}] \n   * @param {string} param0.prefix \n   * @param {string} param0.suffix \n   */\n  constructor({ prefix, suffix }: { prefix?: string, suffix?: string } = {}) {\n    typeof prefix === 'string' && this.setPrefix(prefix);\n    typeof suffix === 'string' && this.setSuffix(suffix);\n  }\n  \n  /**\n   * @description Set prefix for the name.\n   * @public\n   * @param {string} prefix A `string` type value as prefix.\n   * @returns {this} \n   */\n  public setPrefix(prefix: string): this {\n    this.#prefix.set(prefix);\n    return this;\n  }\n\n  /**\n   * @description Sets suffix for the name.\n   * @public\n   * @param {string} suffix A `string` type value as suffix.\n   * @returns {this} \n   */\n  public setSuffix(suffix: string): this {\n    this.#suffix.set(suffix);\n    return this;\n  }\n}\n","// Class.\nimport { CommonName } from './common-name.class';\nimport { Wrap } from '@typescript-package/wrapper';\n/**\n * @description\n * @export\n * @class Name\n * @template {string} [Prefix=''] \n * @template {string} [Name=string] \n * @template {string} [Suffix=''] \n * @extends {CommonName}\n */\nexport class Name<\n  Prefix extends string = '',\n  Name extends string = string,\n  Suffix extends string = '',\n> extends CommonName {\n  /**\n   * @description Returns privately stored name.\n   * @public\n   * @readonly\n   * @type {Name}\n   */\n  public get get() {\n    return this.#name;\n  }\n\n  /**\n   * @inheritdoc\n   * @public\n   * @readonly\n   * @type {Prefix}\n   */\n  public override get prefix(): Prefix {\n    return super.prefix as Prefix;\n  }\n\n  /**\n   * @inheritdoc\n   * @public\n   * @readonly\n   * @type {Suffix}\n   */\n  public override get suffix(): Suffix {\n    return super.suffix as Suffix;\n  }\n\n  /**\n   * @description Generates the name with prefix and suffix.\n   * @public\n   * @readonly\n   * @type {`${Prefix}${Name}${Suffix}`}\n   */\n  public get generate(): `${Prefix}${Name}${Suffix}` {\n    return new Wrap(this.prefix, this.suffix, this.#name).valueOf();\n  }\n\n  /**\n   * @description\n   * @type {Name}\n   */\n  #name;\n\n  /**\n   * Creates an instance of `Name`.\n   * @constructor\n   * @param {Name} name \n   * @param {{ prefix?: Prefix, suffix?: Suffix }} [param0={}] \n   * @param {Prefix} param0.prefix \n   * @param {Suffix} param0.suffix \n   */\n  constructor(\n    name: Name,\n    { prefix, suffix }: { prefix?: Prefix, suffix?: Suffix } = {}\n  ) {\n    super({ prefix, suffix });\n    this.#name = name;\n  }\n\n  /**\n   * @description Set the name.\n   * @public\n   * @param {string} name A `string` type value.\n   * @returns {this} \n   */\n  public set<CustomName extends string = string>(name: Name | CustomName): this {\n    typeof name === 'string' && (this.#name = name as any);\n    return this;\n  }\n}\n","/*\n * Public API Surface of name\n */\nexport {\n  Affix,\n  Prefix,\n  Suffix\n} from './affix';\n\nexport {\n  CommonName,\n  Name\n} from './lib';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;AAKG;MACmB,KAAK,CAAA;AACzB;;;;;;;AAOG;IACI,OAAO,MAAM,CAClB,KAAa,EACb,MAAiB,GAAA,EAAK,CAAC,MAAM,EAAA;QAE7B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;;AAGlC;;;;;AAKG;AACI,IAAA,OAAO,MAAM,GA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