@alwatr/flat-string 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/main.cjs +3 -0
- package/dist/main.cjs.map +7 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.mjs +3 -0
- package/dist/main.mjs.map +7 -0
- package/package.json +64 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# 1.0.0 (2023-12-20)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* build process ([83fc4e6](https://github.com/Alwatr/nanolib/commit/83fc4e609f86c25291e5f89016d6777bf197ffcb)) by @AliMD
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **flat-string:** add new package for simplifies the complex C structures that are part of a combined JavaScript string ([ebfdcb3](https://github.com/Alwatr/nanolib/commit/ebfdcb368bc111e59d6b920f572d6365eef62144)) by @AliMD
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 S. Ali Mihandoost
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Flat String
|
|
2
|
+
|
|
3
|
+
This function simplifies the complex C structures that are part of a combined JavaScript string.
|
|
4
|
+
|
|
5
|
+
If you're frequently combining strings and then using that combined string somewhere else, you might discover that running your string through `flatString` significantly enhances performance.
|
|
6
|
+
|
|
7
|
+
In simpler terms, `flatString` is a function that optimizes the way strings are stored in memory in JavaScript. When you concatenate strings, JavaScript internally creates a complex structure to save memory. However, when you need to use this string, for example, to write it to a file or send it over the network, this complex structure needs to be flattened, which can take time. By using `flatString`, you flatten the string right after concatenation, making the subsequent use of the string faster.
|
package/dist/main.cjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* @alwatr/flat-string v1.0.0 */
|
|
2
|
+
"use strict";var g=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(n,t)=>{for(var i in t)g(n,i,{get:t[i],enumerable:!0})},c=(n,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of o(t))!u.call(n,r)&&r!==i&&g(n,r,{get:()=>t[r],enumerable:!(e=f(t,r))||e.enumerable});return n};var l=n=>c(g({},"__esModule",{value:!0}),n);var s={};a(s,{flatString:()=>p});module.exports=l(s);function p(n){return n|0,n}0&&(module.exports={flatString});
|
|
3
|
+
//# sourceMappingURL=main.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/main.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * This function simplifies the complex C structures that are part of a combined JavaScript string.\n *\n * @param str The string to flatten.\n * @returns The flattened string.\n * @example\n * ```typescript\n * flatString(myStr);\n * ```\n */\nexport function flatString (str: string): string {\n // @ts-expect-error because it alters wrong compilation errors.\n str | 0;\n return str;\n}\n"],
|
|
5
|
+
"mappings": ";yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAUO,SAASE,EAAYE,EAAqB,CAE/C,OAAAA,EAAM,EACCA,CACT",
|
|
6
|
+
"names": ["main_exports", "__export", "flatString", "__toCommonJS", "str"]
|
|
7
|
+
}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function simplifies the complex C structures that are part of a combined JavaScript string.
|
|
3
|
+
*
|
|
4
|
+
* @param str The string to flatten.
|
|
5
|
+
* @returns The flattened string.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* flatString(myStr);
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function flatString(str: string): string;
|
|
12
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAI/C"}
|
package/dist/main.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/main.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * This function simplifies the complex C structures that are part of a combined JavaScript string.\n *\n * @param str The string to flatten.\n * @returns The flattened string.\n * @example\n * ```typescript\n * flatString(myStr);\n * ```\n */\nexport function flatString (str: string): string {\n // @ts-expect-error because it alters wrong compilation errors.\n str | 0;\n return str;\n}\n"],
|
|
5
|
+
"mappings": ";AAUO,SAASA,EAAYC,EAAqB,CAE/C,OAAAA,EAAM,EACCA,CACT",
|
|
6
|
+
"names": ["flatString", "str"]
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alwatr/flat-string",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "The `flat-string` function flattens the underlying C structures of a concatenated JavaScript string.",
|
|
5
|
+
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"string",
|
|
8
|
+
"flat",
|
|
9
|
+
"flatten",
|
|
10
|
+
"optimize",
|
|
11
|
+
"concat",
|
|
12
|
+
"util",
|
|
13
|
+
"typescript",
|
|
14
|
+
"esm",
|
|
15
|
+
"alwatr"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "./dist/main.cjs",
|
|
19
|
+
"module": "./dist/main.mjs",
|
|
20
|
+
"types": "./dist/main.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/main.mjs",
|
|
24
|
+
"require": "./dist/main.cjs",
|
|
25
|
+
"types": "./dist/main.d.ts"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"files": [
|
|
30
|
+
"**/*.{d.ts.map,d.ts,js.map,js,html,md,cjs,mjs,cjs.map,mjs.map}"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/Alwatr/nanolib",
|
|
38
|
+
"directory": "packages/flat-string"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/Alwatr/nanolib/tree/next/packages/flat-string#readme",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/Alwatr/nanolib/issues"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"b": "yarn run build",
|
|
46
|
+
"w": "yarn run watch",
|
|
47
|
+
"c": "yarn run clean",
|
|
48
|
+
"cb": "yarn run clean && yarn run build",
|
|
49
|
+
"d": "yarn run build:es && ALWATR_DEBUG=1 yarn node",
|
|
50
|
+
"build": "yarn run build:ts & yarn run build:es",
|
|
51
|
+
"build:es": "nano-build",
|
|
52
|
+
"build:ts": "tsc --build",
|
|
53
|
+
"watch": "yarn run watch:ts & yarn run watch:es",
|
|
54
|
+
"watch:es": "yarn run build:es --watch",
|
|
55
|
+
"watch:ts": "yarn run build:ts --watch --preserveWatchOutput",
|
|
56
|
+
"clean": "rm -rfv dist .tsbuildinfo"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@alwatr/nano-build": "^1.0.0",
|
|
60
|
+
"@alwatr/tsconfig-base": "^1.0.0",
|
|
61
|
+
"typescript": "^5.3.3"
|
|
62
|
+
},
|
|
63
|
+
"gitHead": "1896de798973e9de67df6d20e8451a957b985636"
|
|
64
|
+
}
|