lodash APIs
- get
- isEmpty
- cloneDeep
- debounce
- omit
- isEqual
- find
- merge
- map
- filter
- throttle
- sortBy
- set
- isString
- isArray
- pick
- orderBy
- groupBy
- includes
- isObject
- noop
- findIndex
- isFunction
- isNil
- uniqueId
- pickBy
- uniq
- kebabCase
- without
- camelCase
- isNumber
- uniqBy
- isUndefined
- capitalize
- clone
- range
- omitBy
- remove
- forIn
- forEach
- reduce
- flatten
- zipObject
- mapValues
- concat
- trim
- castArray
- difference
- memoize
- keyBy
- assign
- each
- upperFirst
- chain
- sample
- isPlainObject
- has
- mapKeys
- isNull
- last
- isBoolean
- identity
- padStart
- head
- size
- conformsTo
- mergeWith
- transform
- uniqWith
- union
- toString
- reject
- snakeCase
- max
- min
- reverse
- slice
- isInteger
- startsWith
- first
- sumBy
- maxBy
- minBy
- _
- xor
- replace
- take
- endsWith
- toLower
- clamp
- toPairs
- some
- extend
- times
- flattenDeep
- escapeRegExp
- shuffle
- round
- toInteger
- isNaN
- unset
- VERSION
- nth
- flow
- sum
- isFinite
- values
- lowerCase
- deburr
- isEqualWith
- cloneDeepWith
- hasIn
- findLast
- findKey
- differenceBy
- pull
- findLastIndex
- partition
- at
- defer
- intersectionBy
- invert
- delay
- forOwn
- pullAt
- once
- sampleSize
- random
- defaults
- unescape
- keys
- toNumber
- wrap
- inRange
- join
- template
- split
- words
- toSafeInteger
- pullAllBy
- unionWith
- xorBy
- differenceWith
- indexOf
- multiply
- divide
- every
- toPath
- defaultTo
- isObjectLike
- intersection
- startCase
- sortedIndexBy
OtherRelated APIs
lodash#trim JavaScript Examples
The following examples show how to use
lodash#trim.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: string.js From haven with MIT License | 6 votes |
![]() ![]() |
eatSpaces = (str) => {
const trimedString = trim(str);
const result = [trimedString[0]];
for (let i = 1; i < trimedString.length; i += 1) {
const curLetterAscii = trimedString[i].charCodeAt(0);
const prevLetterAscii = result[result.length - 1].charCodeAt(0);
if ((curLetterAscii !== 32 && curLetterAscii !== 160) || (prevLetterAscii !== 32 && prevLetterAscii !== 160)) {
result.push(trimedString[i]);
}
}
return result.join('');
}
Example #2
Source File: search.js From mapstore2-cadastrapp with GNU General Public License v3.0 | 6 votes |
![]() ![]() |
/**
* Reads specific files that contain the list of parcelle, or comptecomunal
* @returns {Promise} a promis that emits an array of strings.
* @param {file} file file to read
*/
function readCSV(file) {
return new Promise((resolve, reject) => {
let reader = new FileReader();
reader.onload = function() {
const string = reader.result;
const parcelle = string.split(DELIMITER_REGEX).map(trim).filter(v => v);
resolve(parcelle);
};
reader.onerror = function() {
reject(reader.error.name);
};
reader.readAsText(file);
});
}