Installations
npm install lowdash
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
8.6.0
NPM Version
5.6.0
Score
27.8
Supply Chain
99.3
Quality
75.2
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
andy2046
Download Statistics
Total Downloads
133,770
Last Day
33
Last Week
228
Last Month
1,163
Last Year
18,052
GitHub Statistics
1 Stars
3 Commits
1 Watching
1 Branches
1 Contributors
Package Meta Information
Latest Version
1.2.0
Package Id
lowdash@1.2.0
Size
84.75 kB
NPM Version
5.6.0
Node Version
8.6.0
Publised On
25 Feb 2018
Total Downloads
Cumulative downloads
Total Downloads
133,770
Last day
-31.3%
33
Compared to previous day
Last week
-10.2%
228
Compared to previous week
Last month
-25.4%
1,163
Compared to previous month
Last year
-3.9%
18,052
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
No dependencies detected.
lowdash
lowdash is a functional JavaScript library including compose, pipe, curry, transduce, identity, trace, Functor, Monad, Applicative
Examples
1const {compose, curry, pipe, identity, trace, transduce, Functor, Monad, Applicative} = require('lowdash') 2 3// curry 4 5const match = curry(function(what, str) { 6 return str.match(what) 7}) 8 9const replace = curry(function(what, replacement, str) { 10 return str.replace(what, replacement) 11}) 12 13const filter = curry(function(f, ary) { 14 return ary.filter(f) 15}) 16 17const map = curry(function(f, ary) { 18 return ary.map(f) 19}) 20 21match(/\s+/g)('hello world') 22//=> [ ' ' ] 23 24const hasSpaces = match(/\s+/g) 25// function(x) { return x.match(/\s+/g) } 26 27hasSpaces('hello world') 28//=> [ ' ' ] 29 30hasSpaces('spaceless') 31//=> null 32 33filter(hasSpaces, ['the_spelling', 'te amo']) 34//=> ['te amo'] 35 36const findSpaces = filter(hasSpaces) 37// function(xs) { return xs.filter(function(x) { return x.match(/\s+/g) }) } 38 39findSpaces(['the_spelling', 'te amo']) 40//=> ['te amo'] 41 42const noVowels = replace(/[aeiou]/ig) 43// function(replacement, x) { return x.replace(/[aeiou]/ig, replacement) } 44 45const censored = noVowels('*') 46// function(x) { return x.replace(/[aeiou]/ig, '*') } 47 48censored('Chocolate Cake') 49//=> 'Ch*c*l*t* C*k*' 50 51// compose 52 53const toUpperCase = function(x) { return x.toUpperCase() } 54const exclaim = function(x) { return x + '!' } 55const shout = compose(exclaim, toUpperCase) 56 57shout('angry or hungry') 58//=> 'ANGRY OR HUNGRY!' 59 60const reduce = curry(function(f, ary) { 61 return ary.reduce(f) 62}) 63 64const head = function(x) { return x[0] } 65const reverse = reduce(function(acc, x) { return [x].concat(acc) }) 66const last = compose(head, reverse) 67 68last(['jump', 'house', 'upper']) 69//=> 'upper' 70 71const lastUpper = compose(toUpperCase, head, reverse) 72 73lastUpper(['jump', 'house', 'upper']) 74//=> 'UPPER' 75 76// pipe 77 78const shoutPipe = pipe(exclaim, toUpperCase) 79 80console.log( shoutPipe('angry or hungry') ) 81//=> 'ANGRY OR HUNGRY!' 82 83// pointfree 84 85const toLowerCase = function(x) { return x.toLowerCase() } 86const snakeCase = compose(replace(/\s+/ig, '_'), toLowerCase) 87 88snakeCase('Snake Case') 89//=> 'snake_case' 90 91const split = curry(function(separator, str) { 92 return str.split(separator) 93}) 94const join = curry(function(separator, ary) { 95 return ary.join(separator) 96}) 97const initials = compose(join('. '), map(compose(toUpperCase, head)), split(' ')) 98 99initials('json jackson jason') 100//=> 'J. J. J' 101 102// transduce = transform + reduce 103 104const t = curry(transduce)( 105 compose(map(x => x +1), filter(x => x > 2)), 106 (result, x) => result.concat(x), 107 [] 108) 109console.log(t([1,2,3,4])) 110//=> [4, 5] 111 112// debug 113 114const dasherize = compose(join('-'), map(toLowerCase), trace('after split'), 115 split(' '), replace(/\s{2,}/ig, ' ')) 116 117dasherize('The world is a vampire') 118//=> after split [ 'The', 'world', 'is', 'a', 'vampire' ] 119//=> 'the-world-is-a-vampire' 120 121// Functor, Monad, Applicative 122 123const increment = x => x + 1 124const add2 = compose(increment, increment) 125const add4 = compose(add2, add2) 126 127console.log( 128 Functor.of(1) 129 .map(increment) 130 .map(add4) 131) 132 133const incrementMonad = compose(Monad.of, increment) 134const add2Monad = x => Monad.of(x).bind(incrementMonad).bind(incrementMonad) 135const add4Monad = x => Monad.of(x).bind(add2Monad).bind(add2Monad) 136 137console.log( 138 Monad.of(1) 139 .bind(incrementMonad) 140 .bind(add4Monad) 141 .join() 142) 143 144const add = a => b => a + b 145const add2 = add(2) 146 147let left = Applicative.of(add2).ap(Applicative.of(3)) 148let right = Applicative.of(3).map(add2) 149 150console.log( 151 left.val === right.val // 5 152) 153
Installation
npm install --save lowdash
Usage
You can import from lowdash
:
1import {compose, curry, pipe, identity, trace, transduce, Functor, Monad, Applicative} from 'lowdash'; 2// or 3const {compose, curry, pipe, identity, trace, transduce, Functor, Monad, Applicative} = require('lowdash');
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More