type-fns 0.8.1 → 0.9.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/dist/companions/omit.d.ts +4 -0
- package/dist/companions/omit.js +15 -0
- package/dist/companions/omit.js.map +1 -0
- package/dist/companions/pick.d.ts +4 -0
- package/dist/companions/pick.js +15 -0
- package/dist/companions/pick.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -10
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.omit = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* a companion to the `Omit` type, returns a new object without the omitted attributes
|
|
6
|
+
*/
|
|
7
|
+
const omit = (obj, keys) => Object.entries(obj).reduce((summary, [key, value]) => {
|
|
8
|
+
// if key is in the specified keys, dont add it to the new object
|
|
9
|
+
if (keys.includes(key))
|
|
10
|
+
return summary;
|
|
11
|
+
// if it is not within specified keys, add it
|
|
12
|
+
return Object.assign(Object.assign({}, summary), { [key]: value });
|
|
13
|
+
}, {});
|
|
14
|
+
exports.omit = omit;
|
|
15
|
+
//# sourceMappingURL=omit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../src/companions/omit.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,IAAI,GAAG,CAClB,GAAM,EACN,IAAiB,EACa,EAAE,CAChC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IACnD,iEAAiE;IACjE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IAEvC,6CAA6C;IAC7C,uCAAY,OAAO,KAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAG;AACtC,CAAC,EAAE,EAAyB,CAAQ,CAAC;AAV1B,QAAA,IAAI,QAUsB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pick = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* a companion to the `Pick` type, returns a new object with only the picked attributes
|
|
6
|
+
*/
|
|
7
|
+
const pick = (obj, keys) => Object.entries(obj).reduce((summary, [key, value]) => {
|
|
8
|
+
// if key is not in the specified keys, dont add it to the new object
|
|
9
|
+
if (!keys.includes(key))
|
|
10
|
+
return summary;
|
|
11
|
+
// if it is within specified keys, add it
|
|
12
|
+
return Object.assign(Object.assign({}, summary), { [key]: value });
|
|
13
|
+
}, {});
|
|
14
|
+
exports.pick = pick;
|
|
15
|
+
//# sourceMappingURL=pick.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pick.js","sourceRoot":"","sources":["../../src/companions/pick.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,IAAI,GAAG,CAClB,GAAM,EACN,IAAiB,EACa,EAAE,CAChC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IACnD,qEAAqE;IACrE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IAExC,yCAAyC;IACzC,uCAAY,OAAO,KAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAG;AACtC,CAAC,EAAE,EAAyB,CAAQ,CAAC;AAV1B,QAAA,IAAI,QAUsB"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -26,4 +26,6 @@ __exportStar(require("./types/PickOne"), exports);
|
|
|
26
26
|
__exportStar(require("./checks/isNotNull"), exports);
|
|
27
27
|
__exportStar(require("./checks/isNotUndefined"), exports);
|
|
28
28
|
__exportStar(require("./types/DropFirst"), exports);
|
|
29
|
+
__exportStar(require("./companions/omit"), exports);
|
|
30
|
+
__exportStar(require("./companions/pick"), exports);
|
|
29
31
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,mDAAiC;AACjC,uDAAqC;AACrC,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,uDAAqC;AACrC,sDAAoC;AACpC,kDAAgC;AAChC,qDAAmC;AACnC,0DAAwC;AACxC,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,mDAAiC;AACjC,uDAAqC;AACrC,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,uDAAqC;AACrC,sDAAoC;AACpC,kDAAgC;AAChC,qDAAmC;AACnC,0DAAwC;AACxC,oDAAkC;AAClC,oDAAkC;AAClC,oDAAkC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "type-fns",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "A set of types, type checks, and type guards for simpler, safer, and easier to read code.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.9.0",
|
|
6
6
|
"repository": "ehmpathy/type-fns",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/type-fns",
|
|
8
8
|
"keywords": [
|
|
@@ -25,25 +25,23 @@
|
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
27
|
"commit:with-cli": "npx cz",
|
|
28
|
-
"fix:format:terraform": "echo 'no terraform'",
|
|
29
28
|
"fix:format:prettier": "prettier --write '**/*.ts' --config ./prettier.config.js",
|
|
30
|
-
"fix:format": "npm run fix:format:prettier
|
|
29
|
+
"fix:format": "npm run fix:format:prettier",
|
|
31
30
|
"fix:lint": "eslint -c ./.eslintrc.js src/**/*.ts --fix",
|
|
32
31
|
"build:artifact": "echo 'no artifact'",
|
|
33
32
|
"build:clean": "rm dist/ -rf",
|
|
34
33
|
"build:compile": "tsc -p ./tsconfig.build.json",
|
|
35
|
-
"build": "npm run build:clean && npm run build:compile
|
|
34
|
+
"build": "npm run build:clean && npm run build:compile",
|
|
36
35
|
"test:commits": "LAST_TAG=$(git describe --tags --abbrev=0 @^ 2> /dev/null || git rev-list --max-parents=0 HEAD) && npx commitlint --from $LAST_TAG --to HEAD --verbose",
|
|
37
36
|
"test:types": "tsc -p ./tsconfig.build.json --noEmit",
|
|
38
37
|
"prepublish": "npm run build",
|
|
39
|
-
"test:lint:deps": "npx depcheck -c ./depcheckrc.yml",
|
|
40
|
-
"test:format:terraform": "echo 'no terraform'",
|
|
41
38
|
"test:format:prettier": "prettier --parser typescript --check 'src/**/*.ts' --config ./prettier.config.js",
|
|
42
|
-
"test:format": "npm run test:format:prettier
|
|
39
|
+
"test:format": "npm run test:format:prettier",
|
|
40
|
+
"test:lint:deps": "npx depcheck -c ./depcheckrc.yml",
|
|
41
|
+
"test:lint:eslint": "eslint -c ./.eslintrc.js src/**/*.ts",
|
|
43
42
|
"test:lint": "npm run test:lint:eslint && npm run test:lint:deps",
|
|
44
43
|
"test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests",
|
|
45
44
|
"test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests",
|
|
46
|
-
"test:lint:eslint": "eslint -c ./.eslintrc.js src/**/*.ts",
|
|
47
45
|
"test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests",
|
|
48
46
|
"test": "npm run test:commits && npm run test:types && npm run test:format && npm run test:lint && npm run test:unit && npm run test:integration && npm run test:acceptance:locally",
|
|
49
47
|
"test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests",
|
|
@@ -62,8 +60,8 @@
|
|
|
62
60
|
"@typescript-eslint/parser": "5.46.1",
|
|
63
61
|
"core-js": "3.26.1",
|
|
64
62
|
"cz-conventional-changelog": "3.3.0",
|
|
65
|
-
"declapract": "
|
|
66
|
-
"declapract-typescript-ehmpathy": "
|
|
63
|
+
"declapract": "0.11.2",
|
|
64
|
+
"declapract-typescript-ehmpathy": "0.23.7",
|
|
67
65
|
"depcheck": "1.4.3",
|
|
68
66
|
"eslint": "8.30.0",
|
|
69
67
|
"eslint-config-airbnb-typescript": "17.0.0",
|