es-string-utils
Advanced tools
Comparing version
@@ -50,6 +50,8 @@ /** | ||
/** | ||
* Validate and returns if from array of charcters or substrings any one is present in the | ||
* source string | ||
* | ||
* @param source | ||
* @param targets | ||
* @returns | ||
* @param {string} source string which has to be validated | ||
* @param {Array<string>} targets array of characters/substrings against which source has to validated | ||
* @returns {boolean} if source string contains any one of the characters/substrings | ||
*/ | ||
@@ -56,0 +58,0 @@ declare const containsAny: (source: string, ...targets: string[]) => boolean; |
'use strict'; | ||
var f=t=>{if(typeof t!="string")throw new Error(`Expected string but got ${typeof t}`);return t.replace(/[-_\s]+(.)?/g,r=>{var o;return (o=r==null?void 0:r.toUpperCase())!=null?o:""})};var p=(t,r=" ")=>{if(typeof t!="string")throw new Error(`Expected string but got ${typeof t}`);return t==null?void 0:t.split(r).map(o=>{var e,s;return ((e=o.slice(0,1))==null?void 0:e.toUpperCase())+((s=o.slice(1))==null?void 0:s.toLowerCase())}).join(r)};var n=(...t)=>{for(let r of t)if(typeof r!="string")throw new Error(`Expected string but got ${typeof r}`)};var c=(t,r)=>{if(n(t,r),t.length!==r.length)return t.length-r.length;for(let o=0;o<t.length&&o<r.length;o++){let e=t.charCodeAt(o),s=r.charCodeAt(o);if(e!==s)return e-s}return 0};var h=(...t)=>{let r="";for(let o of t)r+=o||"";return r};var i=(t,r,o=!0)=>(n(t,r),(o?t:t.toLocaleLowerCase()).indexOf(o?r:r.toLocaleLowerCase()));var u=(t,r)=>(n(t,r),i(t,r,!1));var A=(t,...r)=>{n(t);let o=!1;for(let e of r)if(i(t,e)!==-1){o=!0;break}return o};var U=(t,...r)=>{n(t);let o=!1;for(let e of r)if(i(t,e,!1)!==-1){o=!0;break}return o};var _=(t,...r)=>{n(t);let o=!0;for(let e of r)if(i(t,e)!==-1){o=!1;break}return o}; | ||
var p=t=>{if(typeof t!="string")throw new Error(`Expected string but got ${typeof t}`);return t.replace(/[-_\s]+(.)?/g,r=>{var n;return (n=r==null?void 0:r.toUpperCase())!=null?n:""})};var a=(t,r=" ")=>{if(typeof t!="string")throw new Error(`Expected string but got ${typeof t}`);return t==null?void 0:t.split(r).map(n=>{var o,f;return ((o=n.slice(0,1))==null?void 0:o.toUpperCase())+((f=n.slice(1))==null?void 0:f.toLowerCase())}).join(r)};var e=(...t)=>{for(let r of t)if(typeof r!="string")throw new Error(`Expected string but got ${typeof r}`)};var x=(t,r)=>{if(e(t,r),t.length!==r.length)return t.length-r.length;for(let n=0;n<t.length&&n<r.length;n++){let o=t.charCodeAt(n),f=r.charCodeAt(n);if(o!==f)return o-f}return 0};var h=(...t)=>{let r="";for(let n of t)r+=n||"";return r};var i=(t,r,n=!0)=>(e(t,r),(n?t:t.toLocaleLowerCase()).indexOf(n?r:r.toLocaleLowerCase()));var E=(t,r)=>(e(t,r),i(t,r,!1));var L=(t,...r)=>{if(typeof t!="string"||!(t!=null&&t.length)||!(r!=null&&r.length))return !1;let n=!1;for(let o of r)if(i(t,o)!==-1){n=!0;break}return n};var I=(t,...r)=>{e(t);let n=!1;for(let o of r)if(i(t,o,!1)!==-1){n=!0;break}return n};var O=(t,...r)=>{e(t);let n=!0;for(let o of r)if(i(t,o)!==-1){n=!1;break}return n}; | ||
exports.camelize = f; | ||
exports.capitalize = p; | ||
exports.compare = c; | ||
exports.camelize = p; | ||
exports.capitalize = a; | ||
exports.compare = x; | ||
exports.concat = h; | ||
exports.contains = i; | ||
exports.containsAny = A; | ||
exports.containsAnyIgnoreCase = U; | ||
exports.containsIgnoreCase = u; | ||
exports.containsNone = _; | ||
exports.containsAny = L; | ||
exports.containsAnyIgnoreCase = I; | ||
exports.containsIgnoreCase = E; | ||
exports.containsNone = O; |
{ | ||
"name": "es-string-utils", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A collection of utility functions to manipulate string in javascript and typescript", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.mjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20655
3.81%81
2.53%