@kakasoo/proto-typescript
Advanced tools
Comparing version 1.3.0 to 1.4.0
import { Split } from '../types'; | ||
export declare const StringPrototype: { | ||
split<Container extends string, Splitter extends string, Limit extends number>(container: Container, splitter: Splitter, limit?: Limit | undefined): Split<Container, Splitter, Limit>; | ||
/** | ||
* type-safe split. | ||
* @example StringPrototype.split('abcde', 'c', 1) // ['ab'] | ||
* | ||
* @param container | ||
* @param splitter | ||
* @param limit | ||
* @returns | ||
*/ | ||
split<Container extends string, Splitter extends string = "", Limit extends number = 0>(container: Container, splitter: Splitter, limit?: Limit | undefined): Split<Container, Splitter, Limit>; | ||
}; | ||
//# sourceMappingURL=string.prototype.d.ts.map |
@@ -5,2 +5,11 @@ "use strict"; | ||
exports.StringPrototype = { | ||
/** | ||
* type-safe split. | ||
* @example StringPrototype.split('abcde', 'c', 1) // ['ab'] | ||
* | ||
* @param container | ||
* @param splitter | ||
* @param limit | ||
* @returns | ||
*/ | ||
split(container, splitter, limit) { | ||
@@ -7,0 +16,0 @@ return container.split(splitter, limit); |
@@ -16,4 +16,4 @@ "use strict"; | ||
join(separator = '') { | ||
const initalValue = prototypes_1.ArrayPrototype.join(this.data, separator); | ||
return new typed_string_class_1.TypedString(initalValue); | ||
const initialValue = prototypes_1.ArrayPrototype.join(this.data, separator); | ||
return new typed_string_class_1.TypedString(initialValue); | ||
} | ||
@@ -20,0 +20,0 @@ toPrimitive() { |
import { toPrimitive } from './interfaces/to-primitive.interface'; | ||
import { StringPrototype } from './prototypes'; | ||
import { TypedArray } from './typed-array.class'; | ||
export declare class TypedString<T extends string | number | boolean> implements toPrimitive<`${T}`> { | ||
private readonly data; | ||
constructor(data: T); | ||
split<Splitter extends string = '', Limit extends number = 0>(splitter?: Splitter, limit?: Limit): TypedArray<ReturnType<typeof StringPrototype.split<`${T}`, Splitter, Limit>>>; | ||
toPrimitive(): `${T}`; | ||
} | ||
//# sourceMappingURL=typed-string.class.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TypedString = void 0; | ||
const typed_array_class_1 = require("./typed-array.class"); | ||
class TypedString { | ||
@@ -8,2 +9,6 @@ constructor(data) { | ||
} | ||
split(splitter = '', limit = 0) { | ||
const initialValue = this.data.split(splitter, limit); | ||
return new typed_array_class_1.TypedArray(initialValue); | ||
} | ||
toPrimitive() { | ||
@@ -10,0 +15,0 @@ return this.data; |
{ | ||
"name": "@kakasoo/proto-typescript", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49670
493