Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@namely/underly

Package Overview
Dependencies
Maintainers
6
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@namely/underly - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

dist/find.d.ts

6

dist/index.d.ts
export { chunk } from './chunk';
export { filter } from './filter';
export { find } from './find';
export { flatten } from './flatten';
export { groupBy } from './groupBy';
export { identity } from './identity';
export { is } from './is';
export { join } from './join';
export { map } from './map';

@@ -19,3 +22,6 @@ export { max } from './max';

export { sort } from './sort';
export { split } from './split';
export { tap } from './tap';
export { trim } from './trim';
export { unique } from './unique';
export { fromPrototype } from './util/fromPrototype';

98

dist/index.es.js

@@ -84,2 +84,21 @@ var isNumber = function isNumber(value) {

/**
* Finds a value in an array; just like the array prototype method, but curried.
*
* ## Example
* ```javascript
* import { find, is, pipe, pluck } from '_ly';
*
* const whereUuidIs = uuid => pipe(pluck('uuid'), is(uuid));
* const findMyUuid = find(whereUuidIs('666'));
*
* findMyUuid([{ uuid: '888' }, { uuid: '666' }]); // { uuid: '666' }
* findMyUuid([{ uuid: '333' }, { uuid: '999' }]); // undefined
* ```
*
* @param {function(value: T, index: number, array: T[]): boolean} predicate
* @returns {function(input: T[]): T | undefined}
*/
var find = fromPrototype(Array.prototype.find);
/**
* Flattens an array; just like the array prototype method (`flat`), but curried.

@@ -181,2 +200,40 @@ *

/**
* A function that checks if two values are the same.
*
* ⚠️ Does not do a deep check.
*
* ## Example
* ```javascript
* import { filter, find, is, pipe, pluck } from '_ly';
*
* const whereIdIs = id => pipe(pluck('id'), is(id));
*
* filter(whereIdIs('666'));
* find(whereIdIs('666'));
* ```
*
* @param {*} a
* @returns {function(*): boolean}
*/
var is = function is(a) {
return function (b) {
return Object.is(a, b);
};
};
/**
* Join values in an array to a string; just like the array prototype method, but curried.
*
* ## Example
* ```javascript
* const toList = join(', ');
* toList(['a', 'b', 'c']); // "a, b, c"
* ```
*
* @param {string} [separator]
* @returns {function(input: *[]): string}
*/
var join = fromPrototype(Array.prototype.join);
/**
* Maps an array; just like the array prototype method, but curried.

@@ -537,2 +594,17 @@ *

/**
* Split a string up into items of an array; just like the string prototype method, but curried.
*
* ## Example
* ```javascript
* const addressLines = split('\n');
* addressLines('123 Four\n#5'); // ['123 Four', '#5']
* ```
*
* @param {string|RegExp} separator
* @param {number} [limit]
* @returns {function(input: string): string[]}
*/
var split = fromPrototype(String.prototype.split);
/**
* Returns the input, but useful for performing side effects in a _pipeline_.

@@ -565,2 +637,26 @@ *

/**
* Remove whitespace at the start and end of a string; just like the string prototype method, but curried.
*
* ## Example
* ```javascript
* const makeFullName = pipe(
* join(' '),
* trim(),
* );
*
* const { first, middle, last, suffix } = {
* first: 'Susan',
* middle: 'B.',
* last: 'Anthony',
* suffix: '',
* };
*
* makeFullName([first, middle, last, suffix]); // "Susan B. Anthony"
* ```
*
* @returns {function(input: string): string}
*/
var trim = fromPrototype(String.prototype.trim);
/**
* Creates a subset of the provided array with its unique values. The unique

@@ -618,3 +714,3 @@ * value may be derived by a mapping function.

export { chunk, filter, flatten, groupBy, identity, map, max, maxBy, min, minBy, neg, noop, not, partition, pipe, pluck, reduce, sort, tap, unique };
export { chunk, filter, find, flatten, groupBy, identity, is, join, map, max, maxBy, min, minBy, neg, noop, not, partition, pipe, pluck, reduce, sort, split, tap, trim, unique, fromPrototype };
//# sourceMappingURL=index.es.js.map

@@ -88,2 +88,21 @@ 'use strict';

/**
* Finds a value in an array; just like the array prototype method, but curried.
*
* ## Example
* ```javascript
* import { find, is, pipe, pluck } from '_ly';
*
* const whereUuidIs = uuid => pipe(pluck('uuid'), is(uuid));
* const findMyUuid = find(whereUuidIs('666'));
*
* findMyUuid([{ uuid: '888' }, { uuid: '666' }]); // { uuid: '666' }
* findMyUuid([{ uuid: '333' }, { uuid: '999' }]); // undefined
* ```
*
* @param {function(value: T, index: number, array: T[]): boolean} predicate
* @returns {function(input: T[]): T | undefined}
*/
var find = fromPrototype(Array.prototype.find);
/**
* Flattens an array; just like the array prototype method (`flat`), but curried.

@@ -185,2 +204,40 @@ *

/**
* A function that checks if two values are the same.
*
* ⚠️ Does not do a deep check.
*
* ## Example
* ```javascript
* import { filter, find, is, pipe, pluck } from '_ly';
*
* const whereIdIs = id => pipe(pluck('id'), is(id));
*
* filter(whereIdIs('666'));
* find(whereIdIs('666'));
* ```
*
* @param {*} a
* @returns {function(*): boolean}
*/
var is = function is(a) {
return function (b) {
return Object.is(a, b);
};
};
/**
* Join values in an array to a string; just like the array prototype method, but curried.
*
* ## Example
* ```javascript
* const toList = join(', ');
* toList(['a', 'b', 'c']); // "a, b, c"
* ```
*
* @param {string} [separator]
* @returns {function(input: *[]): string}
*/
var join = fromPrototype(Array.prototype.join);
/**
* Maps an array; just like the array prototype method, but curried.

@@ -541,2 +598,17 @@ *

/**
* Split a string up into items of an array; just like the string prototype method, but curried.
*
* ## Example
* ```javascript
* const addressLines = split('\n');
* addressLines('123 Four\n#5'); // ['123 Four', '#5']
* ```
*
* @param {string|RegExp} separator
* @param {number} [limit]
* @returns {function(input: string): string[]}
*/
var split = fromPrototype(String.prototype.split);
/**
* Returns the input, but useful for performing side effects in a _pipeline_.

@@ -569,2 +641,26 @@ *

/**
* Remove whitespace at the start and end of a string; just like the string prototype method, but curried.
*
* ## Example
* ```javascript
* const makeFullName = pipe(
* join(' '),
* trim(),
* );
*
* const { first, middle, last, suffix } = {
* first: 'Susan',
* middle: 'B.',
* last: 'Anthony',
* suffix: '',
* };
*
* makeFullName([first, middle, last, suffix]); // "Susan B. Anthony"
* ```
*
* @returns {function(input: string): string}
*/
var trim = fromPrototype(String.prototype.trim);
/**
* Creates a subset of the provided array with its unique values. The unique

@@ -624,5 +720,8 @@ * value may be derived by a mapping function.

exports.filter = filter;
exports.find = find;
exports.flatten = flatten;
exports.groupBy = groupBy;
exports.identity = identity;
exports.is = is;
exports.join = join;
exports.map = map;

@@ -641,4 +740,7 @@ exports.max = max;

exports.sort = sort;
exports.split = split;
exports.tap = tap;
exports.trim = trim;
exports.unique = unique;
exports.fromPrototype = fromPrototype;
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@namely/underly",
"version": "0.1.0",
"version": "0.2.0",
"description": "Lightweight functional helpers",

@@ -5,0 +5,0 @@ "author": "Vince Malone <vince.malone@namely.com>",

export { chunk } from './chunk';
export { filter } from './filter';
export { find } from './find';
export { flatten } from './flatten';
export { groupBy } from './groupBy';
export { identity } from './identity';
export { is } from './is';
export { join } from './join';
export { map } from './map';

@@ -19,3 +22,6 @@ export { max } from './max';

export { sort } from './sort';
export { split } from './split';
export { tap } from './tap';
export { trim } from './trim';
export { unique } from './unique';
export { fromPrototype } from './util/fromPrototype';
# TODO
- [ ] **`join`**
```ts
fromPrototype(Array.prototype.join)
```
- [ ] **`sortBy`**

@@ -15,14 +9,2 @@

- [ ] **`split`**
```ts
fromPrototype(String.prototype.split)
```
- [ ] **`trim`**
```ts
fromPrototype(String.prototype.trim)
```
- [ ] **`capitalize`**

@@ -29,0 +11,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc