Version 1
[yaffs-website] / node_modules / underscore.string / startsWith.js
diff --git a/node_modules/underscore.string/startsWith.js b/node_modules/underscore.string/startsWith.js
new file mode 100644 (file)
index 0000000..a9f4790
--- /dev/null
@@ -0,0 +1,9 @@
+var makeString = require('./helper/makeString');
+var toPositive = require('./helper/toPositive');
+
+module.exports = function startsWith(str, starts, position) {
+  str = makeString(str);
+  starts = '' + starts;
+  position = position == null ? 0 : Math.min(toPositive(position), str.length);
+  return str.lastIndexOf(starts, position) === position;
+};