Skip to content

TypeError: unique is not a function #56

@DevLab2425

Description

@DevLab2425

Following the first example in the README, I get a TypeError

TypeError: unique is not a function

Here is the sample file I've created:

index.js

import unique from 'unique-selector';

const DOM = '<span id="test" class="nav-item" aria-label="something">Some text</span>';
const options = {
    selectorTypes : [ 'ID', 'Class', 'Tag', 'NthChild' ]
}

console.log(typeof unique, JSON.stringify(unique)); // "object", {}
unique( DOM, options );

And here is the full error message

Error message

TypeError: unique is not a function
    at file:///Users/path/to/project/unique-selector-poc/index.js:10:1
    at ModuleJob.run (internal/modules/esm/module_job.js:146:23)
    at async Loader.import (internal/modules/esm/loader.js:165:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)

package.json

{
  "name": "unique-selector-poc",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "unique-selector": "0.5.0"
  },
  "type": "module"
}

Please help me identify where I'm going wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions