noodl-utils
Advanced tools
Comparing version 0.0.123 to 0.0.124
@@ -1,2 +0,1 @@ | ||
/** @internal */ | ||
export declare const deviceTypes: readonly ["web", "ios", "android"]; |
@@ -1,11 +0,4 @@ | ||
export * as extract from './extract'; | ||
export * as is from './identifiers'; | ||
export * from './noodl-utils'; | ||
export * from './constants'; | ||
export * from './deref'; | ||
export * from './format'; | ||
export * from './hash'; | ||
export * from './regex'; | ||
export * from './to'; | ||
export * from './types'; | ||
export * from './Parser'; | ||
export { default as Parser } from './Parser'; |
import type { LiteralUnion } from 'type-fest'; | ||
import type { IfObject, NameField, ReferenceString, ReferenceSymbol } from 'noodl-types'; | ||
import * as nt from 'noodl-types'; | ||
import * as t from './types'; | ||
export declare function createPlaceholderReplacer(placeholders: string | string[], flags?: string): { | ||
(str: string, value: string | number): string; | ||
<Obj extends {} = any>(obj: Obj, value: string | number): Obj; | ||
}; | ||
export declare const createNoodlPlaceholderReplacer: (keyMap: { | ||
cadlBaseUrl?: any; | ||
cadlVersion?: any; | ||
designSuffix?: any; | ||
}) => (...args: any[]) => any; | ||
/** | ||
@@ -17,4 +26,2 @@ * 2Transforms the dataKey of an emit object. If the dataKey is an object, | ||
}): any; | ||
export declare function ensureSuffix(suffix: string, s: string): string; | ||
export declare function removeSuffix(suffix: string, s: string): string; | ||
export declare function excludeIteratorVar(dataKey: string | undefined, iteratorVar?: string | undefined): string | undefined; | ||
@@ -28,5 +35,5 @@ /** | ||
* @param { function } fn - Callback that receives the value being evaluated | ||
* @param { IfObject } ifObj - The object that contains the "if" | ||
* @param { nt.IfObject } ifObj - The object that contains the "if" | ||
*/ | ||
export declare function evalIf<IfObj extends IfObject>(fn: (val: IfObj['if'][0], onTrue: IfObj['if'][1], onFalse: IfObj['if'][2]) => boolean, ifObj: IfObj): IfObj['if'][1] | IfObj['if'][2] | Promise<IfObj['if'][1] | IfObj['if'][2]>; | ||
export declare function evalIf<IfObj extends nt.IfObject>(fn: (val: IfObj['if'][0], onTrue: IfObj['if'][1], onFalse: IfObj['if'][2]) => boolean, ifObj: IfObj): IfObj['if'][1] | IfObj['if'][2] | Promise<IfObj['if'][1] | IfObj['if'][2]>; | ||
declare type FindDataValueItem = ((...args: any[]) => any) | Record<string, any> | FindDataValueItem[]; | ||
@@ -39,12 +46,19 @@ /** | ||
export declare const findDataValue: <O extends FindDataValueItem = any>(objs: O, path: string | string[] | undefined) => any; | ||
export declare function getPlaceholderValues(str: string, values: any): Record<string, any>; | ||
export declare function hasPlaceholder(str: string): boolean; | ||
export declare function listPlaceholders(str: string): string[]; | ||
export declare function hasNameField<O extends Record<string, any> = Record<string, any>>(v: O | undefined): v is O & { | ||
name: NameField; | ||
}; | ||
export declare function findReferences(obj: any): string[]; | ||
export declare function getDataValue<T = any>(dataObject: T | undefined, dataKey: string | undefined, opts?: { | ||
iteratorVar?: string; | ||
}): any; | ||
export declare const hasNoodlPlaceholder: (str: string | undefined) => boolean; | ||
export declare function isOldConfig<C extends nt.RootConfig & Record<string, any>>({ config, deviceType, env, version, }: { | ||
deviceType?: nt.DeviceType; | ||
config: C; | ||
env?: nt.Env; | ||
version: string | number; | ||
}): boolean; | ||
export declare function isOutboundLink(s?: string | undefined): boolean; | ||
export declare function isRootDataKey(dataKey: string | undefined): boolean; | ||
export declare function isSerializableStr(value: unknown): boolean; | ||
export declare function isStable(): boolean; | ||
export declare function isTest(): boolean; | ||
export declare function isValidAsset(value: string | undefined): boolean; | ||
export declare function toDataPath(key?: string | number | (string | number)[]): string[]; | ||
@@ -56,3 +70,3 @@ /** | ||
*/ | ||
export declare function trimReference(v: LiteralUnion<ReferenceString, string>, fixType: 'prefix'): ReferenceString<Exclude<ReferenceSymbol, '@'>>; | ||
export declare function trimReference(v: LiteralUnion<nt.ReferenceString, string>, fixType: 'prefix'): nt.ReferenceString<Exclude<nt.ReferenceSymbol, '@'>>; | ||
/** | ||
@@ -63,3 +77,3 @@ * Trims the reference suffix in the string | ||
*/ | ||
export declare function trimReference(v: LiteralUnion<ReferenceString, string>, fixType: 'suffix'): ReferenceString<Extract<ReferenceSymbol, '@'>>; | ||
export declare function trimReference(v: LiteralUnion<nt.ReferenceString, string>, fixType: 'suffix'): nt.ReferenceString<Extract<nt.ReferenceSymbol, '@'>>; | ||
/** | ||
@@ -70,3 +84,4 @@ * Trims the both prefix and the suffix symbol(s) in the reference string | ||
*/ | ||
export declare function trimReference(v: LiteralUnion<ReferenceString, string>): string; | ||
export declare function trimReference(v: LiteralUnion<nt.ReferenceString, string>): string; | ||
export declare function withYmlExt(str?: string): string; | ||
export {}; |
@@ -1,7 +0,13 @@ | ||
import type { DeviceType, Env, RootConfig } from 'noodl-types'; | ||
import type { LiteralUnion } from 'type-fest'; | ||
export declare class Parser { | ||
import { DeviceType, Env, PageComponentUrl, RootConfig } from 'noodl-types'; | ||
import { LiteralUnion } from 'type-fest'; | ||
import * as t from './types'; | ||
declare class NoodlUtilsParser { | ||
configVersion(configObject: RootConfig, deviceType: LiteralUnion<DeviceType, string>, env: Env): any; | ||
appConfigUrl(rootConfig: RootConfig, deviceType: LiteralUnion<DeviceType, string>, env: Env): string; | ||
appConfigUrl(baseUrl: string, cadlMain: string, configVersion: string): string; | ||
destination(destination: PageComponentUrl): t.ParsedPageComponentUrlObject; | ||
destination(destination: string | undefined, args: { | ||
denoter?: string; | ||
duration?: number; | ||
}): t.ParsedGotoUrlObject; | ||
/** | ||
@@ -25,1 +31,2 @@ * Parses a NOODL destination, commonly received from goto | ||
} | ||
export default NoodlUtilsParser; |
@@ -1,6 +0,2 @@ | ||
/** @internal */ | ||
export declare type QueryObj<O extends Record<string, any> = any> = O | ((...args: any[]) => O); | ||
/** | ||
* An object with props extracted from a goto destination string | ||
*/ | ||
export interface ParsedGotoUrlObject { | ||
@@ -12,5 +8,2 @@ destination: string; | ||
} | ||
/** | ||
* An object with props extracted from a page component path string | ||
*/ | ||
export interface ParsedPageComponentUrlObject<TargetPage extends string = string, CurrentPage extends string = string, ViewTag extends string = string> { | ||
@@ -17,0 +10,0 @@ targetPage: TargetPage; |
@@ -5,22 +5,7 @@ { | ||
"dependencies": { | ||
"lodash.get": "^4.4.2", | ||
"lodash.has": "^4.5.2", | ||
"noodl-types": "*" | ||
"noodl-types": "^1.0.251" | ||
}, | ||
"description": "Utility/helpers for working with NOODL values", | ||
"devDependencies": { | ||
"@types/chai": "^4.3.3", | ||
"@types/lodash.get": "^4.4.7", | ||
"@types/lodash.has": "^4.5.7", | ||
"@types/mocha": "^10.0.0", | ||
"chai": "^4.3.6", | ||
"commander": "^9.4.1", | ||
"mocha": "^10.0.0", | ||
"sinon": "^14.0.1", | ||
"sinon-chai": "^3.7.0", | ||
"ts-mocha": "^10.0.0", | ||
"type-fest": "^3.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=16", | ||
"node": ">=14", | ||
"npm": ">=7" | ||
@@ -31,3 +16,3 @@ }, | ||
], | ||
"gitHead": "8d25fcb1c7079abb8c5afaf063fb945f2eace127", | ||
"gitHead": "ffe57c1d5a431ae40f797e359af4c362d3a39eed", | ||
"keywords": [ | ||
@@ -48,13 +33,11 @@ "noodl" | ||
"build": "cross-env NODE_ENV=production rollup -c", | ||
"build:exports": "node cli build --exports", | ||
"postbuild": "npm run types", | ||
"poststart": "npm run types", | ||
"start": "cross-env NODE_ENV=development rollup -c -w", | ||
"test": "cross-env TS_NODE_PROJECT=\"tsconfig.test.json\" NODE_ENV=test ts-mocha --file src/__tests__/setup.ts -r source-map-support/register --extensions ts --watch --watch-files src src/**/*.test.ts", | ||
"test": "cross-env TS_NODE_PROJECT=\"tsconfig.test.json\" NODE_ENV=test ts-mocha -r jsdom-global/register --file src/__tests__/setup.ts -r source-map-support/register --extensions ts --watch --watch-files src src/**/*.test.ts", | ||
"test:file": "NODE_ENV=test ts-mocha -r jsdom-global/register --extensions ts --watch --watch-files src", | ||
"types": "tsc --declaration --declarationDir dist --emitDeclarationOnly" | ||
}, | ||
"sideEffects": false, | ||
"typings": "./dist/index.d.ts", | ||
"version": "0.0.123" | ||
"version": "0.0.124" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Floating dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
329377
1
0
3577
1
11
- Removedlodash.get@^4.4.2
- Removedlodash.has@^4.5.2
- Removedlodash.get@4.4.2(transitive)
- Removedlodash.has@4.5.2(transitive)
Updatednoodl-types@^1.0.251