tsds-publish
Version:
Development stack for TypeScript libraries
24 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "stringStartsWith", {
enumerable: true,
get: function() {
return stringStartsWith;
}
});
/**
* Compatibility Layer for Node.js 0.8+
* Local to this package - contains only needed functions.
*/ /**
* String.prototype.startsWith wrapper for Node.js 0.8+
* - Uses native startsWith on Node 4.0+ / ES2015+
* - Falls back to indexOf on Node 0.8-3.x
*/ var hasStartsWith = typeof String.prototype.startsWith === 'function';
function stringStartsWith(str, search, position) {
if (hasStartsWith) return str.startsWith(search, position);
position = position || 0;
return str.indexOf(search, position) === position;
}
/* 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; }