Comparing version 3.0.1 to 3.1.0
@@ -9,2 +9,4 @@ /** Regular expression for matching surrogate pairs. */ | ||
private readonly unsafeString; | ||
/** Index signature: implemented via Proxy returned by the constructor. */ | ||
[index: number]: UtfString; | ||
/** | ||
@@ -11,0 +13,0 @@ * Creates a new UTF-safe string object. |
@@ -42,2 +42,9 @@ "use strict"; | ||
} | ||
return new Proxy(this, { | ||
get: (obj, key) => { | ||
return typeof key === "string" && Number.isInteger(Number(key)) | ||
? obj.charAt(parseInt(key, 0)) | ||
: obj[key]; | ||
}, | ||
}); | ||
} | ||
@@ -44,0 +51,0 @@ /** |
{ | ||
"name": "utfstring", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "UTF-safe string operations", | ||
@@ -27,11 +27,12 @@ "repository": { | ||
"devDependencies": { | ||
"@types/mocha": "9.1.1", | ||
"expect": "29.0.3", | ||
"mocha": "10.0.0", | ||
"prettier": "2.7.1", | ||
"@types/node": "14.14.31", | ||
"@types/mocha": "10.0.1", | ||
"expect": "29.3.1", | ||
"mocha": "10.1.0", | ||
"prettier": "2.8.0", | ||
"rimraf": "3.0.2", | ||
"ts-node": "10.9.1", | ||
"typescript": "4.8.3", | ||
"webpack": "5.74.0", | ||
"webpack-cli": "4.10.0" | ||
"typescript": "4.9.3", | ||
"webpack": "5.75.0", | ||
"webpack-cli": "5.0.0" | ||
}, | ||
@@ -41,4 +42,5 @@ "scripts": { | ||
"build": "rimraf dist browser && tsc && webpack", | ||
"test": "mocha -r ts-node/register -reporter min 'test/**/*.ts'" | ||
"test": "mocha -r ts-node/register -reporter min 'test/**/*.ts'", | ||
"prepublishOnly": "npm test && npm run build" | ||
} | ||
} |
@@ -69,5 +69,7 @@ [![NPM Version](https://img.shields.io/npm/v/utfstring?color=33cd56&logo=npm)](https://www.npmjs.com/package/utfstring) | ||
* `[Number index]` - Indexer: returns the character at the given index from the string. | ||
* `*[Symbol.iterator]` - Allows you to iterate over the characters of the string using a `for-of` loop. | ||
* `charAt(Integer index)` - Returns the character at the given index from the string. | ||
* `charAt(Integer index)` - Same as using the indexer. | ||
@@ -74,0 +76,0 @@ * `charCodeAt(Integer index)` - Returns the Unicode codepoint at the given index. |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
75213
1375
212
0
10