js-awe
Advanced tools
Comparing version 1.0.69 to 1.0.70
@@ -19,2 +19,4 @@ 'use strict'; | ||
const jsonpath_plus_1 = require("jsonpath-plus"); | ||
const fluture_1 = require("fluture"); | ||
const path_1 = require("path"); | ||
const logWithPrefix = (title, displayFunc) => (message) => { | ||
@@ -541,2 +543,5 @@ let finalMessage = message; | ||
let valueToCopy = getAt(inputObj, from); | ||
if (typeof rule.transform === 'function') { | ||
valueToCopy = rule.transform(valueToCopy); | ||
} | ||
if (valueToCopy === undefined || valueToCopy === null) | ||
@@ -572,2 +577,15 @@ return; | ||
// } | ||
// { | ||
// let objTo = {a:{b:2},c:12} | ||
// let objFrom = {a:{b:4},g:"2228",d:{e:{f:12}}, l:5} | ||
// copyPropsWithValueUsingRules(objTo, | ||
// [ | ||
// {from:'g', to:'e', transform: parseInt}, | ||
// {from:'d.e.f', to:'d.f'}, | ||
// {from:'d.e.g', to:'d.g'} | ||
// ], | ||
// true | ||
// )(objFrom) | ||
// objTo | ||
// } | ||
function copyPropsWithValue(objDest, shouldUpdateOnlyEmptyFields = false) { | ||
@@ -574,0 +592,0 @@ return function (inputObj) { |
@@ -676,6 +676,5 @@ import * as F from 'fluture'; | ||
/** | ||
* Checks if a value is empty: undefined, null, '', 0, NaN, [], {} | ||
* empty is bigger than falsy as we have added [] and {} that are truthy | ||
* Checks if a value is empty: undefined, null, '', 0, 0n, NaN, [], {} | ||
* Empty differs from falsy as we have added: [] and {} that are truthy And removed: false | ||
* @param value - The value to check. | ||
@@ -782,9 +781,2 @@ * @returns Returns `true` if the value is empty, `false` otherwise. | ||
/** | ||
* Gets the date of the previous month. | ||
* @param date - The date to get the previous month. | ||
* @returns The date of the previous month. | ||
*/ | ||
declare function replaceAll(str: any, ...fromTo: any[]): any; | ||
/** | ||
* Replaces all occurrences of a substring in a string. | ||
@@ -795,3 +787,3 @@ * @param str - The string to replace the substring in. | ||
*/ | ||
declare function cleanString(str: any): any; | ||
declare function replaceAll(str: any, ...fromTo: any[]): any; | ||
@@ -803,2 +795,9 @@ /** | ||
*/ | ||
declare function cleanString(str: any): any; | ||
/** | ||
* Repeats a function a specified number of times. | ||
* @param numberOfTimes - The number of times to repeat the function. | ||
* @returns An object with functions to repeat the function. | ||
*/ | ||
declare function repeat(numberOfTimes: any): { | ||
@@ -811,5 +810,5 @@ times: (funToRepeat: any) => any[]; | ||
/** | ||
* Repeats a function a specified number of times. | ||
* @param numberOfTimes - The number of times to repeat the function. | ||
* @returns An object with functions to repeat the function. | ||
* Calls a function one in a specified period. | ||
* @param period - The period to call the function. | ||
* @returns An object with functions to call the function. | ||
*/ | ||
@@ -823,7 +822,3 @@ declare function oneIn(period: any): { | ||
/** | ||
* Calls a function one in a specified period. | ||
* @param period - The period to call the function. | ||
* @returns An object with functions to call the function. | ||
*/ | ||
declare function loopIndexGenerator(initValue: any, iterations: any): Generator<any, void, unknown>; | ||
@@ -830,0 +825,0 @@ |
@@ -28,5 +28,5 @@ { | ||
"node_modules/js-awe": { | ||
"version": "1.0.67", | ||
"resolved": "https://registry.npmjs.org/js-awe/-/js-awe-1.0.67.tgz", | ||
"integrity": "sha512-hTDRBnNJ7T3Zcihw8wDheH0NaFXoe1n9MYvW1rAiKxefZPF8SLtKyfjc0QFqeF8gw84IogM5kInOOdMHlL+rvQ==", | ||
"version": "1.0.68", | ||
"resolved": "https://registry.npmjs.org/js-awe/-/js-awe-1.0.68.tgz", | ||
"integrity": "sha512-zAIeMRpZ3kCNC6D2VZ8o4pyB2qeLF2gKmRfnBJ+J9+ACppGbGLFrJF4+TPHmnao2FCZW1dbWjqn9m0Q45QR5Hw==", | ||
"dependencies": { | ||
@@ -33,0 +33,0 @@ "fluture": "^14.0.0", |
'use strict'; | ||
import clone from 'just-clone'; | ||
import { JSONPath } from 'jsonpath-plus'; | ||
import { value } from 'fluture'; | ||
import { parse } from 'path'; | ||
const logWithPrefix = (title, displayFunc) => (message) => { | ||
@@ -512,2 +514,5 @@ let finalMessage = message; | ||
let valueToCopy = getAt(inputObj, from); | ||
if (typeof rule.transform === 'function') { | ||
valueToCopy = rule.transform(valueToCopy); | ||
} | ||
if (valueToCopy === undefined || valueToCopy === null) | ||
@@ -542,2 +547,15 @@ return; | ||
// } | ||
// { | ||
// let objTo = {a:{b:2},c:12} | ||
// let objFrom = {a:{b:4},g:"2228",d:{e:{f:12}}, l:5} | ||
// copyPropsWithValueUsingRules(objTo, | ||
// [ | ||
// {from:'g', to:'e', transform: parseInt}, | ||
// {from:'d.e.f', to:'d.f'}, | ||
// {from:'d.e.g', to:'d.g'} | ||
// ], | ||
// true | ||
// )(objFrom) | ||
// objTo | ||
// } | ||
function copyPropsWithValue(objDest, shouldUpdateOnlyEmptyFields = false) { | ||
@@ -544,0 +562,0 @@ return function (inputObj) { |
{ | ||
"name": "js-awe", | ||
"version": "1.0.69", | ||
"version": "1.0.70", | ||
"homepage": "https://github.com/josuamanuel/js-awe", | ||
@@ -5,0 +5,0 @@ "author": "josuamanuel@hotmail.com", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1870939
47927