Skip to content

Commit

Permalink
Merge pull request #46 from datavis-tech/remove-dependency
Browse files Browse the repository at this point in the history
Remove dedupe dependency
  • Loading branch information
curran authored Jul 4, 2023
2 parents 35d582c + 3cf1d9f commit 81944fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
7 changes: 1 addition & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// Created by Curran Kelleher and Chrostophe Serafin.
// Contributions from Paul Brewer and Javier Blanco Martinez.
const objectPath = require('object-path');
const dedupe = require('dedupe');

// An enhanced version of `typeof` that handles arrays and dates as well.
function type(value) {
Expand Down Expand Up @@ -42,11 +41,7 @@ function Parameter(match) {

// Constructs a template function with deduped `parameters` property.
function Template(fn, parameters) {
// Paul Brewer Dec 2017 add deduplication call, use only key property to eliminate
Object.assign(fn, {
parameters: dedupe(parameters, item => item.key)
});

fn.parameters = Array.from(new Map(parameters.map(parameter => [parameter.key, parameter])).values())
return fn;
}

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
},
"homepage": "https://github.com/datavis-tech/json-templates#readme",
"devDependencies": {
"mocha": "^9.1.2",
"rollup": "^2.58.0",
"mocha": "^10.2.0",
"rollup": "^3.26.0",
"rollup-plugin-buble": "^0.19.8"
},
"dependencies": {
"dedupe": "^3.0.2",
"object-path": "^0.11.8"
}
}

0 comments on commit 81944fb

Please sign in to comment.