@kakasoo/proto-typescript
Advanced tools
Comparing version 1.4.2 to 1.5.0
@@ -1,2 +0,2 @@ | ||
export declare namespace NumberPrototype { } | ||
export declare const NumberPrototype: {}; | ||
//# sourceMappingURL=number.prototype.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NumberPrototype = void 0; | ||
exports.NumberPrototype = {}; | ||
//# sourceMappingURL=number.prototype.js.map |
import { toPrimitive } from './interfaces/to-primitive.interface'; | ||
import { StringPrototype } from './prototypes'; | ||
import { TypedArray } from './typed-array.class'; | ||
import { TypedNumber } from './typed-number.class'; | ||
export declare class TypedString<T extends string | number | boolean> implements toPrimitive<`${T}`> { | ||
@@ -11,9 +12,6 @@ private readonly data; | ||
* @param limit A value used to limit the number of elements returned in the array. | ||
* | ||
* @todo support `TypedString` type as Splitter | ||
* @todo support `TypedNumber` type as Limit | ||
*/ | ||
split<Splitter extends string = '', Limit extends number = 0>(splitter?: Splitter | TypedString<Splitter>, limit?: Limit): TypedArray<ReturnType<typeof StringPrototype.split<`${T}`, Splitter, Limit>>>; | ||
split<Splitter extends string = '', Limit extends number = 0>(splitter?: Splitter | TypedString<Splitter>, limit?: Limit | TypedNumber<Limit>): TypedArray<ReturnType<typeof StringPrototype.split<`${T}`, Splitter, Limit>>>; | ||
toPrimitive(): `${T}`; | ||
} | ||
//# sourceMappingURL=typed-string.class.d.ts.map |
@@ -5,2 +5,3 @@ "use strict"; | ||
const typed_array_class_1 = require("./typed-array.class"); | ||
const typed_number_class_1 = require("./typed-number.class"); | ||
class TypedString { | ||
@@ -14,9 +15,7 @@ constructor(data = '') { | ||
* @param limit A value used to limit the number of elements returned in the array. | ||
* | ||
* @todo support `TypedString` type as Splitter | ||
* @todo support `TypedNumber` type as Limit | ||
*/ | ||
split(splitter = new TypedString(), limit = 0) { | ||
const container = typeof splitter === 'string' ? splitter : splitter.toPrimitive(); | ||
const initialValue = this.data.split(container, limit); | ||
split(splitter = new TypedString(), limit = new typed_number_class_1.TypedNumber()) { | ||
const primitiveContainer = typeof splitter === 'string' ? splitter : splitter.toPrimitive(); | ||
const primitiveLimit = typeof limit === 'number' ? limit : limit.toPrimitive(); | ||
const initialValue = this.data.split(primitiveContainer, primitiveLimit); | ||
return new typed_array_class_1.TypedArray(initialValue); | ||
@@ -23,0 +22,0 @@ } |
{ | ||
"name": "@kakasoo/proto-typescript", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"publishConfig": { | ||
@@ -18,3 +18,7 @@ "access": "public" | ||
}, | ||
"keywords": [], | ||
"keywords": [ | ||
"type-safe", | ||
"prototype", | ||
"utility-types" | ||
], | ||
"author": "", | ||
@@ -21,0 +25,0 @@ "license": "ISC", |
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
54065
111
542