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 system. It is developed to power our online editing platform [Substance](http://substance.io).

9 lines (7 loc) 272 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 }