@kakasoo/proto-typescript
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -15,2 +15,3 @@ import { At, Join } from '../types'; | ||
* | ||
* @inheritdoc | ||
* @param container | ||
@@ -17,0 +18,0 @@ * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. |
@@ -19,2 +19,3 @@ "use strict"; | ||
* | ||
* @inheritdoc | ||
* @param container | ||
@@ -21,0 +22,0 @@ * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. |
import { toPrimitive } from './interfaces/to-primitive.interface'; | ||
import { ArrayPrototype } from './prototypes'; | ||
import { TypedNumber } from './typed-number.class'; | ||
import { TypedString } from './typed-string.class'; | ||
@@ -8,7 +9,7 @@ import { MethodsFrom } from './types'; | ||
constructor(data: T); | ||
constructor(...data: T); | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
* @inheritDoc | ||
*/ | ||
at<Index extends number = 0>(index: Index): ReturnType<typeof ArrayPrototype.at<T, Index>>; | ||
at<Index extends number = 0>(index?: Index | TypedNumber<Index>): ReturnType<typeof ArrayPrototype.at<T, Index>>; | ||
/** | ||
@@ -18,9 +19,8 @@ * type-safe join. | ||
* | ||
* @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. | ||
* @todo support `TypedArray` type as Container | ||
* @inheritdoc | ||
* @todo support `TypedString` type as Separator | ||
*/ | ||
join<Separator extends string>(separator?: Separator): TypedString<ReturnType<typeof ArrayPrototype.join<T, Separator>>>; | ||
join<Separator extends string = ','>(separator?: Separator | TypedString<Separator>): TypedString<ReturnType<typeof ArrayPrototype.join<T, Separator>>>; | ||
toPrimitive(): [...T]; | ||
} | ||
//# sourceMappingURL=typed-array.class.d.ts.map |
@@ -5,2 +5,3 @@ "use strict"; | ||
const prototypes_1 = require("./prototypes"); | ||
const typed_number_class_1 = require("./typed-number.class"); | ||
const typed_string_class_1 = require("./typed-string.class"); | ||
@@ -13,7 +14,7 @@ class TypedArray { | ||
/** | ||
* Returns the item located at the specified index. | ||
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
* @inheritDoc | ||
*/ | ||
at(index) { | ||
return this.at(index); | ||
at(index = new typed_number_class_1.TypedNumber()) { | ||
const primitiveIndex = typeof index === 'number' ? index : index.toPrimitive(); | ||
return this.at(primitiveIndex); | ||
} | ||
@@ -24,8 +25,8 @@ /** | ||
* | ||
* @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. | ||
* @todo support `TypedArray` type as Container | ||
* @inheritdoc | ||
* @todo support `TypedString` type as Separator | ||
*/ | ||
join(separator = '') { | ||
const initialValue = prototypes_1.ArrayPrototype.join(this.data, separator); | ||
join(separator = ',') { | ||
const primitiveSeparator = typeof separator === 'string' ? separator : separator.toPrimitive(); | ||
const initialValue = prototypes_1.ArrayPrototype.join(this.data, primitiveSeparator); | ||
return new typed_string_class_1.TypedString(initialValue); | ||
@@ -32,0 +33,0 @@ } |
@@ -14,4 +14,5 @@ import { toPrimitive } from './interfaces/to-primitive.interface'; | ||
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; | ||
toPrimitive(): `${T}`; | ||
} | ||
//# sourceMappingURL=typed-string.class.d.ts.map |
{ | ||
"name": "@kakasoo/proto-typescript", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"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
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
56919
582