2.9.0 • Published 3 years ago

@headgum/tko-mapping v2.9.0

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

knockout.mapping

Build Status npm version

Object mapping plugin for Knockout

Documentation

Official documentation here.

Install

Bower

bower install bower-knockout-mapping --save

NPM

npm install knockout-mapping --save

Quick Start

var data = {
    email: 'demo@example.com',
    name: 'demo',
    addresses: [
        { type: 'home', country: 'Romania', city: 'Cluj' },
        { type: 'work', country: 'Spain', city: 'Barcelona' }
    ]
};

// Create a view model from data
var viewModel = ko.mapping.fromJS(data);

// Now use the viewModel to change some values (properties are now observable)
viewModel.email('demo2@example.com');
viewModel.name('demo2');
viewModel.addresses()[0].city('Bucharest');

// Retrieve the updated data (as JS object)
var newData = ko.mapping.toJS(viewModel);

// newData now looks like this
{
  email: 'demo2@example.com',
  name: 'demo2',
  addresses: [
    { type: 'home', country: 'Romania', city: 'Bucharest' },
    { type: 'work', country: 'Spain', city: 'Barcelona' }
  ]
}

Run this example in JSFiddle.

Test

Unless CI environment variable is defined, the tests use the latest version Knockout.

License

MIT

acornajvansi-colorsansi-cyanansi-grayansi-redansi-regexansi-stylesansi-wrapanymatchappend-bufferarchyarr-diffarr-filterarr-flattenarr-maparr-unionarray-eacharray-initialarray-lastarray-slicearray-sortarray-unionarray-uniqarray-uniqueasn1assert-plusassign-symbolsasync-doneasync-eachasync-settleasynckitatobaws-sign2aws4bachbalanced-matchbasebcrypt-pbkdfbeeperbinary-extensionsbinaryextensionsbindingsbrace-expansionbracesbuffer-crc32buffer-equalbuffer-fromcache-basecall-bindcamelcasecaselesschalkchokidarclass-utilsclicliuicloneclone-bufferclone-statscloneable-readablecode-point-atcollection-mapcollection-visitcolor-convertcolor-namecolor-supportcombined-streamcommandercomponent-emitterconcat-mapconcat-streamconcat-with-sourcemapsconsole-browserifyconvert-source-mapcopy-descriptorcopy-propscore-util-iscssddashdashdate-nowdebugdebug-fabulousdecamelizedecode-uri-componentdefault-comparedefault-resolutiondefine-propertiesdefine-propertydelayed-streamdetect-filedetect-newlinedom-serializerdomelementtypedomhandlerdomutilsduplexifyeach-propsecc-jsbneditionsend-of-streamensure-posix-pathentitieserror-exes5-extes6-iteratores6-promisees6-symboles6-weak-mapescape-string-regexpevent-emitterexists-statexitexpand-bracketsexpand-rangeexpand-tildeextextendextend-shallowextglobextract-zipextsprintffancy-logfast-deep-equalfast-json-stable-stringifyfast-levenshteinfd-slicerfile-uri-to-pathfilename-regexfill-rangefind-upfindup-syncfinedflagged-respawnflush-write-streamfor-infor-ownforever-agentfork-streamform-datafragment-cachefs-exists-syncfs-extrafs-mkdirp-streamfs.realpathfseventsfunction-bindget-caller-fileget-intrinsicget-valuegetpassglobglob-baseglob-parentglob-streamglob-watcherglobal-modulesglobal-prefixglobbyglogggraceful-fsgraceful-readlinkgulp-cligulp-matchgulploghar-schemahar-validatorhashas-ansihas-flaghas-gulploghas-symbolshas-valuehas-valueshashahomedir-polyfillhosted-git-infohtmlparser2http-signatureinflightinheritsiniinterpretinvert-kvirregular-pluralsis-absoluteis-accessor-descriptoris-arrayishis-binary-pathis-bufferis-core-moduleis-data-descriptoris-descriptoris-dotfileis-equal-shallowis-extendableis-extglobis-fullwidth-code-pointis-globis-negated-globis-numberis-path-cwdis-path-in-cwdis-path-insideis-plain-objectis-posix-bracketis-primitiveis-promiseis-relativeis-streamis-typedarrayis-unc-pathis-utf8is-valid-globis-windowsisarrayisexeisobjectisstreamistextorbinaryjs-reportersjsbnjson-schemajson-schema-traversejson-stable-stringify-without-jsonifyjson-stringify-safejsonfilejsprimjust-debouncekewkind-ofklawlast-runlazystreamlcidleadliftoffload-json-filelodashlodash._reinterpolatelodash.assignlodash.clonedeeplodash.isobjectlodash.mergelodash.templatelodash.templatesettingslog-symbolslru-queuemake-errormake-error-causemake-iteratormap-cachemap-streammap-visitmatchdepmatcher-collectionmath-randommemoizeemerge-streammicromatchmime-dbmime-typesminimatchminimistmixin-deepmkdirpmsmute-stdoutnannanomatchnext-ticknormalize-package-datanormalize-pathnow-and-laternumber-is-nanoauth-signobject-assignobject-copyobject-keysobject-visitobject.assignobject.defaultsobject.mapobject.omitobject.pickobject.reduceonceordered-read-streamsos-homediros-localep-mapparse-filepathparse-globparse-jsonparse-node-versionparse-passwdpascalcasepath-dirnamepath-existspath-is-absolutepath-is-insidepath-parsepath-rootpath-root-regexpath-typependperformance-nowphantomjs-prebuiltpifypinkiepinkie-promiseplugin-errorplurposix-character-classespreservepretty-hrtimeprocess-nextick-argsprogresspslpumppumpifypunycodeqsqunit-phantomjs-runnerqunit-reporter-junitqunitjsrandomaticrcfinderrcloaderread-pkgread-pkg-upreadable-streamreaddirprechoirregex-cacheregex-notremove-bom-bufferremove-bom-streamremove-trailing-separatorrepeat-elementrepeat-stringreplace-extreplace-homedirreplacestreamrequestrequest-progressrequire-directoryrequire-main-filenameresolveresolve-dirresolve-optionsresolve-urlretrimrafsafe-buffersafe-regexsafer-buffersemversemver-greatest-satisfied-rangeset-blockingset-valueshelljssnapdragonsnapdragon-nodesnapdragon-utilsource-mapsource-map-resolvesource-map-urlsparklesspdx-correctspdx-exceptionsspdx-expression-parsespdx-license-idssplit-stringsshpkstack-tracestatic-extendstream-exhauststream-shiftstring_decoderstring-lengthstring-widthstrip-ansistrip-bomstrip-bom-stringstrip-json-commentssupports-colorsver-compatternary-streamtext-tabletextextensionsthrottleitthrough2through2-filtertime-stamptimers-extto-absolute-globto-object-pathto-regexto-regex-rangeto-throughtough-cookietunnel-agenttweetnacltypetypedarrayuglify-jsunc-path-regexundertakerundertaker-registryunion-valueunique-streamunset-valueupathuri-jsurixuseutil-deprecateuuidv8flagsvalidate-npm-package-licensevalue-or-functionverrorvinylvinyl-fsvinyl-sourcemapvinyl-sourcemaps-applywalk-syncwhichwhich-modulewrap-ansiwrappyxtendy18nyargsyargs-parseryauzl
2.9.0

3 years ago

2.8.0

3 years ago

2.7.0

3 years ago