lodash APIs
- cloneDeep
- get
- isEqual
- isEmpty
- debounce
- merge
- uniq
- omit
- isString
- isArray
- pick
- sortBy
- groupBy
- flatten
- set
- find
- orderBy
- mapValues
- isObject
- last
- isNil
- isNumber
- range
- chunk
- throttle
- filter
- uniqBy
- difference
- pickBy
- noop
- capitalize
- uniqueId
- has
- isUndefined
- map
- camelCase
- isFunction
- kebabCase
- intersection
- random
- includes
- isPlainObject
- compact
- Dictionary
- findIndex
- keyBy
- forEach
- trim
- clamp
- identity
- remove
- keys
- isNull
- times
- startCase
- first
- values
- mapKeys
- sumBy
- max
- reduce
- some
- zip
- every
- memoize
- clone
- countBy
- concat
- snakeCase
- assign
- isBoolean
- uniqWith
- omitBy
- without
- minBy
- head
- maxBy
- min
- upperFirst
- escapeRegExp
- reverse
- sample
- shuffle
- defaults
- inRange
- flattenDeep
- take
- union
- sum
- mergeWith
- castArray
- replace
- flatMap
- reject
- zipObject
- template
- isNaN
- mean
- size
- findLast
- unset
- partition
- round
- fromPairs
- floor
- toPairs
- indexOf
- toString
- sampleSize
- differenceBy
- update
- chain
- startsWith
- xor
- pull
- DebouncedFunc
- defaultsDeep
- split
- findKey
- unescape
- partial
- toNumber
- invert
- each
- differenceWith
- endsWith
- slice
- isDate
- unionBy
- findLastIndex
- join
- isInteger
- delay
- isObjectLike
- padStart
- result
- isError
- extend
- cloneDeepWith
- upperCase
- trimStart
- constant
- matches
- lowerCase
- forIn
- lowerFirst
- once
- transform
- isMatch
- escape
- isEqualWith
- zipWith
- isRegExp
- entries
- sortedIndexBy
- dropWhile
- takeWhile
- isElement
- forEachRight
- ReplaceFunction
- TemplateExecutor
- keysIn
- IsEqualCustomizer
- isTypedArray
- cond
- stubTrue
- toUpper
- isMap
- isSet
- meanBy
- rangeRight
- repeat
- trimEnd
- now
- nth
- pullAt
- toPath
- eq
- lt
- lte
- gt
- gte
- pullAllBy
- pullAll
- toLower
- fill
- ceil
- flatMapDeep
- CloneDeepWithCustomizer
- negate
- takeRightWhile
- invoke
- tap
- intersectionWith
- truncate
- Collection
- bind
- curry
- partialRight
- sortedUniq
- sortedIndexOf
- Object
- drop
- _
Other Related APIs
lodash#rangeRight TypeScript Examples
The following examples show how to use
lodash#rangeRight.
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: LastYearActivity.tsx From hub with Apache License 2.0 | 5 votes |
LastYearActivity = (props: Props) => {
const prepareMonths = (): string[] => {
return rangeRight(12).map((n: number) => {
return moment().subtract(n, 'months').startOf('month').format('MM/YY');
});
};
const [versions, setVersions] = useState<SortedVersions | undefined>();
const [months] = useState<string[]>(prepareMonths());
useEffect(() => {
const prepareVersionsList = () => {
const sortedVersions = groupBy(props.versions, (v) => moment.unix(v.ts).startOf('month').format('MM/YY'));
setVersions(sortedVersions);
};
prepareVersionsList();
}, [props.versions]);
const getLevel = (releases: Version[] | undefined): number => {
if (isUndefined(releases)) {
return 0;
} else {
const releasesNumber = releases.length;
if (releasesNumber > 5) {
return 4;
} else if (releasesNumber >= 3 && releasesNumber <= 5) {
return 3;
}
return releasesNumber;
}
};
if (isUndefined(versions)) return null;
return (
<>
<SmallTitle text="Last year activity" />
<div data-testid="lastYearActivity" className={`d-flex flex-column w-100 mb-3 ${styles.heatMap}`}>
<div className="d-flex flex-row justify-content-between w-100">
{months.map((month: string) => {
const level = getLevel(versions[month]);
return (
<div key={`activity_${month}`} className="position-relative">
<div
data-testid="heatMapCell"
className={classnames('position-relative border', styles.heatMapCell, styles[`level${level}`], {
border: level === 0,
})}
/>
<div data-testid="heatMapPopover" className={`popover end-0 ${styles.popover}`} role="tooltip">
<div className={`popover-header lh-1 p-2 ${styles.popoverHeader}`}>
{moment(month, 'MM/YY').format("MMM'YY")}
</div>
<div className="popover-body text-nowrap">
<div className="d-flex flex-row align-items-center">
<div className={`me-2 border rounded-circle top-0 ${styles.marker} ${styles[`level${level}`]}`} />
Releases: <span className="fw-bold ms-2">{versions[month] ? versions[month].length : 0}</span>
</div>
</div>
</div>
</div>
);
})}
</div>
<div className={`d-flex flex-row justify-content-between w-100 ${styles.legend}`}>
<div>
<small className="text-muted">{moment(months[0], 'MM/YY').format("MMM'YY")}</small>
</div>
<div>
<small className="text-muted">{moment(months[5], 'MM/YY').format("MMM'YY")}</small>
</div>
<div>
<small className="text-muted">{moment(months[months.length - 1], 'MM/YY').format("MMM'YY")}</small>
</div>
</div>
</div>
</>
);
}