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

@remirror/core-helpers

Package Overview
Dependencies
Maintainers
1
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remirror/core-helpers - npm Package Compare versions

Comparing version 1.0.0-next.60 to 1.0.0-pr706

dist/remirror-core-helpers.browser.cjs.js

2

CHANGELOG.md

@@ -271,3 +271,3 @@ # @remirror/core-helpers

import { WysiwygPreset } from 'remirror/preset/wysiwyg';
import { RemirrorProvider, useManager } from 'remirror/react';
import { RemirrorProvider, useManager } from '@remirror/react';

@@ -274,0 +274,0 @@ const EditorWrapper = () => {

import omit from 'object.omit';
import pick from 'object.pick';
import type { Primitive } from 'type-fest';
import type { RemirrorIdentifier } from '@remirror/core-constants';
import type { AnyConstructor, AnyFunction, Nullable, Predicate, RemirrorIdentifierShape, Shape, UnknownShape } from '@remirror/core-types';
import type { ConditionalExcept, Primitive } from 'type-fest';
interface Shape {
[key: string]: any;
}
declare type UnknownShape<Type = unknown> = Record<string, Type>;
declare type Nullable<Type> = Type | null | undefined;
declare type AnyConstructor<Type = any> = new (...args: any[]) => Type;
declare type AnyFunction<Type = any> = (...args: any[]) => Type;
declare type GetRecursivePath<Type, Key extends keyof Type> = Key extends string ? Type[Key] extends Record<string, any> ? `${Key}.${GetRecursivePath<Type[Key], Exclude<keyof Type[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof Type[Key], keyof any[]> & string}` : never : never;
declare type GetJoinedPath<Type> = GetRecursivePath<Type, keyof Type> | keyof Type;
export declare type GetPath<Type> = GetJoinedPath<Type> extends string | keyof Type ? GetJoinedPath<Type> : keyof Type;
export declare type GetPathValue<Type, Path extends GetPath<Type>> = Path extends `${infer Key}.${infer Rest}` ? Key extends keyof Type ? Rest extends GetPath<Type[Key]> ? GetPathValue<Type[Key], Rest> : never : never : Path extends keyof Type ? Type[Path] : never;
export declare type TupleRange<Size extends number> = Size extends Size ? number extends Size ? number[] : _NumberRangeTuple<[], Size> : never;
declare type _NumberRangeTuple<Tuple extends readonly unknown[], Length extends number> = Tuple['length'] extends Length ? Tuple : _NumberRangeTuple<[...Tuple, Tuple['length']], Length>;
/**
* Any falsy type.
*/
declare type Falsy = false | 0 | '' | null | undefined;
/**
* Type cast an argument. If no type is provided it will default to any.

@@ -15,4 +22,14 @@ *

*/
export declare function Cast<Type = any>(parameter: unknown): Type;
export declare function Cast<Type = any>(value: unknown): Type;
/**
* Get the key from a given value. Throw an error if the referenced property is
* `undefined`.
*/
export declare function assertGet<Value extends object, Key extends keyof Value>(value: Value, key: Key, message?: string): Value[Key];
/**
* Assert the value is `truthy`. Good for defensive programming, especially
* after enabling `noUncheckedIndexedAccess` in the tsconfig `compilerOptions`.
*/
export declare function assert(testValue: unknown, message?: string): asserts testValue;
/**
* A typesafe implementation of `Object.entries()`

@@ -44,9 +61,2 @@ *

/**
* Shorthand for casting a value to it's boolean equivalent.
*
* @param value - the value to transform into a boolean
*
*/
export declare function bool<Value>(value: Value): value is Exclude<Value, Falsy>;
/**
* Alias of toString for non-dom environments.

@@ -59,11 +69,2 @@ *

/**
* Negates a predicate check.
*
* @remarks
*
* Unfortunately it doesn't seem possible to automatically negate the predicate
* with typescript.
*/
export declare function not<Type>(predicate: Predicate<Type>): (a: unknown) => boolean;
/**
* Check if an instance is the direct instance of the provided class.

@@ -242,22 +243,11 @@ */

*/
export declare function isEmptyArray(value: unknown): boolean;
export declare function isEmptyArray(value: unknown): value is never[];
/**
* Identifies the value as having a remirror identifier. This is the core
* predicate check for the remirror library.
* Predicate check that value is a non-empty.
*
* @param value - the value to be checked
* @param value - the value to check
*
* @internal
*/
export declare const isRemirrorType: (value: unknown) => value is RemirrorIdentifierShape;
export declare function isNonEmptyArray<Item>(value: Item[]): value is [Item, ...Item[]];
/**
* Checks that the provided remirror shape is of a given type.
*
* @param value - any remirror shape
* @param type - the remirror identifier type to check for
*
* @internal
*/
export declare function isIdentifierOfType(value: RemirrorIdentifierShape, type: RemirrorIdentifier | RemirrorIdentifier[]): boolean;
/**
* Capitalizes a string value.

@@ -338,3 +328,3 @@ *

*
* @param params - the destructured params
* @param prefix - a prefix for the generated id.
* @returns a unique string of specified length

@@ -353,4 +343,7 @@ *

export declare function take<Type>(array: Type[], number: number): Type[];
export declare function omitUndefined(object: UnknownShape): UnknownShape;
/**
* Remove the undefined values from an object.
*/
export declare function omitUndefined<Type extends object>(object: Type): ConditionalExcept<Type, undefined>;
/**
* Clones a plain object using object spread notation

@@ -395,3 +388,3 @@ *

*/
export declare function noop(): void;
export declare function noop(): undefined;
/**

@@ -404,4 +397,4 @@ * A deep merge which only merges plain objects and Arrays. It clones the object

*/
export declare function deepMerge<Type = any>(...objects: Array<UnknownShape | unknown[]>): Type;
interface ClampParameter {
export declare function deepMerge<Type = any>(...objects: Array<object | unknown[]>): Type;
interface ClampProps {
min: number;

@@ -414,3 +407,3 @@ max: number;

*/
export declare function clamp({ min, max, value }: ClampParameter): number;
export declare function clamp({ min, max, value }: ClampProps): number;
/**

@@ -438,6 +431,6 @@ * Get the last element of the array.

*
* @param obj - object to retrieve property from
* @param path - path to property
* @param obj - object to retrieve property from
*/
export declare function get<Return = any>(path: string | Array<string | number>, obj: unknown, fallback?: unknown): Return;
export declare function get<Return>(root: Shape, path: string | string[], defaultValue?: unknown): Return;
/**

@@ -471,3 +464,3 @@ * Set the value of a given path for the provided object. Does not mutate the

*/
export declare function uniqueBy<Item = any, Key = any>(array: Item[], getValue: ((item: Item) => Key) | string | Array<string | number>, fromStart?: boolean): Item[];
export declare function uniqueBy<Item = any>(array: Item[], getValue: ((item: Item) => unknown) | GetPath<Item>, fromStart?: boolean): Item[];
/**

@@ -478,5 +471,10 @@ * Create a range from start to end.

* and end are provided it creates an array who's first position is start and
* final position is end. i.e. `length = (end - start) + 1`
* final position is end. i.e. `length = (end - start) + 1`.
*
* If you'd like to create a typed tuple of up to `40` items then pass in a
* `[number]` tuple as the first argument.
*/
export declare function range(start: number, end?: number): number[];
export declare function range<Size extends number>(size: [Size]): TupleRange<Size>;
export declare function range(size: number): number[];
export declare function range(start: number, end: number): number[];
/**

@@ -499,4 +497,4 @@ * Check that a number is within the minimum and maximum bounds of a set of

*
* @typeParam Obj - the object type
* @typeParam Property - the property which can be a string | number | symbol
* @template Obj - the object type
* @template Property - the property which can be a string | number | symbol
*/

@@ -503,0 +501,0 @@ export declare function hasOwnProperty<Obj extends object, Property extends string | number | symbol>(object_: Obj, key: Property): object_ is Property extends keyof Obj ? Obj : Obj & {

@@ -11,3 +11,3 @@ /**

*/
export declare const freeze: <Target extends object>(target: Target, options?: FreezeOptions) => Readonly<Target>;
export declare function freeze<Target extends object>(target: Target, options?: FreezeOptions): Readonly<Target>;
interface FreezeOptions {

@@ -14,0 +14,0 @@ /**

@@ -1,3 +0,3 @@

export { invariant, RemirrorError } from './core-errors';
export { Cast, bool, callIfDefined, camelCase, capitalCase, capitalize, clamp, cleanupOS, clone, constantCase, debounce, deepMerge, entries, findMatches, flattenArray, format, get, getLazyArray, hasOwnProperty, includes, isAndroidOS, isArray, isBoolean, isClass, isDate, isDirectInstanceOf, isEmptyArray, isEmptyObject, isEqual, isError, isFunction, isIdentifierOfType, isInstanceOf, isInteger, isMap, isNativePromise, isNull, isNullOrUndefined, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isRemirrorType, isSafeInteger, isSet, isString, isSymbol, isUndefined, kebabCase, keys, last, noop, not, object, omit, omitUndefined, pascalCase, pathCase, pick, randomFloat, randomInt, range, set, shallowClone, snakeCase, sort, spaceCase, startCase, take, throttle, toString, uniqueArray, uniqueBy, uniqueId, unset, values, within, } from './core-helpers';
export { freeze } from './freeze';
export * from './core-errors';
export * from './core-helpers';
export * from './freeze';
{
"name": "@remirror/core-helpers",
"version": "1.0.0-next.60",
"version": "1.0.0-pr706",
"description": "Provide helper functions for the remirror codebase, kinda like a tiny lodash",
"homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/@remirror/core-helpers",
"repository": "https://github.com/remirror/remirror/tree/HEAD/packages/@remirror/core-helpers",
"homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/remirror__core-helpers",
"repository": "https://github.com/remirror/remirror/tree/HEAD/packages/remirror__core-helpers",
"license": "MIT",

@@ -12,9 +12,20 @@ "contributors": [

"sideEffects": false,
"main": "dist/core-helpers.cjs.js",
"module": "dist/core-helpers.esm.js",
"exports": {
".": {
"import": "./dist/remirror-core-helpers.esm.js",
"require": "./dist/remirror-core-helpers.cjs.js",
"browser": "./dist/remirror-core-helpers.browser.esm.js",
"types": "./dist/remirror-core-helpers.cjs.d.ts",
"default": "./dist/remirror-core-helpers.esm.js"
},
"./package.json": "./package.json",
"./types/*": "./dist/declarations/src/*.d.ts"
},
"main": "dist/remirror-core-helpers.cjs.js",
"module": "dist/remirror-core-helpers.esm.js",
"browser": {
"./dist/core-helpers.cjs.js": "./dist/core-helpers.browser.cjs.js",
"./dist/core-helpers.esm.js": "./dist/core-helpers.browser.esm.js"
"./dist/remirror-core-helpers.cjs.js": "./dist/remirror-core-helpers.browser.cjs.js",
"./dist/remirror-core-helpers.esm.js": "./dist/remirror-core-helpers.browser.esm.js"
},
"types": "dist/core-helpers.cjs.d.ts",
"types": "dist/remirror-core-helpers.cjs.d.ts",
"files": [

@@ -24,9 +35,9 @@ "dist"

"dependencies": {
"@babel/runtime": "^7.12.0",
"@remirror/core-constants": "1.0.0-next.60",
"@remirror/core-types": "1.0.0-next.60",
"@babel/runtime": "^7.12.13",
"@remirror/core-constants": "1.0.0-pr706",
"@types/object.omit": "^3.0.0",
"@types/object.pick": "^1.3.0",
"@types/throttle-debounce": "^2.1.0",
"case-anything": "^1.1.1",
"case-anything": "^1.1.2",
"dash-get": "^1.0.2",
"deepmerge": "^4.2.2",

@@ -38,3 +49,3 @@ "fast-deep-equal": "^3.1.3",

"throttle-debounce": "^3.0.1",
"type-fest": "^0.18.0"
"type-fest": "^0.20.2"
},

@@ -44,3 +55,14 @@ "publishConfig": {

},
"cjs": "lib/dist/core-helpers.cjs.js"
"@remirror": {
"tsconfigs": {
"src": {
"compilerOptions": {
"types": [
"node"
]
}
}
}
},
"rn:dev": "src/index.ts"
}

@@ -10,4 +10,4 @@ # @remirror/core-helpers

[license]: https://flat.badgen.net/badge/license/MIT/purple
[size]: https://bundlephobia.com/result?p=@remirror/core-helpers@next
[size-badge]: https://flat.badgen.net/bundlephobia/minzip/@remirror/core-helpers@next
[size]: https://bundlephobia.com/result?p=@remirror/core-helpers
[size-badge]: https://flat.badgen.net/bundlephobia/minzip/@remirror/core-helpers
[typescript]: https://flat.badgen.net/badge/icon/TypeScript?icon=typescript&label

@@ -14,0 +14,0 @@ [downloads-badge]: https://badgen.net/npm/dw/@remirror/core-helpers/red?icon=npm

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