Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
lodash-mixins-collection
Advanced tools
A little collection of additional mix-ins for great lodash library.
A little collection of additional mix-ins for great lodash
library (https://github.com/lodash/lodash). Here you can find quick docs of each mixin - they are organized the same way as in the original lodash
docs - alphabetically and by mixin category (string
, collection
, array
... ).
Install via bower using bower install lodash-mixins --save
or simply download and include lodash-mixins.min.js
. Be sure to initialize original lodash before registering these mix-ins. The only dependency to this package is lodash
itself. ES6 is not required.
NPM support added, you can download it via: npm i lodash-mixins-collection
Alias for existing _.includes
method. Added just to make code more readable in certain cases (notice that order of parameters is switched).
_.in(5, [2,3,5,6]);
// produces true
Alias for existing _.includes
method.
_.contains([2,3,5,6], 6);
// produces true
Loops over collection of objects and renames a key.
_.renameKeys([{a: 2, b:4}, {x: 3, b:3}], 'x', 'a')
// produces [{"a":2,"b":4},{"b":3,"a":3}]
This is the opposite of _.isUndefined
.
var a = {b: 1};
_.isDefined(a.c);
// produces false
Checks if given variable represents a numeric value.
_.isNumeric('12');
// produces true
_.isNumeric('12.5');
// produces true
_.isNumeric('12,5');
// produces false
_.isNumeric('dsa');
// produces false
Connects all arguments with given string. If one of the argument is an array, it will be considered as an array of values that need to be connected. You can pass any number of arguments, the last argument is the string that will connect everything.
If last argument is a string, then that will be used for connecting each part. Also, instead of a string, an object can be passed where you can set three parameters, these are the defaults:
{"main": "", "last": "", "strict": "false"}
If strict is set to false
(the default setting), then values like empty strings and null
will simply be skipped in the final output (examples below).
_.connect('Today', 'is', 'a cool', 'day', ' ');
// produces 'Today is a cool day.'
_.connect('Today', 'is', ['a cool', 'day'], '::');
// produces 'Today::is::a::cool::day.'
_.connect('One', ['two','three','four'], null, 'five', 'six', {main: ', ', last:' and ', strict: false})
// produces 'One, two, three, four, five and six'
_.connect('One', ['two','three','four'], null, 'five', 'six', {main: ', ', last:' and ', strict: true})
// produces 'One, two, three, four, null, five and six'
Additional _.connect helpers are also included:
_.spaced(...); // Connects arguments with a blank space " "
_.dashed(...); // Connects arguments with a dash "-"
_.dotted(...); // Connects arguments with a dot "."
_.slashed(...); // Connects arguments with a forward slash "/"
_.listed(...); // Connects all arguments with a comma, except last one for which 'and' word is used - useful when outputting lists in user interface
Transforms given string to slug.
_.toSlug('Today is a nice day');
// produces 'today-is-a-nice-day'
Just a wrapper of the original toString method.
_.toUpperCase('very simple');
// produces 'VERY SIMPLE'
Returns first N words from given sentence. Optionally, you can append an additional ending to the output ('...' by default).
_.words('testing this thing right now', 3);
// produces 'testing this thing...'
FAQs
A little collection of additional mix-ins for great lodash library.
The npm package lodash-mixins-collection receives a total of 1 weekly downloads. As such, lodash-mixins-collection popularity was classified as not popular.
We found that lodash-mixins-collection demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.