@datasketch/taco
Advanced tools
| { | ||
| "env": { | ||
| "browser": true, | ||
| "es2021": true | ||
| }, | ||
| "extends": [ | ||
| "standard" | ||
| ], | ||
| "parser": "@typescript-eslint/parser", | ||
| "parserOptions": { | ||
| "ecmaVersion": "latest", | ||
| "sourceType": "module" | ||
| }, | ||
| "plugins": [ | ||
| "@typescript-eslint" | ||
| ], | ||
| "rules": { | ||
| } | ||
| } |
| const r={Cat:{name:"list",config:r=>({values:r.categories,autocomplete:!0,multiselect:!1})}};function t(t){if(!Array.isArray(t))throw new Error("Dictionary must be an array");return t.map((t=>{const{editor:e,editorParams:a}=function(t,e={}){const a=r[t];return a?{editor:a.name,editorParams:a.config(e)}:{editor:"input",editorParams:{}}}(t.hdType,t.format);return{title:t.label,field:t.id,editor:e,editorParams:a}}))}export{t as getColumnDefinitions}; |
| var Taco=function(t){"use strict";const r={Cat:{name:"list",config:t=>({values:t.categories,autocomplete:!0,multiselect:!1})}};return t.getColumnDefinitions=function(t){if(!Array.isArray(t))throw new Error("Dictionary must be an array");return t.map((t=>{const{editor:e,editorParams:i}=function(t,e={}){const i=r[t];return i?{editor:i.name,editorParams:i.config(e)}:{editor:"input",editorParams:{}}}(t.hdType,t.format);return{title:t.label,field:t.id,editor:e,editorParams:i}}))},t}({}); |
| type Field = { | ||
| id: string; | ||
| label: string; | ||
| hdType: string; | ||
| format: Record<string, any>; | ||
| }; | ||
| declare function getColumnDefinitions(dictionary: Field[]): { | ||
| title: string; | ||
| field: string; | ||
| editor: string | Function; | ||
| editorParams: Record<string, any>; | ||
| }[]; | ||
| export { getColumnDefinitions }; |
| export declare const factories: Record<string, { | ||
| name: string; | ||
| config: (format: Record<string, any>) => Record<string, any>; | ||
| }>; |
| declare function getEditor(hdType: string, format?: Record<string, any>): { | ||
| editor: string | Function; | ||
| editorParams: Record<string, any>; | ||
| }; | ||
| export { getEditor }; |
| export * from './columns.js'; |
| import { defineConfig } from 'rollup' | ||
| import terser from '@rollup/plugin-terser' | ||
| import typescript from '@rollup/plugin-typescript' | ||
| export default defineConfig({ | ||
| input: 'src/index.ts', | ||
| output: [ | ||
| { | ||
| file: 'dist/taco.es.js', | ||
| format: 'es' | ||
| }, | ||
| { | ||
| file: 'dist/taco.min.js', | ||
| format: 'iife', | ||
| name: 'Taco' | ||
| } | ||
| ], | ||
| plugins: [ | ||
| typescript(), | ||
| terser() | ||
| ] | ||
| }) |
| import { getEditor } from './editor/index.js' | ||
| type Field = { | ||
| id: string | ||
| label: string | ||
| hdType: string | ||
| format: Record<string, any> | ||
| } | ||
| function getColumnDefinitions (dictionary: Field[]) { | ||
| if (!Array.isArray(dictionary)) { | ||
| throw new Error('Dictionary must be an array') | ||
| } | ||
| return dictionary.map(field => { | ||
| const { editor, editorParams } = getEditor(field.hdType, field.format) | ||
| return { | ||
| title: field.label, | ||
| field: field.id, | ||
| editor, | ||
| editorParams | ||
| } | ||
| }) | ||
| } | ||
| export { getColumnDefinitions } |
| export const factories: Record<string, { name: string, config: (format: Record<string, any>) => Record<string, any>}> = { | ||
| Cat: { | ||
| name: 'list', | ||
| config: (format: Record<string, any>) => ({ | ||
| values: format.categories, | ||
| autocomplete: true, | ||
| multiselect: false | ||
| }) | ||
| } | ||
| } |
| import { factories } from './factories.js' | ||
| function getEditor (hdType: string, format: Record<string, any> = {}): { editor: string | Function; editorParams: Record<string, any> } { | ||
| const factory = factories[hdType] | ||
| if (!factory) { | ||
| return { | ||
| editor: 'input', | ||
| editorParams: {} | ||
| } | ||
| } | ||
| return { editor: factory.name, editorParams: factory.config(format) } | ||
| } | ||
| export { getEditor } |
| export * from './columns.js' |
| { | ||
| "compilerOptions": { | ||
| "target": "ES6", | ||
| "lib": ["es6"], | ||
| "module": "ES2020", | ||
| "rootDir": "src", | ||
| "declaration": true, | ||
| "declarationDir": "./types", | ||
| "emitDeclarationOnly": true, | ||
| "outDir": "dist", | ||
| "removeComments": true, | ||
| "esModuleInterop": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "strict": true, | ||
| "noImplicitAny": true, | ||
| "skipLibCheck": true | ||
| } | ||
| } |
+8
-6
| { | ||
| "name": "@datasketch/taco", | ||
| "version": "0.1.1", | ||
| "version": "0.2.0", | ||
| "description": "", | ||
| "main": "dist/taco.esm.js", | ||
| "main": "dist/taco.es.js", | ||
| "type": "module", | ||
| "files": [ | ||
| "dist/taco.js" | ||
| ], | ||
| "types": "dist/types/index.d.ts", | ||
| "scripts": { | ||
@@ -18,2 +16,5 @@ "build": "del-cli dist && rollup -c" | ||
| "@rollup/plugin-terser": "^0.4.1", | ||
| "@rollup/plugin-typescript": "^11.1.1", | ||
| "@typescript-eslint/eslint-plugin": "^5.59.6", | ||
| "@typescript-eslint/parser": "^5.59.6", | ||
| "del-cli": "^5.0.0", | ||
@@ -25,3 +26,4 @@ "eslint": "^8.40.0", | ||
| "eslint-plugin-promise": "^6.1.1", | ||
| "rollup": "^3.21.7" | ||
| "rollup": "^3.21.7", | ||
| "typescript": "^5.0.4" | ||
| }, | ||
@@ -28,0 +30,0 @@ "engines": { |
| function r(r){if(!Array.isArray(r))throw new Error("Dictionary must be an array");return r.map((r=>({title:r.label,field:r.id})))}export{r as getColumnDefinitions}; |
| var taco=function(r){"use strict";return r.getColumnDefinitions=function(r){if(!Array.isArray(r))throw new Error("Dictionary must be an array");return r.map((r=>({title:r.label,field:r.id})))},r}({}); |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
5971
173.52%16
220%130
6400%0
-100%12
50%4
100%