Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

71
Views
Export without destructuring
import { utils } from 'shared'

const {
  pick,
  get,
  isEmpty,
  sortBy,
  orderObjectsArray,
  isString
} = utils.lodashAlternative

export { pick, get, isEmpty, sortBy, orderObjectsArray, isString }

Above you can see exports , imagine I don't want to desctructure all of those functions , how can I do it ? I've tried to make export utils.lodashAlternative , but it will not work , also :

const {...data} = utils.lodashAlternative

export {...data}

Also will not work, it there any way to export it without discructuring ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

A simple way to export everything under utils.lodashAlternative is creating an alias and exporting that one instead. There's no need to create an object and spread lodashAlternative inside.

You can't declare and export afterwards (unless you use as)!

Way 1: using default

import { utils } from 'shared'

const lodashAlternative = utils.lodashAlternative;

export default lodashAlternative;

Way 2: exporting directly

import { utils } from 'shared'

export const lodashAlternative = utils.lodashAlternative;

Way 3: export each one separately, to be able to import them separately

import {utils} from "shared";

const { foo, bar } = utils.lodashAlternative;

export { foo, bar };

import then:

// WITH WAY 1
import lodashAlternative from "lodash-alternative";

// WITH WAY 2
import {lodashAlternative} from "lodash-alternative";

// WITH WAY 3
import {foo, bar} from "lodash-alternative";

Blitz here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!