-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69e8484
commit 52d4958
Showing
9 changed files
with
77 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/array-group-to-record/dist/index.cjs.production.min.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("hash-sum"));function r(e){var r;const n=null!==(r=null==e?void 0:e.getKey)&&void 0!==r?r:e=>t.default(e);return{...e,getKey:n}}function n(e,t){var n;const{getKey:o,init:u}=r(t);return e.reduce(((e,t,r,n)=>{var u;const l=o(t,r,n);return null!==(u=e[l])&&void 0!==u||(e[l]=[]),e[l].push(t),e}),null!==(n=null==u?void 0:u())&&void 0!==n?n:{})}exports.arrayGroupToMap=function(e,t){var n;const{getKey:o,init:u}=r(t);return e.reduce(((e,t,r,n)=>{var u;const l=o(t,r,n),i=null!==(u=e.get(l))&&void 0!==u?u:[];return i.push(t),e.set(l,i),e}),null!==(n=null==u?void 0:u())&&void 0!==n?n:new Map)},exports.arrayGroupToRecord=n,exports.default=n,exports.handleOptions=r,exports.sumGroup=function(e){let t=0;return void 0===e.forEach&&(e=Object.values(e)),e.forEach((e=>t+=e.length)),t}; | ||
"use strict";function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var e=_interopDefaultLegacy(require("hash-sum"));function handleOptions(r){var o;const t=null!==(o=null==r?void 0:r.getKey)&&void 0!==o?o:r=>e.default(r);return{...r,getKey:t}}function arrayGroupToRecord(e,r){var o;const{getKey:t,init:n}=handleOptions(r);return e.reduce(((e,r,o,n)=>{var u;const a=t(r,o,n);return null!==(u=e[a])&&void 0!==u||(e[a]=[]),e[a].push(r),e}),null!==(o=null==n?void 0:n())&&void 0!==o?o:{})}exports.arrayGroupToMap=function arrayGroupToMap(e,r){var o;const{getKey:t,init:n}=handleOptions(r);return e.reduce(((e,r,o,n)=>{var u;const a=t(r,o,n),l=null!==(u=e.get(a))&&void 0!==u?u:[];return l.push(r),e.set(a,l),e}),null!==(o=null==n?void 0:n())&&void 0!==o?o:new Map)},exports.arrayGroupToRecord=arrayGroupToRecord,exports.default=arrayGroupToRecord,exports.handleOptions=handleOptions,exports.sumGroup=function sumGroup(e){let r=0;return void 0===e.forEach&&(e=Object.values(e)),e.forEach((e=>r+=e.length)),r}; | ||
//# sourceMappingURL=index.cjs.production.min.cjs.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/distribute-group-to-array/dist/index.cjs.production.min.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"use strict";function e(e){const r=[];for(let o=0;o<e;o++)r.push([]);return r}function r(r,t){var n,l,u;void 0!==r.entries&&(r=o(r));const i=null!==(n=null==t||null===(l=t.init)||void 0===l?void 0:l.call(t))&&void 0!==n?n:e(null!==(u=null==t?void 0:t.groupArraySize)&&void 0!==u?u:4),s=i.length,{names:d,record:c}=Object.entries(r).reduce(((e,[r,o])=>(e.names.push(r),e.record[r]=o.slice(),e)),{names:[],record:{}});let p=s-1;do{let e;for(let r of d){var a;e=null===(a=c[r])||void 0===a?void 0:a.pop(),e?i[p%s].push(e):delete c[r]}e&&p++}while(Object.keys(c).length);return i}function o(e){const r={};for(let[o,t]of e.entries())r[o]=t;return r}function t(e,o){return r(e,o).flat()}Object.defineProperty(exports,"__esModule",{value:!0}),exports._createGroupArray=e,exports.default=t,exports.distributeGroupToArray=t,exports.distributeGroupToArrayCore=r,exports.mapToRecord=o; | ||
"use strict";function _createGroupArray(r){const e=[];for(let o=0;o<r;o++)e.push([]);return e}function distributeGroupToArrayCore(r,e){var o,t,u;void 0!==r.entries&&(r=mapToRecord(r));const i=null!==(o=null==e||null===(t=e.init)||void 0===t?void 0:t.call(e))&&void 0!==o?o:_createGroupArray(null!==(u=null==e?void 0:e.groupArraySize)&&void 0!==u?u:4),n=i.length,{names:s,record:a}=Object.entries(r).reduce(((r,[e,o])=>(r.names.push(e),r.record[e]=o.slice(),r)),{names:[],record:{}});let d=n-1;do{let r;for(let e of s){var p;r=null===(p=a[e])||void 0===p?void 0:p.pop(),r?i[d%n].push(r):delete a[e]}r&&d++}while(Object.keys(a).length);return i}function mapToRecord(r){const e={};for(let[o,t]of r.entries())e[o]=t;return e}function distributeGroupToArray(r,e){return distributeGroupToArrayCore(r,e).flat()}Object.defineProperty(exports,"__esModule",{value:!0}),exports._createGroupArray=_createGroupArray,exports.default=distributeGroupToArray,exports.distributeGroupToArray=distributeGroupToArray,exports.distributeGroupToArrayCore=distributeGroupToArrayCore,exports.mapToRecord=mapToRecord; | ||
//# sourceMappingURL=index.cjs.production.min.cjs.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/string-natural-compare/dist/index.cjs.production.min.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("string-natural-compare"));function r(e,r,n){let s;if("number"==typeof e&&"number"==typeof r)s=e-r;else{if("number"==typeof e?e=String(e):"number"==typeof r&&(r=String(r)),e===r)return 0;s=t.default(e,r,n)}return 0!==s&&null!=n&&n.desc&&(s=0-s),s}function n(e){return(t,n)=>r(t,n,e)}const s=n({caseInsensitive:!0});r.createNew=n,r.compareCaseInsensitive=s,r.caseInsensitive=s,r.default=r,Object.defineProperty(r,"__esModule",{value:!0}),exports.caseInsensitive=s,exports.compareCaseInsensitive=s,exports.createNew=n,exports.default=r,exports.naturalCompare=r; | ||
"use strict";function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var e=_interopDefaultLegacy(require("string-natural-compare"));function naturalCompare(r,t,a){let n;if("number"==typeof r&&"number"==typeof t)n=r-t;else{if("number"==typeof r?r=String(r):"number"==typeof t&&(t=String(t)),r===t)return 0;n=e.default(r,t,a)}return 0!==n&&null!=a&&a.desc&&(n=0-n),n}function createNew(e){return(r,t)=>naturalCompare(r,t,e)}const r=createNew({caseInsensitive:!0});naturalCompare.createNew=createNew,naturalCompare.compareCaseInsensitive=r,naturalCompare.caseInsensitive=r,naturalCompare.default=naturalCompare,Object.defineProperty(naturalCompare,"__esModule",{value:!0}),exports.caseInsensitive=r,exports.compareCaseInsensitive=r,exports.createNew=createNew,exports.default=naturalCompare,exports.naturalCompare=naturalCompare; | ||
//# sourceMappingURL=index.cjs.production.min.cjs.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,27 @@ | ||
import _naturalCompare from 'string-natural-compare'; | ||
import e from "string-natural-compare"; | ||
|
||
function naturalCompare(a, b, opts) { | ||
let i; | ||
|
||
if (typeof a === 'number' && typeof b === 'number') { | ||
i = a - b; | ||
} else { | ||
if (typeof a === 'number') { | ||
a = String(a); | ||
} else if (typeof b === 'number') { | ||
b = String(b); | ||
} | ||
|
||
if (a === b) { | ||
return 0; | ||
} | ||
|
||
i = _naturalCompare(a, b, opts); | ||
} | ||
|
||
if (i !== 0 && opts !== null && opts !== void 0 && opts.desc) { | ||
i = 0 - i; | ||
function naturalCompare(a, r, t) { | ||
let n; | ||
if ("number" == typeof a && "number" == typeof r) n = a - r; else { | ||
if ("number" == typeof a ? a = String(a) : "number" == typeof r && (r = String(r)), | ||
a === r) return 0; | ||
n = e(a, r, t); | ||
} | ||
|
||
return i; | ||
return 0 !== n && null != t && t.desc && (n = 0 - n), n; | ||
} | ||
function createNew(opts) { | ||
return (a, b) => naturalCompare(a, b, opts); | ||
|
||
function createNew(e) { | ||
return (a, r) => naturalCompare(a, r, e); | ||
} | ||
const compareCaseInsensitive = /*#__PURE__*/createNew({ | ||
caseInsensitive: true | ||
|
||
const a = createNew({ | ||
caseInsensitive: !0 | ||
}); | ||
naturalCompare.createNew = createNew; | ||
naturalCompare.compareCaseInsensitive = compareCaseInsensitive; | ||
naturalCompare.caseInsensitive = compareCaseInsensitive; | ||
naturalCompare.default = naturalCompare; | ||
Object.defineProperty(naturalCompare, "__esModule", { | ||
value: true | ||
|
||
naturalCompare.createNew = createNew, naturalCompare.compareCaseInsensitive = a, | ||
naturalCompare.caseInsensitive = a, naturalCompare.default = naturalCompare, Object.defineProperty(naturalCompare, "__esModule", { | ||
value: !0 | ||
}); | ||
|
||
export { compareCaseInsensitive as caseInsensitive, compareCaseInsensitive, createNew, naturalCompare as default, naturalCompare }; | ||
export { a as caseInsensitive, a as compareCaseInsensitive, createNew, naturalCompare as default, naturalCompare }; | ||
//# sourceMappingURL=index.esm.mjs.map |