Comparing version 0.7.1 to 0.7.2
import { capitalize } from '../string.js'; | ||
export const types = ['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64', 'float32', 'float64']; | ||
export const valids = [...types, ...types.map(t => capitalize(t)), 'char']; | ||
export const regex = /^(u?int)(8|16|32|64)|(float)(32|64)$/i; | ||
export const regex = /^(u?int|float)(8|16|32|64)$/i; | ||
export function normalize(type) { | ||
@@ -6,0 +6,0 @@ return (type == 'char' ? 'uint8' : type.toLowerCase()); |
@@ -15,6 +15,6 @@ import { EventEmitter } from 'eventemitter3'; | ||
toArray() { | ||
return [...this.data]; | ||
return Array.from(this.data); | ||
} | ||
toJSON() { | ||
return JSON.stringify([...this.data]); | ||
return JSON.stringify(Array.from(this.data)); | ||
} | ||
@@ -28,3 +28,3 @@ toString() { | ||
} | ||
const data = [...this.data]; | ||
const data = Array.from(this.data); | ||
data.splice(index, 1, value); | ||
@@ -38,3 +38,3 @@ this.data = new Set(data); | ||
} | ||
this.delete([...this.data].at(index)); | ||
this.delete(Array.from(this.data).at(index)); | ||
} | ||
@@ -46,6 +46,6 @@ // Array methods | ||
} | ||
return [...this.data].at(index); | ||
return Array.from(this.data).at(index); | ||
} | ||
pop() { | ||
const item = [...this.data].pop(); | ||
const item = Array.from(this.data).pop(); | ||
if (item !== undefined) { | ||
@@ -63,3 +63,3 @@ this.delete(item); | ||
join(separator) { | ||
return [...this.data].join(separator); | ||
return Array.from(this.data).join(separator); | ||
} | ||
@@ -70,3 +70,3 @@ splice(start, deleteCount, ...items) { | ||
} | ||
const data = [...this.data]; | ||
const data = Array.from(this.data); | ||
const deleted = data.splice(start, deleteCount, ...items); | ||
@@ -73,0 +73,0 @@ this.data = new Set(data); |
{ | ||
"name": "utilium", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "Typescript utilies", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -18,3 +18,3 @@ import { capitalize } from '../string.js'; | ||
export const regex = /^(u?int)(8|16|32|64)|(float)(32|64)$/i; | ||
export const regex = /^(u?int|float)(8|16|32|64)$/i; | ||
@@ -21,0 +21,0 @@ export type Normalize<T extends Valid> = T extends 'char' ? 'uint8' : Uncapitalize<T>; |
@@ -20,7 +20,7 @@ import { EventEmitter } from 'eventemitter3'; | ||
public toArray(): T[] { | ||
return [...this.data]; | ||
return Array.from(this.data); | ||
} | ||
public toJSON() { | ||
return JSON.stringify([...this.data]); | ||
return JSON.stringify(Array.from(this.data)); | ||
} | ||
@@ -37,3 +37,3 @@ | ||
const data = [...this.data]; | ||
const data = Array.from(this.data); | ||
data.splice(index, 1, value); | ||
@@ -49,3 +49,3 @@ this.data = new Set<T>(data); | ||
this.delete([...this.data].at(index)!); | ||
this.delete(Array.from(this.data).at(index)!); | ||
} | ||
@@ -60,7 +60,7 @@ | ||
return [...this.data].at(index)!; | ||
return Array.from(this.data).at(index)!; | ||
} | ||
public pop(): T | undefined { | ||
const item = [...this.data].pop(); | ||
const item = Array.from(this.data).pop(); | ||
if (item !== undefined) { | ||
@@ -80,3 +80,3 @@ this.delete(item); | ||
public join(separator?: string): string { | ||
return [...this.data].join(separator); | ||
return Array.from(this.data).join(separator); | ||
} | ||
@@ -89,3 +89,3 @@ | ||
const data = [...this.data]; | ||
const data = Array.from(this.data); | ||
const deleted = data.splice(start, deleteCount, ...items); | ||
@@ -92,0 +92,0 @@ this.data = new Set<T>(data); |
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
69725