Lodash Internal reEvaluate Module

3.0.0 · abandoned · verified Sun Apr 19

This package, `lodash._reevaluate`, provides a standalone module for the internal `reEvaluate` function from the Lodash library, specifically mirroring its implementation as found in Lodash version 3.0.0. It was created to offer a modularized CommonJS build for Node.js and io.js environments. The core Lodash library, which this internal function supports, has since evolved to version 4.x, with its most recent release being 4.18.1. Consequently, `lodash._reevaluate` at version 3.0.0 is effectively unmaintained and has not received updates or new features corresponding to the active development of Lodash v4. This means it lacks compatibility with modern Lodash features, bug fixes, and security patches. As an internal helper, its primary role is in supporting Lodash's template compilation engine. Users should be aware that this module represents an outdated snapshot and is not recommended for new projects or integration with current Lodash versions, as its functionality is now handled internally and more robustly within the main `lodash` package.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use the internal `reEvaluate` function for a basic templating operation in a CommonJS environment. Highlights its internal nature.

const reEvaluate = require('lodash._reevaluate');

// reEvaluate is an internal Lodash function primarily used for template compilation.
// It expects a string template and an object representing the data context.
// This example is illustrative; direct use of this internal function is rare outside of Lodash's own core.

const compiledTemplate = reEvaluate('<%- envVar %>: <%= value %>', {
  escape: (val) => String(val).replace(/[&<>'"`/]/g, ''),
  interpolate: (val) => String(val),
  evaluate: (val) => { try { return eval(val); } catch (e) { return ''; } } // UNSAFE for untrusted input
});

console.log(compiledTemplate({ envVar: 'NODE_ENV', value: process.env.NODE_ENV ?? 'development' }));

// Note: This package is for Lodash v3 internals. Modern Lodash (v4+) handles templating differently and securely.
// Direct usage of 'reEvaluate' is generally discouraged and unsupported.

view raw JSON →