Comparing version 2.0.0-beta.9 to 2.0.0-beta.10
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.identity = void 0; | ||
function identity(value) { | ||
return value; | ||
function identity() { | ||
return function (value) { return value; }; | ||
} | ||
exports.identity = identity; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.prop = void 0; | ||
var prop = function (propName) { | ||
return function (_a) { | ||
var _b = propName, value = _a[_b]; | ||
return value; | ||
}; | ||
}; | ||
exports.propImplementation = exports.prop = void 0; | ||
var purry_1 = require("./purry"); | ||
function prop() { | ||
return (0, purry_1.purry)(propImplementation, arguments); | ||
} | ||
exports.prop = prop; | ||
function propImplementation(data, key) { | ||
var _a = data, _b = key, value = _a[_b]; | ||
return value; | ||
} | ||
exports.propImplementation = propImplementation; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sliceString = void 0; | ||
var sliceString = function (indexStart, indexEnd) { | ||
return function (data) { | ||
return data.slice(indexStart, indexEnd); | ||
}; | ||
}; | ||
function sliceString(dataOrIndexStart, indexStartOrIndexEnd, indexEnd) { | ||
return typeof dataOrIndexStart === "string" | ||
? dataOrIndexStart.slice(indexStartOrIndexEnd, indexEnd) | ||
: function (data) { return data.slice(dataOrIndexStart, indexStartOrIndexEnd); }; | ||
} | ||
exports.sliceString = sliceString; |
@@ -1,3 +0,3 @@ | ||
export function identity(value) { | ||
return value; | ||
export function identity() { | ||
return function (value) { return value; }; | ||
} |
@@ -1,6 +0,8 @@ | ||
export var prop = function (propName) { | ||
return function (_a) { | ||
var _b = propName, value = _a[_b]; | ||
return value; | ||
}; | ||
}; | ||
import { purry } from "./purry"; | ||
export function prop() { | ||
return purry(propImplementation, arguments); | ||
} | ||
export function propImplementation(data, key) { | ||
var _a = data, _b = key, value = _a[_b]; | ||
return value; | ||
} |
@@ -1,5 +0,5 @@ | ||
export var sliceString = function (indexStart, indexEnd) { | ||
return function (data) { | ||
return data.slice(indexStart, indexEnd); | ||
}; | ||
}; | ||
export function sliceString(dataOrIndexStart, indexStartOrIndexEnd, indexEnd) { | ||
return typeof dataOrIndexStart === "string" | ||
? dataOrIndexStart.slice(indexStartOrIndexEnd, indexEnd) | ||
: function (data) { return data.slice(dataOrIndexStart, indexStartOrIndexEnd); }; | ||
} |
@@ -10,2 +10,6 @@ /** | ||
* | ||
* See also: | ||
* `doNothing` - A function that doesn't return anything. | ||
* `identity` - A function that returns the first argument it receives. | ||
* | ||
* @param value - The constant value that would be returned on every invocation. | ||
@@ -12,0 +16,0 @@ * The value is not copied/cloned on every invocation so care should be taken |
@@ -11,2 +11,6 @@ /** | ||
* | ||
* See also: | ||
* * `constant` - A function that ignores it's arguments and returns the same value on every invocation. | ||
* * `identity` - A function that returns the first argument it receives. | ||
* | ||
* @signature | ||
@@ -13,0 +17,0 @@ * R.doNothing(); |
/** | ||
* A function that always returns the param passed to it. | ||
* A function that returns the first argument passed to it. | ||
* | ||
* @param value - The param to return. | ||
* Notice that this is a dataLast impl where the function needs to be invoked | ||
* to get the "do nothing" function. | ||
* | ||
* See also: | ||
* * `doNothing` - A function that doesn't return anything. | ||
* * `constant` - A function that ignores the input arguments and returns the same value on every invocation. | ||
* | ||
* @signature | ||
* R.identity(data) | ||
* R.identity(); | ||
* @example | ||
* R.identity('foo') // => 'foo' | ||
* R.map([1,2,3], R.identity()); // => [1,2,3] | ||
* @category Function | ||
*/ | ||
export declare function identity<T>(value: T): T; | ||
export declare function identity(): <T>(value: T, ...args: any) => T; | ||
//# sourceMappingURL=identity.d.ts.map |
/** | ||
* Gets the value of the given property. | ||
* | ||
* @param propName - The property name. | ||
* @signature R.prop(prop)(object) | ||
* @param data - The object to extract the prop from. | ||
* @param key - The key of the property to extract. | ||
* @signature | ||
* R.prop(data, key); | ||
* @example | ||
* R.prop({ foo: 'bar' }, 'foo'); // => 'bar' | ||
* @dataFirst | ||
* @category Object | ||
*/ | ||
export declare function prop<T, K extends keyof T>(data: T, key: K): T[K]; | ||
/** | ||
* Gets the value of the given property. | ||
* | ||
* @param key - The key of the property to extract. | ||
* @signature | ||
* R.prop(key)(data); | ||
* @example | ||
* R.pipe({foo: 'bar'}, R.prop('foo')) // => 'bar' | ||
@@ -11,3 +25,4 @@ * @dataLast | ||
*/ | ||
export declare const prop: <T, K extends keyof T = keyof T>(propName: K) => ({ [propName]: value }: T) => T[K]; | ||
export declare function prop<T, K extends keyof T>(key: K): (data: T) => T[K]; | ||
export declare function propImplementation<T, K extends keyof T>(data: T, key: K): T[K]; | ||
//# sourceMappingURL=prop.d.ts.map |
@@ -15,2 +15,15 @@ /** | ||
export declare function randomString(length: number): string; | ||
/** | ||
* Random a non-cryptographic random string from characters a-zA-Z0-9. | ||
* | ||
* @returns The random string. | ||
* @signature | ||
* R.randomString(length) | ||
* @example | ||
* R.randomString(5) // => aB92J | ||
* R.pipe(5, R.randomString) // => aB92J | ||
* @dataLast | ||
* @category String | ||
*/ | ||
export declare function randomString(): (length: number) => string; | ||
//# sourceMappingURL=randomString.d.ts.map |
/** | ||
* A data-last version of `String.prototype.slice` so it could be used in pipes. | ||
* Extracts a section of this string and returns it as a new string, without | ||
* modifying the original string. Equivalent to `String.prototype.slice`. | ||
* | ||
* NOTE: You don't need this function if you are calling it directly, just use | ||
* `String.prototype.slice` directly. This function doesn't provide any type | ||
* improvements over the built-in types. | ||
* @param data - The string to extract from. | ||
* @param indexStart - The index of the first character to include in the | ||
* returned substring. | ||
* @param indexEnd - The index of the first character to exclude from the | ||
* returned substring. | ||
* @returns A new string containing the extracted section of the string. | ||
* @signature | ||
* R.sliceString(data, indexStart, indexEnd) | ||
* @example | ||
* R.sliceString("abcdefghijkl", 1) // => `bcdefghijkl` | ||
* R.sliceString("abcdefghijkl", 4, 7) // => `efg` | ||
* @dataLast | ||
* @category String | ||
*/ | ||
export declare function sliceString(data: string, indexStart: number, indexEnd?: number): string; | ||
/** | ||
* Extracts a section of this string and returns it as a new string, without | ||
* modifying the original string. Equivalent to `String.prototype.slice`. | ||
* | ||
* @param indexStart - The index of the first character to include in the returned substring. | ||
* @param indexEnd - (optional) The index of the first character to exclude from the returned substring. | ||
* @param indexStart - The index of the first character to include in the | ||
* returned substring. | ||
* @param indexEnd - The index of the first character to exclude from the | ||
* returned substring, or `undefined` for the rest of the string. | ||
* @returns A new string containing the extracted section of the string. | ||
* @signature | ||
* R.sliceString(indexStart)(string) | ||
* R.sliceString(indexStart, indexEnd)(string) | ||
* @example | ||
* R.sliceString(1)(`abcdefghijkl`) // => `bcdefghijkl` | ||
* R.sliceString(4, 7)(`abcdefghijkl`) // => `efg` | ||
* R.sliceString(1)("abcdefghijkl") // => `bcdefghijkl` | ||
* R.sliceString(4, 7)("abcdefghijkl") // => `efg` | ||
* @dataLast | ||
* @category String | ||
*/ | ||
export declare const sliceString: (indexStart: number, indexEnd?: number) => (data: string) => string; | ||
export declare function sliceString(indexStart: number, indexEnd?: number): (data: string) => string; | ||
//# sourceMappingURL=sliceString.d.ts.map |
@@ -11,15 +11,26 @@ type Values<T extends object> = T extends ReadonlyArray<unknown> | [] ? Array<T[number]> : Array<T[keyof T]>; | ||
* R.values({ a: 'x', b: 'y', c: 'z' }) // => ['x', 'y', 'z'] | ||
* R.pipe(['x', 'y', 'z'], R.values) // => ['x', 'y', 'z'] | ||
* R.pipe({ a: 'x', b: 'y', c: 'z' }, R.values) // => ['x', 'y', 'z'] | ||
* @dataFirst | ||
* @pipeable | ||
* @category Object | ||
*/ | ||
export declare function values<T extends object>(data: T): Values<T>; | ||
/** | ||
* Returns a new array containing the values of the array or object. | ||
* | ||
* @signature | ||
* R.values()(source) | ||
* @example | ||
* R.pipe(['x', 'y', 'z'], R.values()) // => ['x', 'y', 'z'] | ||
* R.pipe({ a: 'x', b: 'y', c: 'z' }, R.values()) // => ['x', 'y', 'z'] | ||
* R.pipe( | ||
* { a: 'x', b: 'y', c: 'z' }, | ||
* R.values, | ||
* R.first, | ||
* R.values(), | ||
* R.first(), | ||
* ) // => 'x' | ||
* @dataFirst | ||
* @dataLast | ||
* @pipeable | ||
* @category Object | ||
*/ | ||
export declare function values<T extends object>(data: T): Values<T>; | ||
export declare function values(): <T extends object>(data: T) => Values<T>; | ||
export {}; | ||
//# sourceMappingURL=values.d.ts.map |
{ | ||
"name": "remeda", | ||
"version": "2.0.0-beta.9", | ||
"version": "2.0.0-beta.10", | ||
"description": "A utility library for JavaScript and Typescript.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
520024
10354