UNPKG

esm-require-directory

Version:

require a directory of modules using es6 modules require

21 lines 932 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "stringEndsWith", { enumerable: true, get: function() { return stringEndsWith; } }); /** * String.prototype.endsWith wrapper for Node.js 0.8+ * - Uses native endsWith on Node 4.0+ / ES2015+ * - Falls back to lastIndexOf on Node 0.8-3.x */ var hasEndsWith = typeof String.prototype.endsWith === 'function'; function stringEndsWith(str, search, position) { if (hasEndsWith) return str.endsWith(search, position); var len = position === undefined ? str.length : position; return str.lastIndexOf(search) === len - search.length; } /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }