@cuemath/web-utils 0.0.1-beta.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/.eslintrc.json +9 -0
- package/.husky/pre-commit +4 -0
- package/.nvmrc +1 -0
- package/.prettierrc.json +1 -0
- package/.vscode/settings.json +1 -0
- package/README.md +1 -0
- package/dist/index.js +18 -0
- package/package.json +39 -0
- package/src/cookie/index.ts +19 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +8 -0
package/.eslintrc.json
ADDED
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v18.12.1
|
package/.prettierrc.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"@cuemath/prettier-config"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
### Shared UI utils package
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cookie"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cuemath/web-utils",
|
|
3
|
+
"version": "0.0.1-beta.0",
|
|
4
|
+
"description": "Shareable utils package",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"lint": "tsc --noEmit && eslint 'src/**/*.{js,jsx,ts,tsx,json}'",
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"build-watch": "tsc -w",
|
|
10
|
+
"prepublishOnly": "rm -rf dist && yarn build",
|
|
11
|
+
"prepare": "husky install"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/cuemath/ui-utils.git"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/cuemath/ui-utils/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/cuemath/ui-utils#readme",
|
|
21
|
+
"author": "santosh k <santosh.k@cuemath.com>",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@cuemath/eslint-config": "1.0.9",
|
|
25
|
+
"@cuemath/prettier-config": "1.0.3",
|
|
26
|
+
"@cuemath/ts-config": "0.0.5",
|
|
27
|
+
"@types/uuid": "9.0.0",
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "5.47.0",
|
|
29
|
+
"@typescript-eslint/parser": "5.47.0",
|
|
30
|
+
"eslint": "7.32.0",
|
|
31
|
+
"eslint-config-prettier": "8.5.0",
|
|
32
|
+
"eslint-plugin-import": "2.26.0",
|
|
33
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
34
|
+
"husky": "8.0.2",
|
|
35
|
+
"prettier": "2.8.1",
|
|
36
|
+
"typescript": "4.9.4"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {}
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const getCookie = (name: string, cookie: string): string => {
|
|
2
|
+
if (!cookie) {
|
|
3
|
+
return '';
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const cookies = cookie.split('; ');
|
|
7
|
+
|
|
8
|
+
for (let i = 0; i < cookies.length; i += 1) {
|
|
9
|
+
if (cookies[i]) {
|
|
10
|
+
const [key, value] = cookies[i].split('=');
|
|
11
|
+
|
|
12
|
+
if (key === name) {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return '';
|
|
19
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cookie';
|