UNPKG

substance

Version:

Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing systems.

8 lines (7 loc) 270 B
import isString from './isString' export default function startsWith(str, prefix) { if (!isString(str)) return false if (str.startsWith) return str.startsWith(prefix) if (!isString(prefix)) prefix = String(prefix) return str.slice(0, prefix.length) === prefix }