Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dedupe dependency #46

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
}