@keystonejs/utils
Advanced tools
Comparing version 5.0.0 to 5.1.0
# @keystonejs/utils | ||
## 5.1.0 | ||
### Minor Changes | ||
- [`9f6bcddd`](https://github.com/keystonejs/keystone/commit/9f6bcddd84cc1d60f139ca116e9006258e417469) [#1851](https://github.com/keystonejs/keystone/pull/1851) Thanks [@jesstelford](https://github.com/jesstelford)! - Added runtime database version validation | ||
## 5.0.0 | ||
@@ -4,0 +10,0 @@ |
@@ -194,3 +194,21 @@ 'use strict'; | ||
const countArrays = obj => Object.values(obj).reduce((total, items) => total + (items ? items.length : 0), 0); | ||
/** | ||
* Compares two version strings or number arrays in the major.minor.patch format. | ||
* Returns true if comp if each element of comp is greater than than base. | ||
*/ | ||
const versionGreaterOrEqualTo = (comp, base) => { | ||
const parseVersion = input => { | ||
if (typeof input === 'object') { | ||
return input; | ||
} else { | ||
return input.split('.').map(v => Number(v)); | ||
} | ||
}; | ||
const v1 = parseVersion(comp); | ||
const v2 = parseVersion(base); | ||
return v1[0] >= v2[0] && v1[1] >= v2[1] && v1[2] >= v2[2]; | ||
}; | ||
exports.arrayToObject = arrayToObject; | ||
@@ -219,2 +237,3 @@ exports.captureSuspensePromises = captureSuspensePromises; | ||
exports.unique = unique; | ||
exports.versionGreaterOrEqualTo = versionGreaterOrEqualTo; | ||
exports.zipObj = zipObj; |
@@ -110,3 +110,6 @@ "use strict"; | ||
return values; | ||
}, countArrays = obj => Object.values(obj).reduce((total, items) => total + (items ? items.length : 0), 0); | ||
}, countArrays = obj => Object.values(obj).reduce((total, items) => total + (items ? items.length : 0), 0), versionGreaterOrEqualTo = (comp, base) => { | ||
const parseVersion = input => "object" == typeof input ? input : input.split(".").map(v => Number(v)), v1 = parseVersion(comp), v2 = parseVersion(base); | ||
return v1[0] >= v2[0] && v1[1] >= v2[1] && v1[2] >= v2[2]; | ||
}; | ||
@@ -120,2 +123,3 @@ exports.arrayToObject = arrayToObject, exports.captureSuspensePromises = captureSuspensePromises, | ||
exports.objMerge = objMerge, exports.omit = omit, exports.omitBy = omitBy, exports.pick = pick, | ||
exports.resolveAllKeys = resolveAllKeys, exports.unique = unique, exports.zipObj = zipObj; | ||
exports.resolveAllKeys = resolveAllKeys, exports.unique = unique, exports.versionGreaterOrEqualTo = versionGreaterOrEqualTo, | ||
exports.zipObj = zipObj; |
@@ -188,3 +188,21 @@ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty'; | ||
const countArrays = obj => Object.values(obj).reduce((total, items) => total + (items ? items.length : 0), 0); | ||
/** | ||
* Compares two version strings or number arrays in the major.minor.patch format. | ||
* Returns true if comp if each element of comp is greater than than base. | ||
*/ | ||
export { arrayToObject, captureSuspensePromises, compose, countArrays, createLazyDeferred, defaultObj, escapeRegExp, filterValues, flatMap, flatten, getType, identity, intersection, mapKeyNames, mapKeys, mergeWhereClause, noop, objMerge, omit, omitBy, pick, resolveAllKeys, unique, zipObj }; | ||
const versionGreaterOrEqualTo = (comp, base) => { | ||
const parseVersion = input => { | ||
if (typeof input === 'object') { | ||
return input; | ||
} else { | ||
return input.split('.').map(v => Number(v)); | ||
} | ||
}; | ||
const v1 = parseVersion(comp); | ||
const v2 = parseVersion(base); | ||
return v1[0] >= v2[0] && v1[1] >= v2[1] && v1[2] >= v2[2]; | ||
}; | ||
export { arrayToObject, captureSuspensePromises, compose, countArrays, createLazyDeferred, defaultObj, escapeRegExp, filterValues, flatMap, flatten, getType, identity, intersection, mapKeyNames, mapKeys, mergeWhereClause, noop, objMerge, omit, omitBy, pick, resolveAllKeys, unique, versionGreaterOrEqualTo, zipObj }; |
{ | ||
"name": "@keystonejs/utils", | ||
"description": "Common utility functions used throughout @keystonejs packages.", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"author": "The KeystoneJS Development Team", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -202,1 +202,20 @@ import pLazy from 'p-lazy'; | ||
Object.values(obj).reduce((total, items) => total + (items ? items.length : 0), 0); | ||
/** | ||
* Compares two version strings or number arrays in the major.minor.patch format. | ||
* Returns true if comp if each element of comp is greater than than base. | ||
*/ | ||
export const versionGreaterOrEqualTo = (comp, base) => { | ||
const parseVersion = input => { | ||
if (typeof input === 'object') { | ||
return input; | ||
} else { | ||
return input.split('.').map(v => Number(v)); | ||
} | ||
}; | ||
const v1 = parseVersion(comp); | ||
const v2 = parseVersion(base); | ||
return v1[0] >= v2[0] && v1[1] >= v2[1] && v1[2] >= v2[2]; | ||
}; |
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
34625
707