@practicaloptimism/program-utility
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "@practicaloptimism/program-utility", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A set of useful algorithms and data structures for computer programs", | ||
"keywords": [ | ||
"object utility classes", | ||
"object utility functions", | ||
"program manager", | ||
"install computer program at runtime", | ||
"automatically update computer program version at runtime", | ||
"program operator", | ||
"record program operation history", | ||
"read program operation history", | ||
"write program operation history", | ||
"variable access operation tracking", | ||
"variable assignment operation tracking", | ||
"function history of call operations" | ||
"object utility", | ||
"object utility algorithms", | ||
"object utility data structures", | ||
"object duplicator", | ||
"duplicate object", | ||
"object deep copy", | ||
"object deep clone", | ||
"object property key name list", | ||
"get object value by property key name list", | ||
"delete object value by propery key name list", | ||
"update object value by property key name list", | ||
"object is deep equal", | ||
"markdown utility", | ||
"markdown table from javascript object" | ||
], | ||
@@ -19,0 +21,0 @@ "main": "javascript.js", |
import 'mocha' | ||
import { expect } from 'chai' | ||
import { getProjectFilePath } from '../../../../../../../../@expectation-definitions/algorithms/get-project-file-path' | ||
import { getObjectPropertyValueList } from '../../../../../../../../usecase/object-utility/algorithms/object/get-object-property-value-list' | ||
import { createApplicationProgrammableInterfaceTable } from './index' | ||
describe('', () => { | ||
it('should do nothing', () => { | ||
const valueList = getObjectPropertyValueList.function({ | ||
property_1: { | ||
property_1_1: { | ||
propertyValue: 'hello' | ||
}, | ||
property_1_2: { | ||
propertyValue: 'hello' | ||
describe(getProjectFilePath.function(__filename), () => { | ||
it('should create a markdown dropdown list using <details> and <pre>', () => { | ||
const markdownText = createApplicationProgrammableInterfaceTable.function({ | ||
documentationThing1: { | ||
documentationThing2: { | ||
documentationThing3: { | ||
documentationThingValue: true | ||
} | ||
} | ||
}, | ||
property_2: { | ||
property_2_1: { | ||
propertyValue: 'hello' | ||
}, | ||
property_2_2: { | ||
propertyValue: 'hello' | ||
} | ||
} | ||
}, { returnObjectPropertyKeyListPair: true, propertyKeyNameListOrderType: 'depthFirstOrder' }) | ||
// console.log(valueList) | ||
const propertyStringIdList: string[] = [''] | ||
let textString = '' | ||
for (let valueListIndex = 0; valueListIndex < valueList.length; valueListIndex++) { | ||
const objectPropertyKeyList = valueList[valueListIndex].objectPropertyKeyList | ||
const objectPropertyValue = valueList[valueListIndex].objectPropertyValue | ||
const propertyStringId = objectPropertyKeyList.join('') | ||
// const lastItemOnStackItemStringId = objectPropertyKeyListStack[objectPropertyKeyListStack.length - 1] | ||
// const isChildPropertyOfLastItemOnStack = objectPropertyKeyListStringId.indexOf(lastItemOnStackItemStringId) === 0 | ||
// close the previous open <details> using </details> | ||
for (let propertyStringIdListIndex = propertyStringIdList.length - 1; propertyStringIdListIndex > 0; propertyStringIdListIndex--) { | ||
const earlierPropertyStringId = propertyStringIdList[propertyStringIdListIndex] | ||
if (earlierPropertyStringId === '' || earlierPropertyStringId === propertyStringId) { | ||
continue | ||
} | ||
console.log('----ancestro: ', earlierPropertyStringId, '; ', propertyStringId) | ||
const isAncestorToProperty = propertyStringId.indexOf(earlierPropertyStringId) === 0 | ||
// const isSiblingToProperty = | ||
if (isAncestorToProperty) { | ||
break | ||
} | ||
console.log('closing: ', earlierPropertyStringId) | ||
propertyStringIdList.pop() | ||
textString += `\n</details></pre>` | ||
} | ||
// Add the <details> opening tag | ||
if (typeof objectPropertyValue === 'object') { | ||
propertyStringIdList.push(propertyStringId) | ||
textString += `\n\n<pre><details><summary>📁 ${objectPropertyKeyList[objectPropertyKeyList.length - 1]}</summary>` | ||
console.log('opening: ', objectPropertyKeyList[objectPropertyKeyList.length - 1]) | ||
} | ||
// if this is the last element, ensure all the </details> are closed . . . otherwise, continue | ||
if (valueListIndex !== valueList.length - 1) { | ||
continue | ||
} | ||
for (let propertyStringIdListIndex = propertyStringIdList.length - 1; propertyStringIdListIndex > 0; propertyStringIdListIndex--) { | ||
console.log('closing: ', propertyStringIdList.pop()) | ||
textString += `\n</details></pre>` | ||
} | ||
} | ||
console.log(textString) | ||
}) | ||
expect(markdownText).contains('<details>') | ||
expect(markdownText).contains('<pre>') | ||
}) | ||
}) | ||
/* | ||
{ | ||
property1: { // is object ? true . . then open bracket <details> | ||
property1_1: { // is object ? true . . then open bracket <details> | ||
property1_1_1: { // is object ? true . . then open bracket <details> | ||
property1_1_1_1: { // is object ? true . . then open bracket <details> | ||
propertyValue: 'hey' // is object ? false | ||
} | ||
} | ||
}, | ||
property1_2: { // is object ? true . . . . open details . . but close the previous details first . . :O | ||
propertyValue: 'hey' | ||
}, | ||
property1_3: { | ||
propertyValue: 'hey' | ||
} | ||
}, | ||
property2: { | ||
propertyValue: 'hey' | ||
}, | ||
property3: { | ||
propertyValue: 'hey' | ||
} | ||
} | ||
*/ | ||
import { DOCUMENTATION_INTERFACE_LIBRARY_INSTANCE_MODEL } from '../../../../../documentation-interface' | ||
// import { updateObjectValue } from '@/usecase/object-utility/algorithms/object/@architecture' | ||
import { getObjectPropertyValueList } from '../../../../../../../../usecase/object-utility/algorithms/object/get-object-property-value-list' | ||
@@ -8,7 +7,7 @@ | ||
function createApplicationProgrammableInterfaceTableFunction (): string { | ||
function createApplicationProgrammableInterfaceTableFunction (documentationObject: any): string { | ||
const propertyStringIdList: string[] = [''] | ||
let textString = '' | ||
const valueList = getObjectPropertyValueList.function(DOCUMENTATION_INTERFACE_LIBRARY_INSTANCE_MODEL, { | ||
const valueList = getObjectPropertyValueList.function(documentationObject, { | ||
returnObjectPropertyKeyListPair: true, | ||
@@ -15,0 +14,0 @@ propertyKeyNameListOrderType: 'depthFirstOrder' |
import { DOCUMENTATION_INTERFACE_LIBRARY_INSTANCE_MODEL } from '../../../../documentation-interface' | ||
import * as projectConstants from '../../../../../../../@project/constants/project' | ||
@@ -16,3 +17,4 @@ | ||
${ | ||
(`##### Resource Websites: [Source Code](${projectConstants.PROJECT_SOURCE_CODE_URL}) | ||
`##### Resource Websites\n` + | ||
`[Source Code](${projectConstants.PROJECT_SOURCE_CODE_URL}) | ||
| [Demos](${projectConstants.PROJECT_DEMOS_OPTION_URL}) | ||
@@ -22,7 +24,5 @@ | [Video Introduction](${projectConstants.PROJECT_VIDEO_INTRODUCTION_URL}) | ||
| [Live Programming Development Journal](${projectConstants.PROJECT_VIDEO_DEVELOPMENT_JOURNAL_URL}) | ||
`).replace(/(\r\n|\n|\r)/gm, '') // remove line break for single line formatting | ||
`.replace(/(\r\n|\n|\r)/gm, '') // remove line break for single line formatting | ||
} | ||
##### This Documentation Page was last Updated on ${new Date()} | ||
${ | ||
@@ -37,2 +37,4 @@ `##### Project Development Status Updates\n` + | ||
##### This Documentation Page was last Updated on ${new Date()} | ||
### Installation | ||
@@ -108,3 +110,3 @@ | ||
${ // Application Programmable Interface (API Reference) Details Nested Table | ||
createApplicationProgrammableInterfaceTable.function() | ||
createApplicationProgrammableInterfaceTable.function(DOCUMENTATION_INTERFACE_LIBRARY_INSTANCE_MODEL) | ||
} | ||
@@ -111,0 +113,0 @@ |
import * as indexFile from './index' | ||
// Constants | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'createMarkdownTableFromJavascriptObject' | ||
export {} | ||
// Variables | ||
let PROJECT_DOCUMENTATION_INDEX_FILE_CONTENT = indexFile | ||
// Documentation Topic | ||
export { | ||
PROJECT_DOCUMENTATION_TEXT_HEADER, | ||
PROJECT_DOCUMENTATION_INDEX_FILE_CONTENT | ||
} | ||
import * as addObjectToObjectDuplicatorDocumentation from '../add-object-to-object-duplicator/documentation' | ||
import * as createDuplicateDocumentation from '../create-duplicate/documentation' | ||
import * as createObjectDuplicatorDocumentation from '../create-object-duplicator/documentation' | ||
import * as getObjectFromObjectDuplicatorDocumentation from '../get-object-from-object-duplicator/documentation' | ||
import * as removeObjectFromObjectDuplicatorDocumentation from '../remove-object-from-object-duplicator/documentation' | ||
import * as getDuplicateDocumentation from '../get-duplicate/documentation' | ||
import * as removeDuplicateDocumentation from '../delete-duplicate/documentation' | ||
export { | ||
addObjectToObjectDuplicatorDocumentation, | ||
createDuplicateDocumentation, | ||
createObjectDuplicatorDocumentation, | ||
getObjectFromObjectDuplicatorDocumentation, | ||
removeObjectFromObjectDuplicatorDocumentation | ||
getDuplicateDocumentation, | ||
removeDuplicateDocumentation | ||
} | ||
import { addObjectToObjectDuplicator } from '../add-object-to-object-duplicator' | ||
import { createDuplicate } from '../create-duplicate' | ||
import { createObjectDuplicator } from '../create-object-duplicator' | ||
import { getObjectFromObjectDuplicator } from '../get-object-from-object-duplicator' | ||
import { removeObjectFromObjectDuplicator } from '../remove-object-from-object-duplicator' | ||
import { getDuplicate } from '../get-duplicate' | ||
import { deleteDuplicate } from '../delete-duplicate' | ||
export { | ||
addObjectToObjectDuplicator, | ||
createDuplicate, | ||
createObjectDuplicator, | ||
getObjectFromObjectDuplicator, | ||
removeObjectFromObjectDuplicator | ||
getDuplicate, | ||
deleteDuplicate | ||
} |
import * as indexFile from './index' | ||
// Constants | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'createObjectDuplicator' | ||
const PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME = 'precompiled/usecase/object-utility/algorithms/object/create-object-deep-copy' | ||
const PROJECT_ALGORITHM_NAME = 'getObjectValue' | ||
const PROJECT_ALGORITHM_PARAMETER_LIST = [{ | ||
parameterName: 'object', | ||
parameterType: 'any|Object', | ||
parameterExampleList: [`{ "name": "Patrick Morrison", "address": { "city": "Beijing" } }`] | ||
}, { | ||
parameterName: 'propertyKeyNameList', | ||
parameterType: 'string[]', | ||
parameterExampleList: [`['address', 'city']`] | ||
}] | ||
const PROJECT_ALGORITHM_RETURN_PARAMETER_LIST = [{ | ||
parameterName: 'objectPropertyValue', | ||
parameterType: 'any', | ||
parameterExampleList: [`"Beijing"`] | ||
}] | ||
const PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST = [{ | ||
projectExampleUsecaseTitle: `Getting Started: Function call example usecase`, | ||
projectExampleUsecaseSourceCodeTextDescription: `getObjectValue.function(object, propertyKeyNameList)` | ||
}, { | ||
projectExampleUsecaseTitle: `Getting Started: Application context example usecase`, | ||
projectExampleTextDescription: ` | ||
// Create a javascript library instance for your project | ||
const myProjectObjectUtility = objectUtility.consumer.javascript.algorithms.createJavascriptLibraryInstance.function('my-project-id') | ||
// Initialize a javascript object | ||
const myObject = { name: 'Claire', favoriteActivitiesTable: { dancing: { activityName: 'Dancing', placesVisitedToPerformActivity: ['New York', 'Los Angelos'], firstMemoryPerformingActivity: { placePerformedActivity: 'New York' } } }} | ||
// Retrieve the property value of myObject by using a property key name list | ||
const placePerformedActivityDuringFirstMemory = myProjectObjectUtility.usecase.objectUtility.algorithms.getObjectValue.function(myObject, ['favoriteActivitiesTable', 'dancing', 'firstMemoryPerformingActivity', 'placePerformedActivity']) | ||
// Print the place where the first memory of the dancing activity occurred as it is one of Claire's favorite activities | ||
console.log('The following should be "New York": ', placePerformedActivityDuringFirstMemory)` | ||
}] | ||
// Variables | ||
@@ -51,9 +15,6 @@ | ||
export { | ||
PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME, | ||
PROJECT_ALGORITHM_NAME, | ||
PROJECT_ALGORITHM_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_RETURN_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST, | ||
PROJECT_DOCUMENTATION_TEXT_HEADER, | ||
PROJECT_DOCUMENTATION_INDEX_FILE_CONTENT | ||
} | ||
@@ -6,7 +6,10 @@ | ||
import { createObjectDuplicator } from '../create-object-duplicator' | ||
describe(getProjectFilePath.function(__filename), () => { | ||
it(`should do something for ${__filename.split('/')[__filename.split('/').length - 1]}`, () => { | ||
expect(2).to.equal(2) | ||
it('should create an object duplicator', () => { | ||
const originalObject = { name: 'Lucy' } | ||
const objectDuplicator = createObjectDuplicator.function(originalObject) | ||
expect(objectDuplicator.object).to.deep.equal(originalObject) | ||
}) | ||
}) | ||
@@ -6,47 +6,4 @@ | ||
// Constants | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'createObjectDeepCopy' | ||
const PROJECT_DOCUMENTATION_TEXT_DESCRIPTION = ` | ||
This function copies an existing object and makes a copy | ||
where the child objects don't reference one another in | ||
memory. | ||
` | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'deleteObjectValue' | ||
const PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME = 'precompiled/usecase/object-utility/algorithms/object/create-object-deep-copy' | ||
const PROJECT_ALGORITHM_NAME = 'getObjectValue' | ||
const PROJECT_ALGORITHM_PARAMETER_LIST = [{ | ||
parameterName: 'object', | ||
parameterType: 'any|Object', | ||
parameterExampleList: [`{ "name": "Patrick Morrison", "address": { "city": "Beijing" } }`] | ||
}, { | ||
parameterName: 'propertyKeyNameList', | ||
parameterType: 'string[]', | ||
parameterExampleList: [`['address', 'city']`] | ||
}] | ||
const PROJECT_ALGORITHM_RETURN_PARAMETER_LIST = [{ | ||
parameterName: 'objectPropertyValue', | ||
parameterType: 'any', | ||
parameterExampleList: [`"Beijing"`] | ||
}] | ||
const PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST = [{ | ||
projectExampleUsecaseTitle: `Getting Started: Function call example usecase`, | ||
projectExampleUsecaseSourceCodeTextDescription: `getObjectValue.function(object, propertyKeyNameList)` | ||
}, { | ||
projectExampleUsecaseTitle: `Getting Started: Application context example usecase`, | ||
projectExampleTextDescription: ` | ||
// Create a javascript library instance for your project | ||
const myProjectObjectUtility = objectUtility.consumer.javascript.algorithms.createJavascriptLibraryInstance.function('my-project-id') | ||
// Initialize a javascript object | ||
const myObject = { name: 'Claire', favoriteActivitiesTable: { dancing: { activityName: 'Dancing', placesVisitedToPerformActivity: ['New York', 'Los Angelos'], firstMemoryPerformingActivity: { placePerformedActivity: 'New York' } } }} | ||
// Retrieve the property value of myObject by using a property key name list | ||
const placePerformedActivityDuringFirstMemory = myProjectObjectUtility.usecase.objectUtility.algorithms.getObjectValue.function(myObject, ['favoriteActivitiesTable', 'dancing', 'firstMemoryPerformingActivity', 'placePerformedActivity']) | ||
// Print the place where the first memory of the dancing activity occurred as it is one of Claire's favorite activities | ||
console.log('The following should be "New York": ', placePerformedActivityDuringFirstMemory)` | ||
}] | ||
// Variables | ||
@@ -60,12 +17,5 @@ | ||
PROJECT_DOCUMENTATION_TEXT_HEADER, | ||
PROJECT_DOCUMENTATION_TEXT_DESCRIPTION, | ||
PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME, | ||
PROJECT_ALGORITHM_NAME, | ||
PROJECT_ALGORITHM_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_RETURN_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST, | ||
PROJECT_DOCUMENTATION_INDEX_FILE_CONTENT | ||
} | ||
@@ -6,47 +6,4 @@ | ||
// Constants | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'createObjectDeepCopy' | ||
const PROJECT_DOCUMENTATION_TEXT_DESCRIPTION = ` | ||
This function copies an existing object and makes a copy | ||
where the child objects don't reference one another in | ||
memory. | ||
` | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'getObjectPropertyKeyNameList' | ||
const PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME = 'precompiled/usecase/object-utility/algorithms/object/create-object-deep-copy' | ||
const PROJECT_ALGORITHM_NAME = 'getObjectValue' | ||
const PROJECT_ALGORITHM_PARAMETER_LIST = [{ | ||
parameterName: 'object', | ||
parameterType: 'any|Object', | ||
parameterExampleList: [`{ "name": "Patrick Morrison", "address": { "city": "Beijing" } }`] | ||
}, { | ||
parameterName: 'propertyKeyNameList', | ||
parameterType: 'string[]', | ||
parameterExampleList: [`['address', 'city']`] | ||
}] | ||
const PROJECT_ALGORITHM_RETURN_PARAMETER_LIST = [{ | ||
parameterName: 'objectPropertyValue', | ||
parameterType: 'any', | ||
parameterExampleList: [`"Beijing"`] | ||
}] | ||
const PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST = [{ | ||
projectExampleUsecaseTitle: `Getting Started: Function call example usecase`, | ||
projectExampleUsecaseSourceCodeTextDescription: `getObjectValue.function(object, propertyKeyNameList)` | ||
}, { | ||
projectExampleUsecaseTitle: `Getting Started: Application context example usecase`, | ||
projectExampleTextDescription: ` | ||
// Create a javascript library instance for your project | ||
const myProjectObjectUtility = objectUtility.consumer.javascript.algorithms.createJavascriptLibraryInstance.function('my-project-id') | ||
// Initialize a javascript object | ||
const myObject = { name: 'Claire', favoriteActivitiesTable: { dancing: { activityName: 'Dancing', placesVisitedToPerformActivity: ['New York', 'Los Angelos'], firstMemoryPerformingActivity: { placePerformedActivity: 'New York' } } }} | ||
// Retrieve the property value of myObject by using a property key name list | ||
const placePerformedActivityDuringFirstMemory = myProjectObjectUtility.usecase.objectUtility.algorithms.getObjectValue.function(myObject, ['favoriteActivitiesTable', 'dancing', 'firstMemoryPerformingActivity', 'placePerformedActivity']) | ||
// Print the place where the first memory of the dancing activity occurred as it is one of Claire's favorite activities | ||
console.log('The following should be "New York": ', placePerformedActivityDuringFirstMemory)` | ||
}] | ||
// Variables | ||
@@ -60,12 +17,5 @@ | ||
PROJECT_DOCUMENTATION_TEXT_HEADER, | ||
PROJECT_DOCUMENTATION_TEXT_DESCRIPTION, | ||
PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME, | ||
PROJECT_ALGORITHM_NAME, | ||
PROJECT_ALGORITHM_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_RETURN_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST, | ||
PROJECT_DOCUMENTATION_INDEX_FILE_CONTENT | ||
} | ||
@@ -6,47 +6,4 @@ | ||
// Constants | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'createObjectPropertyValueList' | ||
const PROJECT_DOCUMENTATION_TEXT_DESCRIPTION = ` | ||
This function copies an existing object and makes a copy | ||
where the child objects don't reference one another in | ||
memory. | ||
` | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'getObjectPropertyValueList' | ||
const PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME = 'precompiled/usecase/object-utility/algorithms/object/create-object-deep-copy' | ||
const PROJECT_ALGORITHM_NAME = 'getObjectValue' | ||
const PROJECT_ALGORITHM_PARAMETER_LIST = [{ | ||
parameterName: 'object', | ||
parameterType: 'any|Object', | ||
parameterExampleList: [`{ "name": "Patrick Morrison", "address": { "city": "Beijing" } }`] | ||
}, { | ||
parameterName: 'propertyKeyNameList', | ||
parameterType: 'string[]', | ||
parameterExampleList: [`['address', 'city']`] | ||
}] | ||
const PROJECT_ALGORITHM_RETURN_PARAMETER_LIST = [{ | ||
parameterName: 'objectPropertyValue', | ||
parameterType: 'any', | ||
parameterExampleList: [`"Beijing"`] | ||
}] | ||
const PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST = [{ | ||
projectExampleUsecaseTitle: `Getting Started: Function call example usecase`, | ||
projectExampleUsecaseSourceCodeTextDescription: `getObjectValue.function(object, propertyKeyNameList)` | ||
}, { | ||
projectExampleUsecaseTitle: `Getting Started: Application context example usecase`, | ||
projectExampleTextDescription: ` | ||
// Create a javascript library instance for your project | ||
const myProjectObjectUtility = objectUtility.consumer.javascript.algorithms.createJavascriptLibraryInstance.function('my-project-id') | ||
// Initialize a javascript object | ||
const myObject = { name: 'Claire', favoriteActivitiesTable: { dancing: { activityName: 'Dancing', placesVisitedToPerformActivity: ['New York', 'Los Angelos'], firstMemoryPerformingActivity: { placePerformedActivity: 'New York' } } }} | ||
// Retrieve the property value of myObject by using a property key name list | ||
const placePerformedActivityDuringFirstMemory = myProjectObjectUtility.usecase.objectUtility.algorithms.getObjectValue.function(myObject, ['favoriteActivitiesTable', 'dancing', 'firstMemoryPerformingActivity', 'placePerformedActivity']) | ||
// Print the place where the first memory of the dancing activity occurred as it is one of Claire's favorite activities | ||
console.log('The following should be "New York": ', placePerformedActivityDuringFirstMemory)` | ||
}] | ||
// Variables | ||
@@ -60,12 +17,5 @@ | ||
PROJECT_DOCUMENTATION_TEXT_HEADER, | ||
PROJECT_DOCUMENTATION_TEXT_DESCRIPTION, | ||
PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME, | ||
PROJECT_ALGORITHM_NAME, | ||
PROJECT_ALGORITHM_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_RETURN_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST, | ||
PROJECT_DOCUMENTATION_INDEX_FILE_CONTENT | ||
} | ||
import * as indexFile from './index' | ||
@@ -7,47 +6,4 @@ | ||
// Constants | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'createObjectDeepCopy' | ||
const PROJECT_DOCUMENTATION_TEXT_DESCRIPTION = ` | ||
This function copies an existing object and makes a copy | ||
where the child objects don't reference one another in | ||
memory. | ||
` | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'getObjectValue' | ||
const PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME = 'precompiled/usecase/object-utility/algorithms/object/create-object-deep-copy' | ||
const PROJECT_ALGORITHM_NAME = 'getObjectValue' | ||
const PROJECT_ALGORITHM_PARAMETER_LIST = [{ | ||
parameterName: 'object', | ||
parameterType: 'any|Object', | ||
parameterExampleList: [`{ "name": "Patrick Morrison", "address": { "city": "Beijing" } }`] | ||
}, { | ||
parameterName: 'propertyKeyNameList', | ||
parameterType: 'string[]', | ||
parameterExampleList: [`['address', 'city']`] | ||
}] | ||
const PROJECT_ALGORITHM_RETURN_PARAMETER_LIST = [{ | ||
parameterName: 'objectPropertyValue', | ||
parameterType: 'any', | ||
parameterExampleList: [`"Beijing"`] | ||
}] | ||
const PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST = [{ | ||
projectExampleUsecaseTitle: `Getting Started: Function call example usecase`, | ||
projectExampleUsecaseSourceCodeTextDescription: `getObjectValue.function(object, propertyKeyNameList)` | ||
}, { | ||
projectExampleUsecaseTitle: `Getting Started: Application context example usecase`, | ||
projectExampleTextDescription: ` | ||
// Create a javascript library instance for your project | ||
const myProjectObjectUtility = objectUtility.consumer.javascript.algorithms.createJavascriptLibraryInstance.function('my-project-id') | ||
// Initialize a javascript object | ||
const myObject = { name: 'Claire', favoriteActivitiesTable: { dancing: { activityName: 'Dancing', placesVisitedToPerformActivity: ['New York', 'Los Angelos'], firstMemoryPerformingActivity: { placePerformedActivity: 'New York' } } }} | ||
// Retrieve the property value of myObject by using a property key name list | ||
const placePerformedActivityDuringFirstMemory = myProjectObjectUtility.usecase.objectUtility.algorithms.getObjectValue.function(myObject, ['favoriteActivitiesTable', 'dancing', 'firstMemoryPerformingActivity', 'placePerformedActivity']) | ||
// Print the place where the first memory of the dancing activity occurred as it is one of Claire's favorite activities | ||
console.log('The following should be "New York": ', placePerformedActivityDuringFirstMemory)` | ||
}] | ||
// Variables | ||
@@ -61,11 +17,5 @@ | ||
PROJECT_DOCUMENTATION_TEXT_HEADER, | ||
PROJECT_DOCUMENTATION_TEXT_DESCRIPTION, | ||
PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME, | ||
PROJECT_ALGORITHM_NAME, | ||
PROJECT_ALGORITHM_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_RETURN_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST, | ||
PROJECT_DOCUMENTATION_INDEX_FILE_CONTENT | ||
} | ||
@@ -6,47 +6,4 @@ | ||
// Constants | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'createObjectDeepCopy' | ||
const PROJECT_DOCUMENTATION_TEXT_DESCRIPTION = ` | ||
This function copies an existing object and makes a copy | ||
where the child objects don't reference one another in | ||
memory. | ||
` | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'isObjectDeepEqual' | ||
const PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME = 'precompiled/usecase/object-utility/algorithms/object/create-object-deep-copy' | ||
const PROJECT_ALGORITHM_NAME = 'getObjectValue' | ||
const PROJECT_ALGORITHM_PARAMETER_LIST = [{ | ||
parameterName: 'object', | ||
parameterType: 'any|Object', | ||
parameterExampleList: [`{ "name": "Patrick Morrison", "address": { "city": "Beijing" } }`] | ||
}, { | ||
parameterName: 'propertyKeyNameList', | ||
parameterType: 'string[]', | ||
parameterExampleList: [`['address', 'city']`] | ||
}] | ||
const PROJECT_ALGORITHM_RETURN_PARAMETER_LIST = [{ | ||
parameterName: 'objectPropertyValue', | ||
parameterType: 'any', | ||
parameterExampleList: [`"Beijing"`] | ||
}] | ||
const PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST = [{ | ||
projectExampleUsecaseTitle: `Getting Started: Function call example usecase`, | ||
projectExampleUsecaseSourceCodeTextDescription: `getObjectValue.function(object, propertyKeyNameList)` | ||
}, { | ||
projectExampleUsecaseTitle: `Getting Started: Application context example usecase`, | ||
projectExampleTextDescription: ` | ||
// Create a javascript library instance for your project | ||
const myProjectObjectUtility = objectUtility.consumer.javascript.algorithms.createJavascriptLibraryInstance.function('my-project-id') | ||
// Initialize a javascript object | ||
const myObject = { name: 'Claire', favoriteActivitiesTable: { dancing: { activityName: 'Dancing', placesVisitedToPerformActivity: ['New York', 'Los Angelos'], firstMemoryPerformingActivity: { placePerformedActivity: 'New York' } } }} | ||
// Retrieve the property value of myObject by using a property key name list | ||
const placePerformedActivityDuringFirstMemory = myProjectObjectUtility.usecase.objectUtility.algorithms.getObjectValue.function(myObject, ['favoriteActivitiesTable', 'dancing', 'firstMemoryPerformingActivity', 'placePerformedActivity']) | ||
// Print the place where the first memory of the dancing activity occurred as it is one of Claire's favorite activities | ||
console.log('The following should be "New York": ', placePerformedActivityDuringFirstMemory)` | ||
}] | ||
// Variables | ||
@@ -60,11 +17,5 @@ | ||
PROJECT_DOCUMENTATION_TEXT_HEADER, | ||
PROJECT_DOCUMENTATION_TEXT_DESCRIPTION, | ||
PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME, | ||
PROJECT_ALGORITHM_NAME, | ||
PROJECT_ALGORITHM_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_RETURN_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST, | ||
PROJECT_DOCUMENTATION_INDEX_FILE_CONTENT | ||
} | ||
@@ -6,47 +6,4 @@ | ||
// Constants | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'createObjectDeepCopy' | ||
const PROJECT_DOCUMENTATION_TEXT_DESCRIPTION = ` | ||
This function copies an existing object and makes a copy | ||
where the child objects don't reference one another in | ||
memory. | ||
` | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'updateObjectValueByMapFunction' | ||
const PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME = 'precompiled/usecase/object-utility/algorithms/object/create-object-deep-copy' | ||
const PROJECT_ALGORITHM_NAME = 'getObjectValue' | ||
const PROJECT_ALGORITHM_PARAMETER_LIST = [{ | ||
parameterName: 'object', | ||
parameterType: 'any|Object', | ||
parameterExampleList: [`{ "name": "Patrick Morrison", "address": { "city": "Beijing" } }`] | ||
}, { | ||
parameterName: 'propertyKeyNameList', | ||
parameterType: 'string[]', | ||
parameterExampleList: [`['address', 'city']`] | ||
}] | ||
const PROJECT_ALGORITHM_RETURN_PARAMETER_LIST = [{ | ||
parameterName: 'objectPropertyValue', | ||
parameterType: 'any', | ||
parameterExampleList: [`"Beijing"`] | ||
}] | ||
const PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST = [{ | ||
projectExampleUsecaseTitle: `Getting Started: Function call example usecase`, | ||
projectExampleUsecaseSourceCodeTextDescription: `getObjectValue.function(object, propertyKeyNameList)` | ||
}, { | ||
projectExampleUsecaseTitle: `Getting Started: Application context example usecase`, | ||
projectExampleTextDescription: ` | ||
// Create a javascript library instance for your project | ||
const myProjectObjectUtility = objectUtility.consumer.javascript.algorithms.createJavascriptLibraryInstance.function('my-project-id') | ||
// Initialize a javascript object | ||
const myObject = { name: 'Claire', favoriteActivitiesTable: { dancing: { activityName: 'Dancing', placesVisitedToPerformActivity: ['New York', 'Los Angelos'], firstMemoryPerformingActivity: { placePerformedActivity: 'New York' } } }} | ||
// Retrieve the property value of myObject by using a property key name list | ||
const placePerformedActivityDuringFirstMemory = myProjectObjectUtility.usecase.objectUtility.algorithms.getObjectValue.function(myObject, ['favoriteActivitiesTable', 'dancing', 'firstMemoryPerformingActivity', 'placePerformedActivity']) | ||
// Print the place where the first memory of the dancing activity occurred as it is one of Claire's favorite activities | ||
console.log('The following should be "New York": ', placePerformedActivityDuringFirstMemory)` | ||
}] | ||
// Variables | ||
@@ -60,11 +17,5 @@ | ||
PROJECT_DOCUMENTATION_TEXT_HEADER, | ||
PROJECT_DOCUMENTATION_TEXT_DESCRIPTION, | ||
PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME, | ||
PROJECT_ALGORITHM_NAME, | ||
PROJECT_ALGORITHM_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_RETURN_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST, | ||
PROJECT_DOCUMENTATION_INDEX_FILE_CONTENT | ||
} | ||
@@ -6,47 +6,4 @@ | ||
// Constants | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'createObjectDeepCopy' | ||
const PROJECT_DOCUMENTATION_TEXT_DESCRIPTION = ` | ||
This function copies an existing object and makes a copy | ||
where the child objects don't reference one another in | ||
memory. | ||
` | ||
const PROJECT_DOCUMENTATION_TEXT_HEADER = 'updateObjectValue' | ||
const PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME = 'precompiled/usecase/object-utility/algorithms/object/create-object-deep-copy' | ||
const PROJECT_ALGORITHM_NAME = 'getObjectValue' | ||
const PROJECT_ALGORITHM_PARAMETER_LIST = [{ | ||
parameterName: 'object', | ||
parameterType: 'any|Object', | ||
parameterExampleList: [`{ "name": "Patrick Morrison", "address": { "city": "Beijing" } }`] | ||
}, { | ||
parameterName: 'propertyKeyNameList', | ||
parameterType: 'string[]', | ||
parameterExampleList: [`['address', 'city']`] | ||
}] | ||
const PROJECT_ALGORITHM_RETURN_PARAMETER_LIST = [{ | ||
parameterName: 'objectPropertyValue', | ||
parameterType: 'any', | ||
parameterExampleList: [`"Beijing"`] | ||
}] | ||
const PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST = [{ | ||
projectExampleUsecaseTitle: `Getting Started: Function call example usecase`, | ||
projectExampleUsecaseSourceCodeTextDescription: `getObjectValue.function(object, propertyKeyNameList)` | ||
}, { | ||
projectExampleUsecaseTitle: `Getting Started: Application context example usecase`, | ||
projectExampleTextDescription: ` | ||
// Create a javascript library instance for your project | ||
const myProjectObjectUtility = objectUtility.consumer.javascript.algorithms.createJavascriptLibraryInstance.function('my-project-id') | ||
// Initialize a javascript object | ||
const myObject = { name: 'Claire', favoriteActivitiesTable: { dancing: { activityName: 'Dancing', placesVisitedToPerformActivity: ['New York', 'Los Angelos'], firstMemoryPerformingActivity: { placePerformedActivity: 'New York' } } }} | ||
// Retrieve the property value of myObject by using a property key name list | ||
const placePerformedActivityDuringFirstMemory = myProjectObjectUtility.usecase.objectUtility.algorithms.getObjectValue.function(myObject, ['favoriteActivitiesTable', 'dancing', 'firstMemoryPerformingActivity', 'placePerformedActivity']) | ||
// Print the place where the first memory of the dancing activity occurred as it is one of Claire's favorite activities | ||
console.log('The following should be "New York": ', placePerformedActivityDuringFirstMemory)` | ||
}] | ||
// Variables | ||
@@ -60,11 +17,5 @@ | ||
PROJECT_DOCUMENTATION_TEXT_HEADER, | ||
PROJECT_DOCUMENTATION_TEXT_DESCRIPTION, | ||
PROJECT_DOCUMENTATION_FILE_PATH_DIRECTORY_NAME, | ||
PROJECT_ALGORITHM_NAME, | ||
PROJECT_ALGORITHM_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_RETURN_PARAMETER_LIST, | ||
PROJECT_ALGORITHM_EXAMPLE_USECASE_LIST, | ||
PROJECT_DOCUMENTATION_INDEX_FILE_CONTENT | ||
} | ||
Sorry, the diff of this file is too big to display
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
146275
2333
727