tk-base upgrade
This commit is contained in:
parent
5f2a1a0f4b
commit
80b74fbabd
6 changed files with 60 additions and 45 deletions
9
.gitlab-ci.yml
Normal file
9
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
image: node:latest
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- node_modules/
|
||||
|
||||
test:
|
||||
before_script: npm install
|
||||
script: npm test
|
|
@ -1,6 +1,11 @@
|
|||
tk-functional
|
||||
=============
|
||||
|
||||
[![pipeline status](https://gitlab.com/thunderk/tk-functional/badges/master/pipeline.svg)](https://gitlab.com/thunderk/tk-functional/commits/master)
|
||||
[![coverage report](https://gitlab.com/thunderk/tk-functional/badges/master/coverage.svg)](https://gitlab.com/thunderk/tk-functional/commits/master)
|
||||
[![npm version](https://img.shields.io/npm/v/tk-functional.svg)](https://npmjs.com/tk-functional)
|
||||
[![npm size](https://img.shields.io/bundlephobia/min/tk-functional.svg)](https://bundlephobia.com/result?p=tk-functional)
|
||||
|
||||
About
|
||||
-----
|
||||
|
||||
|
@ -8,7 +13,7 @@ Provides some common helpers for functional-style programming.
|
|||
|
||||
Typescript definitions are included.
|
||||
|
||||
Issues can be reported on [GitLab](https://gitlab.com/thunderk/tk-serializer/issues).
|
||||
Issues can be reported on [GitLab](https://gitlab.com/thunderk/tk-functional/issues).
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
@ -37,6 +42,6 @@ plus1({b: 8}) // => 9
|
|||
|
||||
```typescript
|
||||
[8, 3, 5].sort(cmp()) // => [3, 5, 8]
|
||||
[8, 3, 5].sort(cmp({ reverse: true })) // => [8, 5, 3]
|
||||
[8, 3, 5].sort(cmp({ reverse: true })) // => [8, 5, 3]
|
||||
[-2, 8, -7].sort(cmp({ key: Math.abs })) // => [-2, -7, 8]
|
||||
```
|
||||
|
|
50
package-lock.json
generated
50
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tk-functional",
|
||||
"version": "1.0.0",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1199,9 +1199,9 @@
|
|||
}
|
||||
},
|
||||
"caniuse-db": {
|
||||
"version": "1.0.30000995",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000995.tgz",
|
||||
"integrity": "sha512-25ew/vPIVU0g/OjeZay2IfcljWAmNVy1TSmeoozFrJzEOqnka0ZSusJFS+4iGZKVIJ4RHOZB4NyilpwNcsh8tA==",
|
||||
"version": "1.0.30000996",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000996.tgz",
|
||||
"integrity": "sha512-WvzxMtKe5CCBUaTVBM/EjsoFXJf6f/2s17BlWeZMhc5DSP7d9QjAZe5vdZp3T3fjxtGkJbg5W24bnRAdz9LVIw==",
|
||||
"dev": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
|
@ -1931,12 +1931,12 @@
|
|||
"dev": true
|
||||
},
|
||||
"decompress-response": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
|
||||
"integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=",
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz",
|
||||
"integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mimic-response": "^1.0.0"
|
||||
"mimic-response": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"deep-extend": {
|
||||
|
@ -2112,9 +2112,9 @@
|
|||
}
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.260",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.260.tgz",
|
||||
"integrity": "sha512-wGt+OivF1C1MPwaSv3LJ96ebNbLAWlx3HndivDDWqwIVSQxmhL17Y/YmwUdEMtS/bPyommELt47Dct0/VZNQBQ==",
|
||||
"version": "1.3.264",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.264.tgz",
|
||||
"integrity": "sha512-z8E7WkrrquCuGYv+kKyybuZIbdms+4PeHp7Zm2uIgEhAigP0bOwqXILItwj0YO73o+QyHY/7XtEfP5DsHOWQgQ==",
|
||||
"dev": true
|
||||
},
|
||||
"emoji-regex": {
|
||||
|
@ -3363,9 +3363,9 @@
|
|||
}
|
||||
},
|
||||
"handlebars": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.2.0.tgz",
|
||||
"integrity": "sha512-Kb4xn5Qh1cxAKvQnzNWZ512DhABzyFNmsaJf3OAkWNa4NkaqWcNI8Tao8Tasi0/F4JD9oyG0YxuFyvyR57d+Gw==",
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.2.1.tgz",
|
||||
"integrity": "sha512-bqPIlDk06UWbVEIFoYj+LVo42WhK96J+b25l7hbFDpxrOXMphFM3fNIm+cluwg4Pk2jiLjWU5nHQY7igGE75NQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"neo-async": "^2.6.0",
|
||||
|
@ -4935,9 +4935,9 @@
|
|||
}
|
||||
},
|
||||
"mimic-response": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",
|
||||
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.0.0.tgz",
|
||||
"integrity": "sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ==",
|
||||
"dev": true
|
||||
},
|
||||
"minimatch": {
|
||||
|
@ -8945,12 +8945,12 @@
|
|||
"dev": true
|
||||
},
|
||||
"simple-get": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.0.3.tgz",
|
||||
"integrity": "sha512-Wvre/Jq5vgoz31Z9stYWPLn0PqRqmBDpFSdypAnHu5AvRVCYPRYGnvryNLiXu8GOBNDH82J2FRHUGMjjHUpXFw==",
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz",
|
||||
"integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"decompress-response": "^3.3.0",
|
||||
"decompress-response": "^4.2.0",
|
||||
"once": "^1.3.1",
|
||||
"simple-concat": "^1.0.0"
|
||||
}
|
||||
|
@ -9506,9 +9506,9 @@
|
|||
}
|
||||
},
|
||||
"tk-base": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/tk-base/-/tk-base-0.1.2.tgz",
|
||||
"integrity": "sha512-S+cirl9BnlZjllAX+/IJK7O98PYR6uysuojesXR7wRN+baQtp2phBDvP5hYLco8llm/BVCWXAzr7B5czL3/97g==",
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/tk-base/-/tk-base-0.1.5.tgz",
|
||||
"integrity": "sha512-PtxdHGjDLmS+r9L5ZPXFefEFFf3o6XCEuK1QEHn2wGpTOuRFdj+PS7vehtFX91icVmYxx/S3Uw8v7DOj2YmeIg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/jest": "^24.0.18",
|
||||
|
@ -9516,7 +9516,7 @@
|
|||
"jest": "^24.9.0",
|
||||
"microbundle": "^0.11.0",
|
||||
"ts-jest": "^24.1.0",
|
||||
"ts-node": "^8.3.0",
|
||||
"ts-node": "^8.4.1",
|
||||
"typescript": "^3.6.3"
|
||||
}
|
||||
},
|
||||
|
|
18
package.json
18
package.json
|
@ -1,8 +1,15 @@
|
|||
{
|
||||
"name": "tk-functional",
|
||||
"version": "1.0.0",
|
||||
"version": "0.1.0",
|
||||
"description": "Helpers for functional programming style",
|
||||
"source": "src/index.ts",
|
||||
"main": "dist/tk-functional.js",
|
||||
"umd:main": "dist/tk-functional.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"/src",
|
||||
"/dist"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npx tk-base test",
|
||||
"normalize": "npx tk-base normalize",
|
||||
|
@ -16,14 +23,7 @@
|
|||
},
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"tk-base": "^0.1.2"
|
||||
"tk-base": "^0.1.5"
|
||||
},
|
||||
"source": "src/index.ts",
|
||||
"umd:main": "dist/tk-functional.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"/src",
|
||||
"/dist"
|
||||
],
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ export function partial<A extends object, PA extends Partial<A>, RA extends any[
|
|||
return (args: Omit<A, keyof PA>, ...rest: RA) => func({ ...fixedargs, ...args } as any, ...rest);
|
||||
}
|
||||
|
||||
export type cmpArgs = Readonly<{ key: (item: any) => any, reverse: boolean }>
|
||||
export const cmpDefaults: cmpArgs = { key: identity, reverse: false }
|
||||
type cmpArgs = Readonly<{ key: (item: any) => any, reverse: boolean }>
|
||||
const cmpDefaults: cmpArgs = { key: identity, reverse: false }
|
||||
/**
|
||||
* Compare operator, that can be used in sort() calls.
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitReturns": true,
|
||||
"preserveConstEnums": true,
|
||||
"strict": true,
|
||||
"declaration": true,
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"strict": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"preserveConstEnums": true,
|
||||
"declaration": true,
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"target": "es6"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue