@blakek/make-lookup
Advanced tools
Comparing version 2.0.0 to 2.0.2
import { Path } from '@blakek/deep'; | ||
export declare function makeLookup<T>(inputArray: any[], lookupProperty: Path): Record<string, T>; | ||
export declare function makeLookup<T extends Record<string, any>>(inputArray: T[], lookupProperty: Path): Record<string, T>; | ||
export default makeLookup; |
@@ -9,3 +9,3 @@ 'use strict'; | ||
return inputArray.reduce((lookup, next) => ({ ...lookup, | ||
[deep.get(next, lookupProperty)]: next | ||
[deep.get(lookupProperty, next)]: next | ||
}), {}); | ||
@@ -12,0 +12,0 @@ } |
@@ -5,3 +5,3 @@ import { get } from '@blakek/deep'; | ||
return inputArray.reduce((lookup, next) => ({ ...lookup, | ||
[get(next, lookupProperty)]: next | ||
[get(lookupProperty, next)]: next | ||
}), {}); | ||
@@ -8,0 +8,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((r=r||self)["make-lookup"]={})}(this,(function(r){"use strict";var e=function(r,e,t){return r(t={path:e,exports:{},require:function(r,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&t.path)}},t.exports),t.exports}((function(r){function e(){return r.exports=e=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},e.apply(this,arguments)}r.exports=e})),t={clear:function(){t.results={},t.size=0},results:{},size:0},n=/"[^"]+"|`[^`]+`|'[^']+'|[^.[\]]+/g,u=/^\d+$/i,o=/^"[^"]+"|`[^`]+`|'[^']+'$/,i=function(r,e){for(var t=r.length,n=[],u=0;u<t;u++)n[u]=e(r[u]);return n},f=function(r){var e=function(r){return o.test(r)}(r)?r.slice(1,r.length-1):r;return function(r){return!(!r||!r.length)&&u.test(r)}(e)?+e:e},s=Array.isArray,c=function(r){if("string"==typeof r)return function(r){return t.results[r]||(t.size>500&&t.clear(),t.results[r]=r?i(r.match(n),f):[r],t.size++),t.results[r]}(r);if(s(r))return i(r,f);var e=f(r);return["number"==typeof e?e:""+e]};var l=Symbol("value not found");function a(r,e,t){if(void 0===e)return r;var n=function r(e,t){if(0===t.length)return e;if(!function(r){if(null===r)return!1;var e=typeof r;return"object"===e||"function"===e}(e))return l;var n=t[0],u=t.slice(1);return n in e?r(e[n],u):l}(r,c(e));return n===l||void 0===n?t:n}function p(r,t){return r.reduce((function(r,n){var u;return e(e({},r),{},((u={})[a(n,t)]=n,u))}),{})}r.default=p,r.makeLookup=p,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((r=r||self)["make-lookup"]={})}(this,(function(r){"use strict";var n=function(r,n,e){return r(e={path:n,exports:{},require:function(r,n){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==n&&e.path)}},e.exports),e.exports}((function(r){function n(){return r.exports=n=Object.assign||function(r){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}return r},n.apply(this,arguments)}r.exports=n}));function e(r,n){return void 0===n&&(n=r.length),function e(){for(var t=arguments.length,u=new Array(t),o=0;o<t;o++)u[o]=arguments[o];return u.length>=n?r.apply(void 0,u.slice(0,n)):function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];return e.apply(void 0,u.concat(n))}}}var t={clear:function(){t.results={},t.size=0},results:{},size:0},u=/"[^"]+"|`[^`]+`|'[^']+'|[^.[\]]+/g,o=/^\d+$/i,i=/^"[^"]+"|`[^`]+`|'[^']+'$/,f=function(r,n){for(var e=r.length,t=[],u=0;u<e;u++)t[u]=n(r[u]);return t},c=function(r){var n=function(r){return i.test(r)}(r)?r.slice(1,r.length-1):r;return function(r){return!(!r||!r.length)&&o.test(r)}(n)?+n:n},l=Array.isArray,a=function(r){if("string"==typeof r)return function(r){return t.results[r]||(t.size>500&&t.clear(),t.results[r]=r?f(r.match(u),c):[r],t.size++),t.results[r]}(r);if(l(r))return f(r,c);var n=c(r);return["number"==typeof n?n:""+n]};function s(r){if(null===r)return!1;var n=typeof r;return"object"===n||"function"===n}var p=Symbol("curriable placeholder");function v(r,n){if(0===n.length)return r;if(!s(r))return p;var e=n[0],t=n.slice(1);return e in r?v(r[e],t):p}function d(r,n,e){if(void 0===n)return e;var t=v(e,a(n));return t===p||void 0===t?r:t}var h=e((function(r,n){return d(void 0,r,n)}));e(d),e((function(r,n){return v(n,a(r))!==p})),e((function(r,n){if(void 0===r)return n;var e=a(r),t=e.slice(0,-1),u=e[e.length-1],o=v(n,a(t));return o?(delete o[u],n):n})),e((function(r,n,e){var t=a(n),u=e;return t.forEach((function(n,e){e!==t.length-1?(s(u[n])||(u[n]={}),u=u[n]):u[n]=r})),e}));function y(r,e){return r.reduce((function(r,t){var u;return n({},r,((u={})[h(e,t)]=t,u))}),{})}r.default=y,r.makeLookup=y,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=make-lookup.umd.js.map |
{ | ||
"name": "@blakek/make-lookup", | ||
"version": "2.0.0", | ||
"version": "2.0.2", | ||
"main": "dist/make-lookup.cjs.js", | ||
@@ -45,26 +45,26 @@ "module": "dist/make-lookup.esm.js", | ||
"dependencies": { | ||
"@blakek/deep": "^1.0.2" | ||
"@blakek/deep": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.9.6", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/plugin-transform-runtime": "^7.10.1", | ||
"@babel/preset-env": "^7.9.6", | ||
"@babel/preset-typescript": "^7.9.0", | ||
"@babel/runtime": "^7.10.2", | ||
"@rollup/plugin-babel": "^5.0.2", | ||
"@rollup/plugin-commonjs": "^12.0.0", | ||
"@rollup/plugin-node-resolve": "^8.0.0", | ||
"@typescript-eslint/eslint-plugin": "^2.23.0", | ||
"@typescript-eslint/parser": "^2.23.0", | ||
"@babel/core": "^7.10.3", | ||
"@babel/plugin-proposal-class-properties": "^7.10.1", | ||
"@babel/plugin-transform-runtime": "^7.10.3", | ||
"@babel/preset-env": "^7.10.3", | ||
"@babel/preset-typescript": "^7.10.1", | ||
"@babel/runtime": "^7.10.3", | ||
"@rollup/plugin-babel": "^5.0.3", | ||
"@rollup/plugin-commonjs": "^13.0.0", | ||
"@rollup/plugin-node-resolve": "^8.0.1", | ||
"@typescript-eslint/eslint-plugin": "^3.3.0", | ||
"@typescript-eslint/parser": "^3.3.0", | ||
"amper-scripts": "^1.0.0-0", | ||
"ava": "^3.5.0", | ||
"nodemon": "^2.0.2", | ||
"ava": "^3.9.0", | ||
"nodemon": "^2.0.4", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^1.19.1", | ||
"prettier": "^2.0.5", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.10.9", | ||
"rollup": "^2.18.0", | ||
"rollup-plugin-terser": "^6.1.0", | ||
"ts-node": "^8.6.2", | ||
"typescript": "^3.9.3" | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.5" | ||
}, | ||
@@ -71,0 +71,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
123117
32
0
+ Added@blakek/curry@2.0.2(transitive)
+ Added@blakek/deep@2.2.0(transitive)
- Removed@blakek/deep@1.0.3(transitive)
Updated@blakek/deep@^2.0.1